Re: UPDATE stalls when run in "batch mode"

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Kynn Jones" <kynnjo(at)gmail(dot)com>
Cc: "pgsql-general General" <pgsql-general(at)postgresql(dot)org>
Subject: Re: UPDATE stalls when run in "batch mode"
Date: 2008-03-16 21:27:47
Message-ID: 4839.1205702867@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Kynn Jones" <kynnjo(at)gmail(dot)com> writes:
> I can't begin to guess why the update statement above caused the processing
> to stall, but ran quickly when I executed it by itself. How can I
> understand this situation better?

Perhaps it was blocked on a lock rather than actually doing anything.
Did you look into pg_locks, or use top or vmstat or similar tool to see
if any work was getting done?

Another likely theory is that the script case was using a bad plan
for lack of up-to-date statistics. Putting an EXPLAIN into the script
and comparing it with the manual case would tell the tale.

What's causing the difference is not clear, though if you have
autovacuum enabled that might explain a problem of the second kind
(autovac might've updated the statistics before you tried the command
manually).

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Bob Pawley 2008-03-16 22:32:27 Updating
Previous Message Robert Treat 2008-03-16 21:12:15 Re: Trigger to run @ connection time?