Re: DELETE versus TRUNCATE during pg_dump....

From: Christopher Browne <cbbrowne(at)ca(dot)afilias(dot)info>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: DELETE versus TRUNCATE during pg_dump....
Date: 2004-12-21 20:46:24
Message-ID: 60is6vbcrj.fsf@dba2.int.libertyrms.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

pathat(at)comcast(dot)net (Patrick Hatcher) writes:
> Curious: Why would a DELETE FROM tablename work while a pg_dump is
> occurring but a TRUNCATE tablename will stay in a lock state until the
> pg_dump is complete?

DELETE FROM merely has to mark all the tuples as dead, which requires
no control over the table as a whole.

TRUNCATE essentially reinitializes the table as empty, which does need
a (if brief) lock on the table.

Yeah, you can't TRUNCATE while the dump is running...
--
"cbbrowne","@","ca.afilias.info"
<http://dev6.int.libertyrms.com/>
Christopher Browne
(416) 673-4124 (land)

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Vladimir S. Petukhov 2004-12-21 20:47:31 Re: Need help to organize database
Previous Message Greg Stark 2004-12-21 20:42:22 Re: Scheduler in Postgres