pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andrus <eetasoft@online.ee>
To: pgsql-performance@postgresql.org
Subject: Re: Why date index is not used
Date: Fri, 9 Jun 2006 12:52:21 +0300
Message-ID: <e6bgd5$1vgk$3@news.hub.org> (raw)
References: <e69rq9$2a1b$1@news.hub.org>
	<196.1149794455@sss.pgh.pa.us>

Tom,

> Because it doesn't help --- the system still has to do the sort.

It can help a lot in this case.

kuupaev is sales date
kellaaeg is sales time

Postgres can use kuupaev index to fetch first 100 rows plus a number of more 
rows whose kellaaeg value is equal to kellaaeg in 100 th row. I have 500 
sales per day.
So it can fetch 600 rows using index on kuupaev column.

After that it can sort those 600 rows fast.
Currently it sorts blindly  all 54000 rows in table.

> You'd need a two-column index on both of the ORDER BY columns to avoid
> sorting.

Thank you. It works.

Andrus. 





view thread (11+ messages)  latest in thread

Message-ID: <e6bgd5$1vgk$3@news.hub.org>
Permalink:  ../e6bgd5$1vgk$3@news.hub.org/
Also on:    postgresql.org/message-id/e6bgd5$1vgk$3@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: eetasoft@online.ee
  Subject: Re: Why date index is not used
  In-Reply-To: <e6bgd5$1vgk$3@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