Re: [PERFORM] Weird, bad 0.5% selectivity estimate for a column equal to itself

2013-06-21 Thread Josh Berkus
On 06/21/2013 02:32 PM, Tom Lane wrote: > Josh Berkus writes: >> I'm getting something really odd in 9.2.4, where the planner estimates >> that the selectivity of a column equal to itself is always exactly 0.5% >> (i.e. 0.005X). I can't figure out where this constant is coming from, >> or why it'

Re: [PERFORM] Weird, bad 0.5% selectivity estimate for a column equal to itself

2013-06-21 Thread Tom Lane
Josh Berkus writes: > I'm getting something really odd in 9.2.4, where the planner estimates > that the selectivity of a column equal to itself is always exactly 0.5% > (i.e. 0.005X). I can't figure out where this constant is coming from, > or why it's being applied. See DEFAULT_EQ_SEL. But why

[PERFORM] Weird, bad 0.5% selectivity estimate for a column equal to itself

2013-06-21 Thread Josh Berkus
Folks, I'm getting something really odd in 9.2.4, where the planner estimates that the selectivity of a column equal to itself is always exactly 0.5% (i.e. 0.005X). I can't figure out where this constant is coming from, or why it's being applied. Test case: create table esttest ( id int not

Re: [PERFORM] Query tuning: partitioning, DISTINCT ON, and indexing

2013-06-21 Thread Maciek Sakrejda
On Fri, Jun 21, 2013 at 9:08 AM, bricklen wrote: > Did you try an index on (type, ts desc) ? I don't have much else to add at > this point, but maybe after posting some more server and table (parent and > child) details someone will have an answer for you. > No, this is exactly what I was missin

Re: [PERFORM] Query tuning: partitioning, DISTINCT ON, and indexing

2013-06-21 Thread bricklen
On Thu, Jun 20, 2013 at 10:14 PM, Maciek Sakrejda wrote: > On Thu, Jun 20, 2013 at 9:13 PM, bricklen wrote: > >> >> On Thu, Jun 20, 2013 at 6:24 PM, Maciek Sakrejda wrote: >> >>> SELECT >>> DISTINCT ON (type) ts, type, details >>> FROM >>> observations >>> WHERE >>> subject = '...' >>> ORDE