Re: Query tuning: partitioning, DISTINCT ON, and indexing - Mailing list pgsql-performance

From Maciek Sakrejda
Subject Re: Query tuning: partitioning, DISTINCT ON, and indexing
Date
Msg-id CAOtHd0DufFT1RqnL4fbCG_iPjRa0VdJHDSDp36EQ6wcXhd4ANA@mail.gmail.com
Whole thread Raw
In response to Re: Query tuning: partitioning, DISTINCT ON, and indexing  (bricklen <bricklen@gmail.com>)
List pgsql-performance
On Fri, Jun 21, 2013 at 9:08 AM, bricklen <bricklen@gmail.com> 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 missing. I had forgotten the default index order is useless for a descending lookup like this: I made the change and the performance is 3000x better (the plan's using the index now). Thanks for all your help.

pgsql-performance by date:

Previous
From: bricklen
Date:
Subject: Re: Query tuning: partitioning, DISTINCT ON, and indexing
Next
From: Josh Berkus
Date:
Subject: Weird, bad 0.5% selectivity estimate for a column equal to itself