Lists: | pgsql-hackers |
---|
From: | "Marc G(dot) Fournier" <scrappy(at)postgresql(dot)org> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Subject: | pg_dump locks a table on dumping ... ? |
Date: | 2004-03-23 16:20:24 |
Message-ID: | 20040323121850.Q3456@ganymede.hub.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
'k, just had someone tell me that they believed that a pg_dump will lock a
table while the dump is happening ... my first thought/response was that
this would defeat the point of MVCC, no? And would make for a terrible
backup procedure on a very large database, since you'd just have made your
database useless for the duration ...
Can someone confirm/deny that the lock happens?
----
Marc G. Fournier Hub.Org Networking Services (http://www.hub.org)
Email: scrappy(at)hub(dot)org Yahoo!: yscrappy ICQ: 7615664
From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | "Marc G(dot) Fournier" <scrappy(at)postgresql(dot)org> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: pg_dump locks a table on dumping ... ? |
Date: | 2004-03-23 17:02:40 |
Message-ID: | 21464.1080061360@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
"Marc G. Fournier" <scrappy(at)postgresql(dot)org> writes:
> 'k, just had someone tell me that they believed that a pg_dump will lock a
> table while the dump is happening ... my first thought/response was that
> this would defeat the point of MVCC, no? And would make for a terrible
> backup procedure on a very large database, since you'd just have made your
> database useless for the duration ...
> Can someone confirm/deny that the lock happens?
pg_dump takes a reader's lock (AccessShareLock). This does not prevent
reads or writes of the table. It does prevent dropping the table,
making schema alterations to it (such as column add/drop), or anything
else that wants an exclusive lock. I think that VACUUM FULL is the only
thing particularly likely to cause a conflict in a running database.
regards, tom lane
From: | "Marc G(dot) Fournier" <scrappy(at)postgresql(dot)org> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: pg_dump locks a table on dumping ... ? |
Date: | 2004-03-24 02:57:14 |
Message-ID: | 20040323225653.S3456@ganymede.hub.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Tue, 23 Mar 2004, Tom Lane wrote:
> "Marc G. Fournier" <scrappy(at)postgresql(dot)org> writes:
> > 'k, just had someone tell me that they believed that a pg_dump will lock a
> > table while the dump is happening ... my first thought/response was that
> > this would defeat the point of MVCC, no? And would make for a terrible
> > backup procedure on a very large database, since you'd just have made your
> > database useless for the duration ...
>
> > Can someone confirm/deny that the lock happens?
>
> pg_dump takes a reader's lock (AccessShareLock). This does not prevent
> reads or writes of the table. It does prevent dropping the table,
> making schema alterations to it (such as column add/drop), or anything
> else that wants an exclusive lock. I think that VACUUM FULL is the only
> thing particularly likely to cause a conflict in a running database.
Perfect, that makes sense ... thanks :)
----
Marc G. Fournier Hub.Org Networking Services (http://www.hub.org)
Email: scrappy(at)hub(dot)org Yahoo!: yscrappy ICQ: 7615664