Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 7D1879FB2E1 for ; Tue, 31 Oct 2006 20:11:07 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 83997-03 for ; Tue, 31 Oct 2006 20:11:07 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from exprod6og54.obsmtp.com (exprod6og54.obsmtp.com [64.18.1.189]) by postgresql.org (Postfix) with SMTP id 4DEE59FA4A3 for ; Tue, 31 Oct 2006 20:11:06 -0400 (AST) Received: from source ([63.240.6.46]) by exprod6ob54.postini.com ([64.18.5.12]) with SMTP; Tue, 31 Oct 2006 16:11:03 PST Received: from 172.16.1.239 by mail.mi8.com with ESMTP (- Welcome to Mi8 Corporation www.Mi8.com (D2)); Tue, 31 Oct 2006 19:10:55 -0500 X-Server-Uuid: 7829E76E-BB9E-4995-8473-3C0929DF7DD1 Received: from MI8NYCMAIL06.Mi8.com ([172.16.1.175]) by d01smtp06.Mi8.com with Microsoft SMTPSVC(6.0.3790.1830); Tue, 31 Oct 2006 19:10:55 -0500 Received: from 69.181.100.71 ([69.181.100.71]) by MI8NYCMAIL06.Mi8.com ( [172.16.1.219]) via Exchange Front-End Server mi8owa.mi8.com ( [172.16.1.105]) with Microsoft Exchange Server HTTP-DAV ; Wed, 1 Nov 2006 00:10:55 +0000 User-Agent: Microsoft-Entourage/11.2.5.060620 Date: Tue, 31 Oct 2006 16:10:54 -0800 Subject: Re: Help w/speeding up range queries? From: "Luke Lonergan" To: "Weslee Bilodeau" , "John Major" cc: pgsql-performance@postgresql.org Message-ID: Thread-Topic: [PERFORM] Help w/speeding up range queries? Thread-Index: Acb9SjJNcOUqRGk9EduBWQAWy4o9DA== In-Reply-To: <4547E2D0.3070100@hypermediasystems.com> MIME-Version: 1.0 X-OriginalArrivalTime: 01 Nov 2006 00:10:55.0790 (UTC) FILETIME=[335EDCE0:01C6FD4A] X-WSS-ID: 695939853ZW1287785-01-01 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200610/640 X-Sequence-Number: 21769 Weslee, On 10/31/06 3:57 PM, "Weslee Bilodeau" wrote: > Basic question - What version, and what indexes do you have? I'd expect the problem with this is that unless the indexed column is correlated with the loading order of the rows over time, then the index will refer to rows distributed non-sequentially on disk, in which case the index can be worse than a sequential scan. You can cluster the table on the index (don't use the "CLUSTER" command! Do a CREATE TABLE AS SELECT .. ORDER BY instead!), but the index won't refer to sequential table data when there's more data added. What this does is analogous to the partitioning option though, and you don't have the problem of the table being de-clustered on the constraint column. The problem with the current support for partitioning is that you have to implement rules for inserts/updates/deletes so that you can do them to the parent and they will be implemented on the children. As a result, partitioning is not transparent. OTOH, it achieves great performance gains. BTW - If you have a date column and your data is loaded in date order, then an index is all that's necessary, you will get sequential access. - Luke