question about seq scan and index scan

Поиск
Список
Период
Сортировка
От Sébastien PALLEAU
Тема question about seq scan and index scan
Дата
Msg-id 046001c27c42$1ff1eef0$0a01000a@seb
обсуждение исходный текст
Ответы Re: question about seq scan and index scan
Список pgsql-general
hi,
I tried to execute the following request on a postgresql 7.2.3 system :
 
select count(*) from table tablea a, tableb b, tablec c where a.id=b.id and a.id=c.id and a.mynumber > 5000;
tablea, tableb and tablec have primary on id that identify a unique member.
 
tablea contains 471413 records
tableb contains 471413 records
tablec contains 471413 records
 
a.id is tablea primary key
b.id is tableb primary key
c.id is tablec primary key
 
An explain on the request provides the following results.
seq scan on tableb.id (I dont agree)
seq scan on tablec.id (i dont agree)
seq scan on tablea.id (seems normal but why executed last ?)
 
and the most strange is that for the following request :
explain select count(*) from table tablea a, tableb b, tablec c where a.id=b.id and a.id=c.id and a.mynumber > 20000;
provides :
index scan using numberpoints_tablea_key
index scan using tableb_pkey
index scan using tablec_pkey
 
why doesn't postgres uses indexes in the first case ?
thanks for your anwers.

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

Предыдущее
От: asandini@keyware.com
Дата:
Сообщение: cancel <3DBD1878.6060706@keyware.com>
Следующее
От: Andrew Sullivan
Дата:
Сообщение: Re: Simultaneous vacuum-ing