X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 8501D9DC9BD; Mon, 19 Dec 2005 12:31:19 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 76389-04; Mon, 19 Dec 2005 12:31:17 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- X-Greylist: from auto-whitelisted by SQLgrey- Received: from alvh.no-ip.org (201-220-123-7.bk10-dsl.surnet.cl [201.220.123.7]) by postgresql.org (Postfix) with ESMTP id 047C49DC9B8; Mon, 19 Dec 2005 12:31:14 -0400 (AST) Received: by alvh.no-ip.org (Postfix, from userid 1000) id 7C651C348F6; Mon, 19 Dec 2005 13:31:33 -0300 (CLST) Date: Mon, 19 Dec 2005 13:31:33 -0300 From: Alvaro Herrera To: Emil Rachovsky Cc: pgsql-sql@postgresql.org, pgsql-general@postgresql.org Subject: Re: [SQL] Question on indexes Message-ID: <20051219163133.GC9980@surnet.cl> Mail-Followup-To: Emil Rachovsky , pgsql-sql@postgresql.org, pgsql-general@postgresql.org References: <20051219155158.45162.qmail@web54312.mail.yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20051219155158.45162.qmail@web54312.mail.yahoo.com> User-Agent: Mutt/1.5.11 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=3.144 required=5 tests=[AWL=-1.889, DNS_FROM_RFC_ABUSE=0.479, DNS_FROM_RFC_POST=1.44, RCVD_IN_XBL=3.114] X-Spam-Score: 3.144 X-Spam-Level: *** X-Archive-Number: 200512/954 X-Sequence-Number: 88517 Emil Rachovsky wrote: > > Hi, > Can anyone show me a simple way of creating an index > in PostGre like that: > create index indName on someTable(someIntColumn DESC) > ? Not using that particular syntax, but you can do that if you create the appropiate operator classes. Note that if you want to use btree index on a single column, you don't need to have a descending index, because btree indexes can be scanned in either direction. The opclass trick is only needed if you want to have a multicolumn index. (I guess in the other access methods it doesn't make much sense to think of descending indexes.) -- Alvaro Herrera http://www.CommandPrompt.com/ The PostgreSQL Company - Command Prompt, Inc.