Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 476179FB53F for ; Fri, 27 Jul 2007 17:03:18 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 09579-03 for ; Fri, 27 Jul 2007 17:03:10 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) by postgresql.org (Postfix) with ESMTP id EAC719FB378 for ; Fri, 27 Jul 2007 17:03:13 -0300 (ADT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 91EF330948; Fri, 27 Jul 2007 22:03:12 +0200 (MET DST) Date: Fri, 27 Jul 2007 16:03:11 -0400 From: Lew User-Agent: Thunderbird 2.0.0.5 (X11/20070719) MIME-Version: 1.0 X-Newsgroups: pgsql.performance Subject: Re: multicolumn index column order References: <200707240710.l6O7AUu24090@pillette.com> <3ce9822f0707240040o2f358155p7ff7537bbe986209@mail.gmail.com> <1185352440.504985.282370@19g2000hsx.googlegroups.com> In-Reply-To: <1185352440.504985.282370@19g2000hsx.googlegroups.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Message-ID: Lines: 24 X-Usenet-Provider: http://www.giganews.com X-Complaints-To: abuse@comcast.net X-DMCA-Complaints-To: dmca@comcast.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.35 To: pgsql-performance@postgresql.org X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.13 tagged_above=0 required=5 tests=AWL=0.129, BAYES_50=0.001 X-Spam-Level: X-Archive-Number: 200707/430 X-Sequence-Number: 26114 valgog wrote: > On Jul 25, 2:14 am, Lew wrote: >> How about two indexes, one on each column? Then the indexes will cooperate >> when combined in a WHERE clause. >> >> >> 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