Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1ZSPkM-0001mP-9F for pgsql-hackers@arkaria.postgresql.org; Thu, 20 Aug 2015 13:19:10 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1ZSPkL-0006hR-IY for pgsql-hackers@arkaria.postgresql.org; Thu, 20 Aug 2015 13:19:09 +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 1ZSPkK-0006hK-Rj for pgsql-hackers@postgresql.org; Thu, 20 Aug 2015 13:19:08 +0000 Received: from 173-164-140-181-sfba.hfc.comcastbusiness.net ([173.164.140.181] helo=fetter.org) by makus.postgresql.org with esmtp (Exim 4.84) (envelope-from ) id 1ZSPkH-00023V-4c for pgsql-hackers@postgresql.org; Thu, 20 Aug 2015 13:19:07 +0000 Received: by fetter.org (Postfix, from userid 500) id 8F0C76473E; Thu, 20 Aug 2015 06:19:02 -0700 (PDT) Date: Thu, 20 Aug 2015 06:19:02 -0700 From: David Fetter To: Amit Langote Cc: Pg Hackers Subject: Re: Declarative partitioning Message-ID: <20150820131902.GB8691@fetter.org> References: <55D3093C.5010800@lab.ntt.co.jp> <20150818134323.GC18054@fetter.org> <55D4309F.8030601@lab.ntt.co.jp> <20150819125239.GE11258@fetter.org> <55D5A4C0.4040900@lab.ntt.co.jp> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <55D5A4C0.4040900@lab.ntt.co.jp> User-Agent: Mutt/1.5.23 (2014-03-12) X-Pg-Spam-Score: -0.9 (/) 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 Thu, Aug 20, 2015 at 06:58:24PM +0900, Amit Langote wrote: > On 2015-08-19 PM 09:52, David Fetter wrote: > > On Wed, Aug 19, 2015 at 04:30:39PM +0900, Amit Langote wrote: > > > > There are use cases where we need to warn people that their assertions > > need to be true, and if those assertions are not true, this will > > explode, leaving them to pick the resulting shrapnel out of their > > faces. There are other parts of the system where this is true, as > > when people write UDFs in C. > > > > As I understand it, NOT VALID means, "I assert that the tuples already > > here fit the constraint. Any changes will be checked against the > > constraint." > > > > I've seen cases where a gigantic amount of data is coming out of some > > distributed system which holds the constraint as an invariant. This > > let a DBA decide to add a NOT VALID constraint in order not to take > > the hit of a second full scan of the data, which might have made the > > import, and possibly the entire project, untenable. > > Ah, I understand the point of parameterization (TRUST). Seems like it > would be good to have with appropriate documentation of the same. Perhaps, > it might as well a parameter to the step 1 itself. So TRUST would obviate step 2? Better still! > >>>> 5. Detach partition > >>>> > >>>> ALTER TABLE partitioned_table > >>>> DETACH PARTITION partition_name [USING table_name] > >>>> > >>>> This removes partition_name as partition of partitioned_table. > >>>> The table continues to exist with the same name or 'table_name', > >>>> if specified. pg_class.relispartition is set to false for the > >>>> table, so it behaves like a normal table. > >>> > >>> Could this take anything short of an access exclusive lock on the > >>> parent? > >> > >> Yes, both the step 1 of ATTACH command and DETACH command take > >> access exclusive lock on the parent. They are rather quick metadata > >> changes, so should not stall others significantly, I think. > > > > So no. Weakening required locks has been something of an ongoing > > project, project-wide, and need not be part of the first cut of this > > long-needed feature. > > > > Do you mean ATTACH and DETACH, if they require access exclusive lock on > the parent, should not be in the first cut? Or am I misreading? Sorry I was unclear. ATTACH and DETACH should be in the first cut even if they require an access exclusive lock. Cheers, David. -- David Fetter http://fetter.org/ Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter Skype: davidfetter XMPP: david.fetter@gmail.com Remember to vote! Consider donating to Postgres: http://www.postgresql.org/about/donate -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers