Hi.
I have a strange situation where generating the query plan takes 6s+ and
executing it takes very little time.
2013-09-03 09:19:38.726 db=# explain select table.id from db.table left
join db.tablepro on db.id = tablepro.table_id where table.fts @@
to_tsquery('english','q12345') ;
QUERY PLAN
-------------------------------------------------------------------------------------------------------------------
Nested Loop Left Join (cost=43.71..12711.39 rows=2930 width=4)
-> Bitmap Heap Scan on sequence (cost=43.71..4449.10 rows=2930 width=4)
Recheck Cond: (fts @@ '''q12345'''::tsquery)
-> Bitmap Index Scan on table_gin_idx (cost=0.00..42.98
rows=2930 width=0)
Index Cond: (fts @@ '''q12345'''::tsquery)
-> Index Only Scan using tablepro_seqid_idx on tablepro
(cost=0.00..2.81 rows=1 width=4)
Index Cond: (tablepro_id = table.id)
(7 rows)
Time: 10458.404 ms
The query gives 4 rows out of 50.000.000, so the query-plan is actually
correct and as expected.
Any suggestions?
Jesper