Re: order of nested loop - Mailing list pgsql-general

From Tom Lane
Subject Re: order of nested loop
Date
Msg-id 14685.1055876839@sss.pgh.pa.us
Whole thread Raw
In response to Re: order of nested loop  (Joseph Shraibman <jks@selectacast.net>)
Responses Re: order of nested loop  (Joseph Shraibman <jks@selectacast.net>)
List pgsql-general
Joseph Shraibman <jks@selectacast.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

pgsql-general by date:

Previous
From: Bill
Date:
Subject: Link to Bruce M's fs performance tuning doc
Next
From: Ron Johnson
Date:
Subject: Re: postgreSQL on NAS/SAN?