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

Re: multicolumn index column order

From: Lew <lew(at)lewscanon(dot)nospam>
To: pgsql-performance(at)postgresql(dot)org
Subject: Re: multicolumn index column order
Date: 2007-07-27 20:03:11
Message-ID: tqCdnQLIFqLi0jfbnZ2dnUVZ_u3inZ2d@comcast.com (view raw or flat)
Thread:
Lists: pgsql-performance
valgog wrote:
> On Jul 25, 2:14 am, Lew <l(dot)(dot)(dot)(at)lewscanon(dot)nospam> wrote:
>> How about two indexes, one on each column?  Then the indexes will cooperate
>> when combined in a WHERE clause.
>> <http://www.postgresql.org/docs/8.2/interactive/indexes-bitmap-scans.html>
>>
>> I don't believe the index makes a semantic difference with regard to ascending
>> or descending.  An index is used to locate records in the selection phase of a
>> query or modification command.
>>
>> --
>> Lew
> 
> Ordered indexes (b-tree in this case) are also used to get the needed
> record order and it is absolutely not necessary to have a WHARE clause
> in your select statement to use them when you are using ORDER BY.

But does that affect anything when you "ORDER BY foo ASC" vs. when you "ORDER 
BY foo DESC"?

For use by ORDER BY, separate column indexes are an even better idea.

-- 
Lew

In response to

pgsql-performance by date

Next:From: Jignesh K. ShahDate: 2007-07-27 20:04:57
Subject: Re: User concurrency thresholding: where do I look?
Previous:From: Jignesh K. ShahDate: 2007-07-27 19:11:35
Subject: Re: User concurrency thresholding: where do I look?

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