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 482C65662A for ; Sat, 19 Mar 2005 23:30:14 +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 89286-06 for ; Sat, 19 Mar 2005 23:30:10 +0000 (GMT) Received: from davinci.ethosmedia.com (server227.ethosmedia.com [209.128.84.227]) by svr1.postgresql.org (Postfix) with ESMTP id EC92B54507 for ; Sat, 19 Mar 2005 23:30:09 +0000 (GMT) X-EthosMedia-Virus-Scanned: no infections found Received: from [63.195.55.98] (account josh@agliodbs.com HELO spooky) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) with ESMTP id 7146080; Sat, 19 Mar 2005 15:32:02 -0800 From: Josh Berkus Organization: Aglio Database Solutions To: Tom Lane Subject: Re: What needs to be done for real Partitioning? Date: Sat, 19 Mar 2005 15:29:51 -0800 User-Agent: KMail/1.6.2 Cc: pgsql-performance@postgresql.org References: <200503191202.38089.josh@agliodbs.com> <18168.1111265368@sss.pgh.pa.us> In-Reply-To: <18168.1111265368@sss.pgh.pa.us> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <200503191529.51794.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.011 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200503/377 X-Sequence-Number: 11082 Tom, Stacy, Alvaro, > I'd rather see the partition control stuff as ALTER TABLE commands, > not decoration on CREATE TABLE. See the WITH OIDS business we just went > through: adding nonstandard decoration to a standard command isn't good. OK, sure. > > -- INSERT INTO should automatically create new partitions where necessary > > -- DELETE FROM should automatically drop empty partitions > > I am not sure I agree with either of those, and the reason is that they > would turn low-lock operations into high-lock operations. For INSERT, I think that's a problem we need to work through. Partitioning on any scheme where you have to depend on the middleware to create new partitions could never be more than a halfway implementation. For one thing, if we can't have 100% dependence on the idea that Table M, Partition 34 contains index values Y-Z, then that form of advanced query rewriting (which is a huge performance gain on really large tables) becomes inaccessable. Or are you proposing, instead, that attempts to insert beyond the range raise an error? > DELETE FROM > would be particularly bad. Furthermore, who wants to implement DROP > PARTITION as a DELETE FROM? ISTM the whole point of partitioning is to > be able to load and unload whole partitions quickly, and having to > DELETE all the rows in a partition isn't my idea of quick. I mostly threw DELETE in for obvious symmetry. If it's complicated, we can drop it. And you're right, I forgot DROP PARTITION. > This is a bad idea. Where are you going to create these automatic > tablespaces? What will they be named? Won't this require superuser > privileges? And what's the point anyway? Stacy White suggests the more sensible version of this: ALTER TABLE {table} CREATE PARTITION WITH VALUE {value} ON TABLESPACE {tablespacename}. Manually creating the partitions in the appropriate location probably makes the most sense. The point, btw, is that if you have a 2TB table, you probably want to put its partitions on several seperate disk arrays. > Huh? ISTM this confuses establishment of a table's partition rule with > the act of pre-creating empty partitions for not-yet-used ranges of > partition keys. I don't understand why this would be confusing. If INSERT isn't creating partitions on new value breakpoint, then CREATE PARTITION needs to. > Or are you trying to suggest that a table could be > partitioned more than one way at a time? If so, how? No. > - Modify the partitioning scheme of a table. In the above example, adding > a '200504' partition, and moving the '200502' orders into 'ARCHIVE' Hmmm ... I don't see the point in automating this. Can you explain? > - Global indexes (that is to say, an index spanning the the table rather > than an individual partition). This seems counterintuitive, but they've > dramatically increased performance on one of our Oracle systems and should > at least be worth considering. Hmmm, again can you detail this? Maybe some performance examples? It seems to me that global indexes might interfere with the maintenance advantages of partitioning. > We probably also need multi-table indexes. Implementing these would be > good for inheritance too. They would be nice, but I don't see them as a requirement for making partitioning work. -- Josh Berkus Aglio Database Solutions San Francisco