From: Lew <lew@lewscanon.nospam>
To: pgsql-performance@postgresql.org
Subject: Re: multicolumn index column order
Date: Fri, 27 Jul 2007 16:03:11 -0400
Message-ID: <tqCdnQLIFqLi0jfbnZ2dnUVZ_u3inZ2d@comcast.com> (raw)
In-Reply-To: <1185352440.504985.282370@19g2000hsx.googlegroups.com>
References: <200707240710.l6O7AUu24090@pillette.com>
<3ce9822f0707240040o2f358155p7ff7537bbe986209@mail.gmail.com>
<ZcadnVxk8I9ICDvbnZ2dnUVZ_gidnZ2d@comcast.com>
<1185352440.504985.282370@19g2000hsx.googlegroups.com>
valgog wrote:
> On Jul 25, 2:14 am, Lew <l...@lewscanon.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
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: lew@lewscanon.nospam
Subject: Re: multicolumn index column order
In-Reply-To: <tqCdnQLIFqLi0jfbnZ2dnUVZ_u3inZ2d@comcast.com>
* 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