Re: DELETE versus TRUNCATE during pg_dump....

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

Hey there Tom thanks for the answer.

However, as you saw I wrote this early in the morning and forgot an
important piece of information:
The table at the time of the truncate was not being dumped. I could see
in pg_stat_activity that it was chugging away at one of the 63M row
tables I have.

Does this make a difference?

Tom Lane wrote:

>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

Browse pgsql-general by date

  From Date Subject
Next Message Marc G. Fournier 2004-12-22 03:37:20 PostgreSQL 8.0.0 Release Candidate 2
Previous Message Bruno Wolff III 2004-12-22 03:27:47 Re: Need help to organize database