pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andrus <kobruleht2@hot.ee>
To: 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 20:06:47 +0200
Message-ID: <gff602$1ebo$1@news.hub.org> (raw)
In-Reply-To: <alpine.DEB.1.10.0811121730500.4666@aragorn.flymine.org>
References: <gff26k$2etc$1@news.hub.org>
	<1d709ecc0811120928n3c183df5kb7b7d50dee6f73ed@mail.gmail.com>
	<alpine.DEB.1.10.0811121730500.4666@aragorn.flymine.org>

Matthew,

Thank you.

bilkaib table contains GL transactions for every day.
00 records are initial balance records and they appear only in start of year 
or start of month.
They may present or may be not present for some month if initial balance is 
not calculated yet.
If 00 records are present, usuallly there are lot of them for single date 
for db and cr columns.
This query finds initial balance date befeore given date.
bilkaib table contains several year transactions so it is large.

>Alternatively if you create an index on (cr, bilkaib) and one on (db, 
>bilkaib) then you will be able to use other values in the query too.

I'm sorry I do'nt understand this.
What does the (cr, bilkaib) syntax mean?
Should I create two functions indexes and re-write query as Vladimir 
suggests or is there better appoach ?

Andrus. 




view thread (9+ messages)  latest in thread

Message-ID: <gff602$1ebo$1@news.hub.org>
Permalink:  ../gff602$1ebo$1@news.hub.org/
Also on:    postgresql.org/message-id/gff602$1ebo$1@news.hub.org

 · 

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
  Subject: Re: Increasing select max(datecol) from bilkaib where datecol<=date'2008-11-01' and (cr='00' or db='00') speed
  In-Reply-To: <gff602$1ebo$1@news.hub.org>

* 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