Re: Postgres does not use indexes with OR-conditions

From: Tom Lane
Subject: Re: Postgres does not use indexes with OR-conditions
Date: ,
Msg-id: 3340.1415373108@sss.pgh.pa.us
(view: Whole thread, Raw)
In response to: Re: Postgres does not use indexes with OR-conditions  (Kevin Grittner)
List: pgsql-performance

Tree view

Postgres does not use indexes with OR-conditions  (arhipov, )
 Re: Postgres does not use indexes with OR-conditions  (David Rowley, )
  Re: Postgres does not use indexes with OR-conditions  (Vlad Arkhipov, )
   Re: Postgres does not use indexes with OR-conditions  (Andrew Dunstan, )
    Re: Postgres does not use indexes with OR-conditions  (Kevin Grittner, )
     Re: Postgres does not use indexes with OR-conditions  (Tom Lane, )
     Re: Postgres does not use indexes with OR-conditions  (David G Johnston, )

Kevin Grittner <> 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:

From: David G Johnston
Date:
Subject: Re: Postgres does not use indexes with OR-conditions
From: Ruben Domingo Gaspar Aparicio
Date:
Subject: Postgres slave not catching up (on 9.2)