Re: Insert waiting for update?

From: "Albe Laurenz" <laurenz(dot)albe(at)wien(dot)gv(dot)at>
To: <ashish_postgre(at)yahoo(dot)co(dot)in>, "pggeneral" <pgsql-general(at)postgresql(dot)org>
Cc: <ashish(dot)karalkar(at)netcore(dot)co(dot)in>
Subject: Re: Insert waiting for update?
Date: 2008-01-09 15:23:50
Message-ID: D960CB61B694CF459DCFB4B0128514C2C4D81B@exadv11.host.magwien.gv.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Ashish Karalkar wrote:
> I am having table with 4M rows.
> I am trying to update all these rows with statement
>
> update mytable set mycolumn=0;
>
> At the same time there are insert happening on the table.
> but all these insert are in waiting mode.
> does update is locking the table for insert?
>
> does insert and update confilict with each other?

Not normally, but it can happen.

You could

SELECT l.locktype, t.relname, l.pid, l.transactionid, l.mode, l.granted
FROM pg_catalog.pg_locks l LEFT OUTER JOIN
pg_catalog.pg_class t ON l.relation = t.oid;

and

SELECT procpid, current_query FROM pg_stat_activity;

while the inserts hang. Maybe the result will indicate why.

Are there any triggers or rules defined?
What indexes are defined on the table?

Yours,
Laurenz Albe

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alvaro Herrera 2008-01-09 15:27:50 Re: quick question abt pg_dump and restore
Previous Message Josh Harrison 2008-01-09 15:17:26 Re: quick question abt pg_dump and restore