Why does the planner want to crawl the table that has 5M rows instead of the one
with 176k rows? Both tables are freshly vacuum-full-analyzed.
7.4.7 on i686-redhat-linux-gnu, compiled by GCC gcc (GCC) 3.4.3 20041212 (Red Hat 3.4.3-9.EL4)
callrec32=# explain select fd.base from fix.dups fd join fix.files ff using (base);
QUERY PLAN
----------------------------------------------------------------------------
Hash Join (cost=5340.00..292675.06 rows=176161 width=44)
Hash Cond: (("outer".base)::text = ("inner".base)::text)
-> Seq Scan on files ff (cost=0.00..117301.58 rows=5278458 width=41)
-> Hash (cost=3436.60..3436.60 rows=176160 width=44)
-> Seq Scan on dups fd (cost=0.00..3436.60 rows=176160 width=44)
(5 rows)
callrec32=# \d fix.files
Table "fix.files"
Column | Type | Modifiers
--------+------------------------+-----------
dir | character varying(255) |
base | character varying(255) |
Indexes:
"base_storename_idx" btree (base, ((((dir)::text || '/'::text) || (base)::text)))
"ff_storename_idx" btree (((((dir)::text || '/'::text) || (base)::text)))
callrec32=# \d fix.dups
Table "fix.dups"
Column | Type | Modifiers
--------+------------------------+-----------
base | character varying(255) |
Indexes:
"dups_base_key" unique, btree (base)
callrec32=# select count(*) from fix.files; select count(*) from fix.dups;
count
---------
5278458
(1 row)
count
--------
176160
(1 row)
--
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man. You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991