Re: Query tuning: partitioning, DISTINCT ON, and indexing

From: Maciek Sakrejda <m(dot)sakrejda(at)gmail(dot)com>
To: bricklen <bricklen(at)gmail(dot)com>
Cc: "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Query tuning: partitioning, DISTINCT ON, and indexing
Date: 2013-06-21 17:08:50
Message-ID: CAOtHd0DufFT1RqnL4fbCG_iPjRa0VdJHDSDp36EQ6wcXhd4ANA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Fri, Jun 21, 2013 at 9:08 AM, bricklen <bricklen(at)gmail(dot)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.

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Josh Berkus 2013-06-21 19:52:05 Weird, bad 0.5% selectivity estimate for a column equal to itself
Previous Message bricklen 2013-06-21 16:08:38 Re: Query tuning: partitioning, DISTINCT ON, and indexing