Re: DELETE versus TRUNCATE during pg_dump....

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Patrick Hatcher <pathat(at)comcast(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: DELETE versus TRUNCATE during pg_dump....
Date: 2004-12-21 15:54:27
Message-ID: 8201.1103644467@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Patrick Hatcher <pathat(at)comcast(dot)net> 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?

TRUNCATE requires an exclusive lock on the table.

This is pretty much a no-free-lunch situation: if you want the pg_dump
to be able to dump all the rows that existed when it started, you can
hardly expect to be able to physically remove those rows meanwhile.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ernest Kim 2004-12-21 17:51:05 Re: BTree max row size?
Previous Message Marc G. Fournier 2004-12-21 15:48:28 Re: RES: RES: NewsForge Poll: Favorite open source database