X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 38E039DC82F for ; Fri, 24 Mar 2006 06:21:40 -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 70118-09 for ; Fri, 24 Mar 2006 06:21:41 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id C0E5E9DC83F for ; Fri, 24 Mar 2006 06:21:37 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id ABBDC56423; Fri, 24 Mar 2006 04:21:39 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Fri, 24 Mar 2006 04:21:38 -0600 Date: Fri, 24 Mar 2006 04:21:38 -0600 From: "Jim C. Nasby" To: Theo Kramer Cc: pgsql-performance@postgresql.org Subject: Re: Indexes with descending date columns Message-ID: <20060324102138.GR90527@pervasive.com> References: <200603170625.k2H6PJ926955@pillette.com> <1143112188.2810.27.camel@theo-laptop.int.coza.net.za> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1143112188.2810.27.camel@theo-laptop.int.coza.net.za> X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060324:theo@flame.co.za::kjVGTy5Snb/wxTKn:0AdL9 X-Hashcash: 1:20:060324:pgsql-performance@postgresql.org::B7RtrVFzHyps6w/e:00000 0000000000000000000000002vWv X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.108 required=5 tests=[AWL=0.108] X-Spam-Score: 0.108 X-Spam-Level: X-Archive-Number: 200603/484 X-Sequence-Number: 17921 On Thu, Mar 23, 2006 at 01:09:49PM +0200, Theo Kramer wrote: > ii If no to i, is it feasible to extend PostgreSQL to allow traversing > an index in column descending and column ascending order - assuming > an order by on more than one column with column order not > in the same direction and indexes existing? ... if that makes sense. Yes. stats=# explain select * from email_contrib order by project_id desc, id desc, date desc limit 10; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------ Limit (cost=0.00..31.76 rows=10 width=24) -> Index Scan Backward using email_contrib_pkey on email_contrib (cost=0.00..427716532.18 rows=134656656 width=24) (2 rows) -- Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com Pervasive Software http://pervasive.com work: 512-231-6117 vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461