Re: Postgres does not use indexes with OR-conditions - Mailing list pgsql-performance

From Tom Lane
Subject Re: Postgres does not use indexes with OR-conditions
Date
Msg-id 3340.1415373108@sss.pgh.pa.us
Whole thread Raw
In response to Re: Postgres does not use indexes with OR-conditions  (Kevin Grittner <kgrittn@ymail.com>)
List pgsql-performance
Kevin Grittner <kgrittn@ymail.com> writes:
> On the other hand, why not simply write it as?:

> select *
>   from commons.financial_documents fd
>   where (fd.creation_time, fd.financial_document_id)
>       < ('2011-11-07 10:39:07.285022+08', 100)
>   order by fd.creation_time desc
>   limit 200

That's the way to do it, not only because it's simpler and clearer,
but because the planner will recognize the relevance of the
condition to an index on creation_time, financial_document_id ...

            regards, tom lane


pgsql-performance by date:

Previous
From: Kevin Grittner
Date:
Subject: Re: Postgres does not use indexes with OR-conditions
Next
From: David G Johnston
Date:
Subject: Re: Postgres does not use indexes with OR-conditions