Re: 'Interesting' prepared statement slowdown on large table join

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 05/11/2011 06:08 AM, Prodan, Andrei wrote:

Index Scan using attr_name_value on big_table  (cost=0.00..22.85
rows=4 width=7) (actual time=0.176..757.646 rows=914786 loops=1)

Holy inaccurate statistics, Batman!

Try increasing your statistics target for attr_name and attr_value in your big table. I know you said you set it to 300 on party_id, but what happened here is that the optimizer thought this particular name/value combo in your big table would return less rows, and it was horribly, horribly wrong.

You might think about bumping up your default_statistics_target anyway to prevent problems like this in general. But definitely increase it on those two columns and reanalyze. My guess is that your big_table is big enough that each analyze gets a different random sample of the various attr_name and attr_value combinations, so occasionally it'll get too few and start badly skewing query plans.

--
Shaun Thomas
OptionsHouse | 141 W. Jackson Blvd. | Suite 800 | Chicago IL, 60604
312-676-8870
sthomas@xxxxxxxxx

______________________________________________

See  http://www.peak6.com/email_disclaimer.php
for terms and conditions related to this email

--
Sent via pgsql-performance mailing list (pgsql-performance@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance


[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux