Re: Why date index is not used

From: "Jim C(dot) Nasby" <jnasby(at)pervasive(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Andrus <eetasoft(at)online(dot)ee>, pgsql-performance(at)postgresql(dot)org
Subject: Re: Why date index is not used
Date: 2006-06-08 21:57:45
Message-ID: 20060608215745.GE45331@pervasive.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Thu, Jun 08, 2006 at 03:20:55PM -0400, Tom Lane wrote:
> "Andrus" <eetasoft(at)online(dot)ee> writes:
> > Why Postgres 8.1 does not use makse_kuupaev_idx index in the following query
> > ?
>
> Because it doesn't help --- the system still has to do the sort.
> You'd need a two-column index on both of the ORDER BY columns to avoid
> sorting.

And even then you better have a pretty high correlation on the first
column, otherwise you'll still get a seqscan.
--
Jim C. Nasby, Sr. Engineering Consultant jnasby(at)pervasive(dot)com
Pervasive Software http://pervasive.com work: 512-231-6117
vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Tom Lane 2006-06-08 22:19:41 Re: Why date index is not used
Previous Message Dave Dutcher 2006-06-08 20:07:42 Re: Why date index is not used