Skip site navigation (1) Skip section navigation (2)

Re: truncate partitioned table locking

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Sriram Dandapani" <sdandapani(at)counterpane(dot)com>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: truncate partitioned table locking
Date: 2006-06-20 01:24:08
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-admin
"Sriram Dandapani" <sdandapani(at)counterpane(dot)com> 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

In response to

pgsql-admin by date

Next:From: Oleg GolovanovDate: 2006-06-20 05:29:53
Subject: Problem DocBook 4.2 detecting at configure time
Previous:From: Aaron BonoDate: 2006-06-19 20:02:48
Subject: Re: truncate partitioned table locking

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group