Re: order of nested loop

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Joseph Shraibman <jks(at)selectacast(dot)net>
Cc: pgsql-general(at)postgreSQL(dot)org
Subject: Re: order of nested loop
Date: 2003-06-17 19:07:19
Message-ID: 14685.1055876839@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Joseph Shraibman <jks(at)selectacast(dot)net> writes:
> => explain select * from usertable where podkey = 20;

> Index Scan using usertable_podkey_key on usertable
> (cost=0.00..16019.99 rows=5923 width=625)

> => select count(*) from usertable where podkey = 20;
> count
> -------
> 3
> (1 row)

Well, there's our problem :-(

I would suggest bumping up the statistics target for usertable.podkey
(see ALTER TABLE SET STATISTICS). Since it's only an int4 column you
could make the target 100 (instead of the default 10) without much
cost. That should give substantially finer-grain detail and hopefully
bring this estimate down out of the stratosphere. Re-analyze the table
and see what it gets you.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bill 2003-06-17 19:10:28 Link to Bruce M's fs performance tuning doc
Previous Message Jason Earl 2003-06-17 19:01:35 Re: postgreSQL on NAS/SAN?