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

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 (view raw or flat)
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

pgsql-general by date

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

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