weird EXPLAIN

Поиск
Список
Период
Сортировка
От Varun Kacholia
Тема weird EXPLAIN
Дата
Msg-id 20020618013423.B4650@voxel.cse.iitb.ac.in
обсуждение исходный текст
Ответы Re: weird EXPLAIN  (Tom Jenkins <tjenkins@devis.com>)
Re: weird EXPLAIN  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
Список pgsql-general
hi ,
 I have just migrated to PostgreSQL...and found the following wierd :

 suryadb=# explain select * from dbwin where id in (select id from wdwin
 where word='bacd');
 NOTICE:  QUERY PLAN:
 Seq Scan on dbwin  (cost=0.00..8158.20 rows=1000 width=76)
 ^^^^^^^^^^^^^^^^^^
   SubPlan
     ->  Materialize  (cost=8.14..8.14 rows=10 width=4)
->  Index Scan using wdkwin on wdwin  (cost=0.00..8.14 rows=10 width=4)


 i wanted to know why a sequential scan is done on the field id
while it is a primary key in the table dbwin.this can be clearly
confirmed from the  query below :

suryadb=# explain select * from dbwin where id=1234;
NOTICE:  QUERY PLAN:
Index Scan using dbwin_pkey on dbwin  (cost=0.00..8.14 rows=10 width=76)

why does it do a sequential scan for the query above??
Also i would be happy if someone could explain me the numbers in the
cost thing.. i read the docs....but it is kinda confusing and incomplete.

--
------
Varun
Intel Inside - Idiot outside


В списке pgsql-general по дате отправления:

Предыдущее
От: Tom Jenkins
Дата:
Сообщение: Re: create definiton
Следующее
От: Tom Jenkins
Дата:
Сообщение: Re: weird EXPLAIN