sequence scan, but indexed tables

Поиск
Список
Период
Сортировка
От csernazs@freemail.hu (Cserna Zsolt)
Тема sequence scan, but indexed tables
Дата
Msg-id e64bb1c1.0207190027.5c54f43e@posting.google.com
обсуждение исходный текст
Ответы Re: sequence scan, but indexed tables  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
Hi!

I have two tables (picmain, and picalbum). Both table has an unique
index filed, which is indexed (this field called "aid" and the indexes
are: picmain_aid_idx, picalbum_aid_idx). But when I execute the query
with simple join, I get this:

explain SELECT picmain.aid from picmain, picalbum where
picmain.aid=picalbum.aid;
NOTICE:  QUERY PLAN:

Hash Join  (cost=806.71..69631.60 rows=832629 width=8)
  ->  Seq Scan on picalbum  (cost=0.00..14323.29 rows=832629 width=4)
  ->  Hash  (cost=730.57..730.57 rows=30457 width=4)
        ->  Seq Scan on picmain  (cost=0.00..730.57 rows=30457
width=4)

Both table has "relative" many rows (picmain: around 30000, picalbum:
around 800000).

I don't know why postgres use sequence scan, because I have two good
indexes. :)
vacuum, vacuum analyze is done.

I have postgresql 7.0.3 running on Debian GNU/Linux i386.

Thanks.

Zsolt

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

Предыдущее
От: Wim
Дата:
Сообщение: pg_dumpall failed!
Следующее
От: Janning Vygen
Дата:
Сообщение: Re: select a ranking