Or is this in the planner? Same query, same tables, one with seqscan
enabled, one with it disabled (btw, whomever added the ANALYZE to EXPLAIN,
pure genius):
iwantu=# explain analyze SELECT poc.uid,headline,pictures,voice FROM orient poc JOIN clubs c ON (poc.uid = c.uid AND
c.club= 3 );
NOTICE: QUERY PLAN:
Nested Loop (cost=0.00..1791417.52 rows=26566 width=72) (actual time=0.55..3345.13 rows=23510 loops=1) -> Index Scan
usingclubs_idx on clubs c (cost=0.00..1695474.62 rows=26569 width=64) (actual time=0.48..1936.95 rows=23510 loops=1)
-> Index Scan using orient_pkey on orient poc (cost=0.00..3.60 rows=1 width=8) (actual time=0.03..0.03 rows=1
loops=23510)
Total runtime: 3474.93 msec
iwantu=# set enable_seqscan=true;
iwantu=# explain analyze SELECT poc.uid,headline,pictures,voice FROM orient poc JOIN clubs c ON (poc.uid = c.uid AND
c.club= 3 );
NOTICE: QUERY PLAN:
Hash Join (cost=31693.56..47033.86 rows=26566 width=72) (actual time=1044.41..11450.85 rows=23510 loops=1) -> Seq
Scanon orient poc (cost=0.00..7718.69 rows=485969 width=8) (actual time=0.01..3484.00 rows=485969 loops=1) -> Hash
(cost=31627.14..31627.14rows=26569 width=64) (actual time=1034.14..1034.14 rows=0 loops=1) -> Seq Scan on clubs
c (cost=0.00..31627.14 rows=26569 width=64) (actual time=593.80..836.72 rows=23510 loops=1)
Total runtime: 11583.36 msec