Re: Need advice to avoid ORDER BY

From: John R Pierce <pierce(at)hogranch(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Need advice to avoid ORDER BY
Date: 2013-04-04 22:07:41
Message-ID: 515DF9AD.5000005@hogranch.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 4/4/2013 2:49 PM, Condor wrote:
> Your solution is work, but Im now a little confused. I has a index
> CREATE INDEX ON mytable (valids) USING BTREE (valids) and the
> query to find valids = 0 tooks 137 ms.

the query can't use that index, and the separate index on id at the same
time, it has to pick one.

Merlin's partial index is how you get around this.

--
john r pierce 37N 122W
somewhere on the middle of the left coast

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2013-04-04 22:15:14 Re: Need advice to avoid ORDER BY
Previous Message Merlin Moncure 2013-04-04 21:58:49 Re: Need advice to avoid ORDER BY