X-Original-To: pgsql-performance-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id A25659FA4D8 for ; Thu, 8 Jun 2006 18:57:57 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 36875-05 for ; Thu, 8 Jun 2006 18:57:48 -0300 (ADT) 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 938059FA1A4 for ; Thu, 8 Jun 2006 18:57:48 -0300 (ADT) Received: by noel.decibel.org (Postfix, from userid 1001) id 5CD3B5644C; Thu, 8 Jun 2006 16:57:47 -0500 (CDT) Received: (hashcash-sendmail, from uid 1001); Thu, 8 Jun 2006 16:57:45 -0500 Date: Thu, 8 Jun 2006 16:57:45 -0500 From: "Jim C. Nasby" To: Tom Lane Cc: Andrus , pgsql-performance@postgresql.org Subject: Re: Why date index is not used Message-ID: <20060608215745.GE45331@pervasive.com> References: <196.1149794455@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <196.1149794455@sss.pgh.pa.us> 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:060608:tgl@sss.pgh.pa.us::O4QXnMxZRJLHA20F:00000000000000000000 0000000000000000000000002L9q X-Hashcash: 1:20:060608:eetasoft@online.ee::LJG+/UpxG9vTiCgg:0000000000000000000 00000000000000000000000098Ly X-Hashcash: 1:20:060608:pgsql-performance@postgresql.org::V3W5TgIBa0tPH141:00000 0000000000000000000000009T1h X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200606/102 X-Sequence-Number: 19459 On Thu, Jun 08, 2006 at 03:20:55PM -0400, Tom Lane wrote: > "Andrus" writes: > > Why Postgres 8.1 does not use makse_kuupaev_idx index in the following query > > ? > > Because it doesn't help --- the system still has to do the sort. > You'd need a two-column index on both of the ORDER BY columns to avoid > sorting. And even then you better have a pretty high correlation on the first column, otherwise you'll still get a seqscan. -- 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