Re: simple query with radically different plan after 9.0 -> 9.2 upgrade - Mailing list pgsql-general

From Kevin Goess
Subject Re: simple query with radically different plan after 9.0 -> 9.2 upgrade
Date
Msg-id CABZkbxhnzKOyCcB0xHXjEK76JaN0EORfXcthnRULRJ9RxNMVaw@mail.gmail.com
Whole thread Raw
In response to Re: simple query with radically different plan after 9.0 -> 9.2 upgrade  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: simple query with radically different plan after 9.0 -> 9.2 upgrade
List pgsql-general
Thanks for the reply!  

Your analysis matches everything I see here, so what you say is probably the case. As to why it changed for us with the 9.0 => 9.2 upgrade, I also don't know--the change was pretty dramatic though.  Since we've compensated for it, and since you say the current behavior is actually what's expected, I'm happy.

But since you went to the trouble to reply:

Now, the only way to get to a zero selectivity estimate for var = const
is if the planner believes that the pg_stats most-common-values list
for the column is complete, and the constant is nowhere in the list.
So one plausible explanation for the change in behavior is that you
jacked up the statistics target for the date column enough so that
it includes all of the date values you keep in that column.  

I'm not following you there, but I'm not a full-time database guy.  Attached is the pg_stats for that column in case you find that interesting or helpful.
 
Am I right
in guessing that you drop old data from this table?  How far back?
 
That's right, we store 90 days and roll up data older than that into a different table. 


--
Kevin M. Goess
Software Engineer
Berkeley Electronic Press
kgoess@bepress.com

510-665-1200 x179
www.bepress.com

bepress: sustainable scholarly publishing  
Attachment

pgsql-general by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: Clang 3.3 Analyzer Results
Next
From: Tom Lane
Date:
Subject: Re: simple query with radically different plan after 9.0 -> 9.2 upgrade