X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 73F31563FD for ; Mon, 21 Mar 2005 03:47:53 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 25481-05 for ; Mon, 21 Mar 2005 03:47:46 +0000 (GMT) Received: from stark.xeocode.com (stark.xeocode.com [216.58.44.227]) by svr1.postgresql.org (Postfix) with ESMTP id 4297E52A85 for ; Mon, 21 Mar 2005 03:47:45 +0000 (GMT) Received: from localhost ([127.0.0.1] helo=stark.xeocode.com) by stark.xeocode.com with smtp (Exim 3.36 #1 (Debian)) id 1DDDtH-0000wa-00; Sun, 20 Mar 2005 22:47:43 -0500 To: Tom Lane Cc: "Stacy White" , "Alvaro Herrera" , "PFC" , "Josh Berkus" , pgsql-performance@postgresql.org Subject: Re: What needs to be done for real Partitioning? References: <200503191202.38089.josh@agliodbs.com> <20050319225624.GA8467@dcc.uchile.cl> <3404.1111277153@sss.pgh.pa.us> <002a01c52d87$543d1010$0200a8c0@grownups> <14172.1111359709@sss.pgh.pa.us> In-Reply-To: <14172.1111359709@sss.pgh.pa.us> From: Greg Stark Organization: The Emacs Conspiracy; member since 1992 Date: 20 Mar 2005 22:47:43 -0500 Message-ID: <871xa9fyn4.fsf@stark.xeocode.com> Lines: 26 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.015 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200503/396 X-Sequence-Number: 11101 Tom Lane writes: > Global indexes would seriously reduce the performance of both vacuum and > cluster for a single partition, and if you want seq scans you don't need > an index for that at all. So the above doesn't strike me as a strong > argument for global indexes ... I think he means some sort of plan for queries like select * from invoices where customer_id = 1 where customer 1 only did business with us for two years. One could imagine some kind of very coarse grained bitmap index that just knows which partitions customer_id=1 appears in, and then does a sequential scan of those partitions. But I think you can do nearly as well without using global indexes of any type. Assuming you had local indexes on customer_id for each partition and separate histograms for each partition the planner could conclude that it needs sequential scans for some partitions and a quick index lookup expecting 0 records for other partitions. Not as good as pruning partitions entirely but if you're doing a sequential scan the performance hit of a few index lookups isn't a problem. -- greg