Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1ZSBg5-0001s4-7G for pgsql-hackers@arkaria.postgresql.org; Wed, 19 Aug 2015 22:17:49 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1ZSBg4-0007WB-PL for pgsql-hackers@arkaria.postgresql.org; Wed, 19 Aug 2015 22:17:48 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1ZSBem-00063A-VC for pgsql-hackers@postgresql.org; Wed, 19 Aug 2015 22:16:29 +0000 Received: from mx-out.zmailcloud.com ([192.198.85.98] helo=mx-out-1.zmailcloud.com) by makus.postgresql.org with esmtp (Exim 4.84) (envelope-from ) id 1ZSBek-0001mk-DZ for pgsql-hackers@postgresql.org; Wed, 19 Aug 2015 22:16:27 +0000 Received: from smtp.01.com (smtp.01.com [10.10.0.43]) by mx-out-1.zmailcloud.com (Postfix) with ESMTP id 443E25651AF; Wed, 19 Aug 2015 17:16:25 -0500 (CDT) Received: from localhost (localhost [127.0.0.1]) by smtp-out-2.01.com (Postfix) with ESMTP id 385EC602E7; Wed, 19 Aug 2015 17:16:25 -0500 (CDT) X-Virus-Scanned: amavisd-new at smtp-out-2.01.com Received: from smtp.01.com ([127.0.0.1]) by localhost (smtp-out-2.01.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id fucQ6GHrDi8j; Wed, 19 Aug 2015 17:16:25 -0500 (CDT) Received: from smtp.01.com (localhost [127.0.0.1]) by smtp-out-2.01.com (Postfix) with ESMTP id 134C0602E6; Wed, 19 Aug 2015 17:16:25 -0500 (CDT) Received: from localhost (localhost [127.0.0.1]) by smtp-out-2.01.com (Postfix) with ESMTP id EF87E602E7; Wed, 19 Aug 2015 17:16:24 -0500 (CDT) X-Virus-Scanned: amavisd-new at smtp-out-2.01.com Received: from smtp.01.com ([127.0.0.1]) by localhost (smtp-out-2.01.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id EEDnA4hTAygx; Wed, 19 Aug 2015 17:16:24 -0500 (CDT) Received: from [172.47.23.104] (50-0-190-244.dsl.dynamic.fusionbroadband.com [50.0.190.244]) by smtp-out-2.01.com (Postfix) with ESMTPSA id 52935602E6; Wed, 19 Aug 2015 17:16:24 -0500 (CDT) Message-ID: <55D50034.1050700@agliodbs.com> Date: Wed, 19 Aug 2015 15:16:20 -0700 From: Josh Berkus Organization: PostgreSQL Experts Inc. User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.8.0 MIME-Version: 1.0 To: Thom Brown CC: Simon Riggs , Amit Langote , Pg Hackers Subject: Re: Declarative partitioning References: <55D3093C.5010800@lab.ntt.co.jp> <55D36BFA.7080004@agliodbs.com> <55D4E2D0.3010906@agliodbs.com> In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On 08/19/2015 01:18 PM, Thom Brown wrote: > On 19 August 2015 at 21:10, Josh Berkus > wrote: > > On 08/19/2015 04:59 AM, Simon Riggs wrote: > > I like the idea of a regular partitioning step because it is how you > > design such tables - "lets use monthly partitions". > > > > This gives sanely terse syntax, rather than specifying pages and pages > > of exact values in DDL.... > > > > PARTITION BY RANGE ON (columns) INCREMENT BY (INTERVAL '1 month' ) > > START WITH value; > > Oh, I like that syntax! > > How would it work if there were multiple columns? Maybe we don't want > to allow that for this form? > > > If we went with that, and had: > > CREATE TABLE orders (order_id serial, order_date date, item text) > PARTITION BY RANGE ON (order_date) INCREMENT BY (INTERVAL '1 month') > START WITH '2015-01-01'; > > Where would the following go? > > INSERT INTO orders (order_date, item) VALUES ('2014-11-12', 'Old item'); > > Would there automatically be an "others" partition? Or would it produce > an error and act like a constraint? The "others" partition was brought up upthread, as an addition to the original proposal. I really think that an "others" partition needs to be up to the DBA; I've seen apps where they'd want to capture it, and apps where they'd want such an insert to error. I, for one, would be OK with a new partitioning which didn't address the "others" partition issue until 9.7; I see it as a wholly separable improvement. Plus, you can always *manually* add high/low catchall partitions. -- Josh Berkus PostgreSQL Experts Inc. http://pgexperts.com -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers