Skip site navigation (1) Skip section navigation (2)

7.4.7: strange planner decision

From: Roman Neuhauser <neuhauser(at)sigpipe(dot)cz>
To: pgsql-general(at)postgresql(dot)org
Subject: 7.4.7: strange planner decision
Date: 2005-07-13 11:12:21
Message-ID: 20050713111221.GA62701@isis.sigpipe.cz (view raw or flat)
Thread:
Lists: pgsql-general
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

Responses

pgsql-general by date

Next:From: Janning VygenDate: 2005-07-13 11:44:54
Subject: strange error with temp table: pg_type_typname_nsp_index
Previous:From: AndrusDate: 2005-07-13 10:58:12
Subject: Re: illegal sort order

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group