Skip site navigation (1) Skip section navigation (2)

Re: Increasing select max(datecol) from bilkaib where datecol<=date'2008-11-01' and (cr='00' or db='00') speed

From: "Andrus" <kobruleht2(at)hot(dot)ee>
To: "Vladimir Sitnikov" <sitnikov(dot)vladimir(at)gmail(dot)com>
Cc: <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Increasing select max(datecol) from bilkaib where datecol<=date'2008-11-01' and (cr='00' or db='00') speed
Date: 2008-11-12 19:44:38
Message-ID: 498EDF1308A1409E9CE994C83A345BA3@andrusnotebook (view raw or flat)
Thread:
Lists: pgsql-performance
Vladimir,

>I am afraid PostgreSQL is not smart enough to rewrite query with "or" into 
>two separate index scans. There is no way to improve the query 
>significantly without rewriting it.
>Note:  for this case indices on (datecol), (cr) and (db) are not very 
>helpful.

Thank you very much.
I added you indexes to db and re-write query.
Now it runs fast.

Andrus.


In response to

pgsql-performance by date

Next:From: AndrusDate: 2008-11-12 19:57:06
Subject: Re: Increasing select max(datecol) from bilkaib wheredatecol<=date'2008-11-01' and (cr='00' or db='00') speed
Previous:From: hubert depesz lubaczewskiDate: 2008-11-12 19:39:19
Subject: Re: Increasing select max(datecol) from bilkaib wheredatecol<=date'2008-11-01' and (cr='00' or db='00') speed

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group