Received: from localhost (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 4117464FD6F for ; Thu, 27 Nov 2008 11:10:43 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 87551-02 for ; Thu, 27 Nov 2008 11:10:40 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail-gx0-f12.google.com (mail-gx0-f12.google.com [209.85.217.12]) by mail.postgresql.org (Postfix) with ESMTP id 3A47864FCC3 for ; Thu, 27 Nov 2008 11:10:40 -0400 (AST) Received: by gxk5 with SMTP id 5so960514gxk.19 for ; Thu, 27 Nov 2008 07:10:38 -0800 (PST) Received: by 10.151.83.12 with SMTP id k12mr13645955ybl.46.1227798638689; Thu, 27 Nov 2008 07:10:38 -0800 (PST) Received: by 10.150.202.17 with HTTP; Thu, 27 Nov 2008 07:10:38 -0800 (PST) Message-ID: <3073cc9b0811270710p3a2e5ae9s10f66b529550c03e@mail.gmail.com> Date: Thu, 27 Nov 2008 10:10:38 -0500 From: "Jaime Casanova" To: "Robert Haas" Subject: Re: Fwd: [PATCHES] Auto Partitioning Patch - WIP version 1 Cc: "Gregory Stark" , "Alvaro Herrera" , "Nikhil Sontakke" , "Emmanuel Cecchet" , PostgreSQL-development In-Reply-To: <603c8f070811270641u55bbf340p3383dcc6a6f1f6e8@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <3073cc9b0810220744y987173avd560a33fcb58ede5@mail.gmail.com> <3073cc9b0811261335q5e35d336i33faa17eede7d417@mail.gmail.com> <603c8f070811261352ta6da0b8xcbb8aaf87f050e6e@mail.gmail.com> <3073cc9b0811261613l18e5283ft448ea74fed414dd@mail.gmail.com> <603c8f070811262009v459d0701w151c16533d4ab947@mail.gmail.com> <20081127120402.GC4586@alvh.no-ip.org> <603c8f070811270507i36e18e0bu5d461a4f957e24d3@mail.gmail.com> <871vwxpa7b.fsf@oxford.xeocode.com> <603c8f070811270641u55bbf340p3383dcc6a6f1f6e8@mail.gmail.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.41 tagged_above=0 required=5 tests=SUBJECT_FUZZY_TION=0.41 X-Spam-Level: X-Archive-Number: 200811/1822 X-Sequence-Number: 128534 On Thu, Nov 27, 2008 at 9:41 AM, Robert Haas wrote: > On Thu, Nov 27, 2008 at 8:31 AM, Gregory Stark w= rote: >>> CREATE PARTITION transaction_2008_11 ON transaction WHERE record_date >>> BETWEEN '2008-11-01' AND '2008-11-30'; >> >> I think the main advantage to a better partitioning method would be teac= hing >> Postgres about the partition key. Instead of a collection of different >> constraints Postgres would know that "record_date" is *always* the parti= tion >> key. So it wouldn't have to be specified every time you declare a partit= ion. > > Hmm... I thought the main advantage would be that you wouldn't have > to manually add constraints to all of the child tables, and you > wouldn't have to manually add rules/triggers to the parent table to > redirect DML operations. > ok. what about let CREATE TABLE WITH PARTITIONING to create an entry in a catalog indicating the key of the partition and install the triggers and let the trigger decide if it has the partition to insert the new row (making UPDATE working almost as DELETE+INSERT if it needs to change of partitions) or create the new partition maybe with an apropiate CREATE PARTITION... that way i don't need to create triggers nor inherit tables manually... and because of that maybe we can make possible to add as partition key... PS: i'm against using CREATE TABLE because we are inventing new syntax but it seems like using ALTER TABLE is a *lot* of work altough ISTM more usefull --=20 Atentamente, Jaime Casanova Soporte y capacitaci=F3n de PostgreSQL Asesor=EDa y desarrollo de sistemas Guayaquil - Ecuador Cel. +59387171157