Re: [PERFORM] Postgres does not use indexes with OR-conditions

2014-11-07 Thread David G Johnston
Kevin Grittner-5 wrote > Andrew Dunstan < > andrew@ > > wrote: >> On 11/07/2014 12:06 AM, Vlad Arkhipov wrote: > >>> I need to rewrite it in the way below to make Postgres use the index. >>> >>> select * >>> from commons.financial_documents fd >>> where fd.creation_time <= '2011-11-07 10:39:07.2

Re: [PERFORM] Postgres does not use indexes with OR-conditions

2014-11-07 Thread Tom Lane
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 d

Re: [PERFORM] Postgres does not use indexes with OR-conditions

2014-11-07 Thread Kevin Grittner
Andrew Dunstan wrote: > On 11/07/2014 12:06 AM, Vlad Arkhipov wrote: >> I need to rewrite it in the way below to make Postgres use the index. >> >> select * >> from commons.financial_documents fd >> where fd.creation_time <= '2011-11-07 10:39:07.285022+08' >> and ( >>fd.creation_time < '2011

Re: [PERFORM] pgtune + configurations with 9.3

2014-11-07 Thread Shaun Thomas
> Yeah, pgTune is pretty badly out of date. It's been on my TODO list, as > I'm sure it has been on Greg's. Yeah. And unfortunately the recommendations it gives have been spreading. Take a look at the online version: http://pgtune.leopard.in.ua/ I entered a pretty typical 92GB system, and it r

Re: [PERFORM] Postgres does not use indexes with OR-conditions

2014-11-07 Thread Andrew Dunstan
On 11/07/2014 12:06 AM, Vlad Arkhipov wrote: It was just a minimal example. The real query looks like this. select * from commons.financial_documents fd where fd.creation_time < '2011-11-07 10:39:07.285022+08' or (fd.creation_time = '2011-11-07 10:39:07.285022+08' and fd.financial_document_i

Re: [PERFORM] Index order ignored after `is null` in query

2014-11-07 Thread Artūras Lapinskas
Hi, thanks for your time and answer. Not treating IS NULL as equality operator definitely helps me to make more sense out of previous explains. -- Best Regard, Artūras Lapinskas On Thu, Nov 06, 2014 at 12:23:12PM -0500, Tom Lane wrote: =?utf-8?Q?Art=C5=ABras?= Lapinskas writes: After some