Can someone explain why pg is doing
a sequential scan on table item with the following
statement
-----
q=> explain select distinct h.id,i.item,i.heading,i.finish from item i ,body_index h where h.id=i.item and
(h.string='book')order by finish;
NOTICE: QUERY PLAN:
Unique (cost=6591.46..6606.51 rows=150 width=24)
-> Sort (cost=6591.46..6591.46 rows=1505 width=24)
-> Hash Join (cost=5323.27..6512.04 rows=1505 width=24)
-> Seq Scan on item i (cost=0.00..964.39 rows=5139 width=20)
-> Hash (cost=5319.51..5319.51 rows=1505 width=4)
-> Index Scan using body_index_string on body_index h (cost=0.00..5319.51 rows=1505 width=4)
---------
"item" table has integer primary key "item". It has
15 or so other columns.
The performance is not very impressive with about
5000 records in item table and 1.5 million record in
body_index and both are supposed to get
much bigger in the real life situation
Is the performance bottle neck that
particular sequential scan?
The database has just been vacuumed.
Thanks in advance