pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andrus <kobruleht2@hot.ee>
To: Vladimir Sitnikov <sitnikov.vladimir@gmail.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Increasing select max(datecol) from bilkaib where datecol<=date'2008-11-01' and (cr='00' or db='00') speed
Date: Wed, 12 Nov 2008 21:44:38 +0200
Message-ID: <498EDF1308A1409E9CE994C83A345BA3@andrusnotebook> (raw)
In-Reply-To: <1d709ecc0811121126k4558db13m88c959188c3a9c0f@mail.gmail.com>
References: <gff26k$2etc$1@news.hub.org>
	<1d709ecc0811120928n3c183df5kb7b7d50dee6f73ed@mail.gmail.com>
	<alpine.DEB.1.10.0811121730500.4666@aragorn.flymine.org>
	<gff602$1ebo$1@news.hub.org>
	<1d709ecc0811121126k4558db13m88c959188c3a9c0f@mail.gmail.com>

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.




view thread (9+ messages)  latest in thread

Message-ID: <498EDF1308A1409E9CE994C83A345BA3@andrusnotebook>
Permalink:  ../498EDF1308A1409E9CE994C83A345BA3@andrusnotebook/
Also on:    postgresql.org/message-id/498EDF1308A1409E9CE994C83A345BA3@andrusnotebook

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: kobruleht2@hot.ee, sitnikov.vladimir@gmail.com
  Subject: Re: Increasing select max(datecol) from bilkaib where datecol<=date'2008-11-01' and (cr='00' or db='00') speed
  In-Reply-To: <498EDF1308A1409E9CE994C83A345BA3@andrusnotebook>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox