X-Original-To: pgsql-admin-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 65B1D9F9F2D for ; Mon, 19 Jun 2006 22:24:16 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 29659-01 for ; Mon, 19 Jun 2006 22:24:12 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id E1DF29F9316 for ; Mon, 19 Jun 2006 22:24:11 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k5K1O87u023092; Mon, 19 Jun 2006 21:24:09 -0400 (EDT) To: "Sriram Dandapani" cc: pgsql-admin@postgresql.org Subject: Re: truncate partitioned table locking In-reply-to: <6992E470F12A444BB787B5C937B9D4DF04C4CDFB@ca-mail1.cis.local> References: <6992E470F12A444BB787B5C937B9D4DF04C4CDFB@ca-mail1.cis.local> Comments: In-reply-to "Sriram Dandapani" message dated "Mon, 19 Jun 2006 11:41:05 -0700" Date: Mon, 19 Jun 2006 21:24:08 -0400 Message-ID: <23091.1150766648@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200606/153 X-Sequence-Number: 22115 "Sriram Dandapani" writes: > How can I issue a truncate /drop table on the child without running into > locking issues. Doesn't constraint exclusion prevent access of a child > table based on the check constraint criteria No, because the planner has to access the child table in order to examine its constraints. (Since TRUNCATE is a metadata update, the fact that the constraints are metadata not content doesn't help.) TRUNCATE in itself is fast enough that you shouldn't really have any problems here. If you are having locking issues then I suspect you need to look for transactions that are sitting on ordinary reader or writer locks of the table, instead of doing their jobs and committing. regards, tom lane