Unix Technical Forum

pg_dump and write locks

This is a discussion on pg_dump and write locks within the Pgsql General forums, part of the PostgreSQL category; --> We have an issue with running pg_dump while a database is under reasonably heavy update load. This is 7.4.5 ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > Pgsql General

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-09-2008, 05:01 AM
David Parker
 
Posts: n/a
Default pg_dump and write locks

We have an issue with running pg_dump while a database is under
reasonably heavy update load. This is 7.4.5 on Solaris 9/intel.

The observed behavior was that a pg_dump running with nothing else going
on takes a couple of minutes, but when we are running some system tests
that do heavy updates to a selection of application tables, it appears
that pg_dump blocks until the update run is done. This didn't make sense
because everything I can find about pg_dump indicates that it should
only be taking read locks, so I don't see why it should be blocked.

We looked at pg_locks, and saw that the pg_dump process was acquiring
locks like:

14764 | ExclusiveLock | 124576072 | COPY public.stats (id,
description, lastsavedate, lastsaveuser) TO stdout;

(we are using pg_dump with -Fc) If COPY is taking a ROW EXCLUSIVE lock,
then that would explain why we are seeing contention, but I don't
understand why COPY is locking at that level. Is there a better way to
run pg_dump against a database with a lot of update activity?

Thanks.

- DAP
================================================== ====
David Parker Tazz Networks


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-09-2008, 05:01 AM
Tom Lane
 
Posts: n/a
Default Re: pg_dump and write locks

"David Parker" <dparker@tazznetworks.com> writes:
> The observed behavior was that a pg_dump running with nothing else going
> on takes a couple of minutes, but when we are running some system tests
> that do heavy updates to a selection of application tables, it appears
> that pg_dump blocks until the update run is done.


Are you sure the other processes aren't taking any exclusive locks?
Are you sure your system isn't saturated to the point where pg_dump
just can't make progress very fast?

> We looked at pg_locks, and saw that the pg_dump process was acquiring
> locks like:
>
> 14764 | ExclusiveLock | 124576072 | COPY public.stats (id,
> description, lastsavedate, lastsaveuser) TO stdout;


It's impossible to tell what you are actually looking at here --- that's
not the raw output of pg_locks, and you've conveniently omitted any
column headers --- but I wonder whether that isn't just the
transaction's standard lock on its own XID.

If pg_dump is actually getting blocked, that will show as a row with
granted = false and pg_dump's PID.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 12:38 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com