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

Re: insert waiting

From: Ulrich Wisser <ulrich(dot)wisser(at)relevanttraffic(dot)se>
To: John Sidney-Woollett <johnsw(at)wardbrook(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: insert waiting
Date: 2004-08-20 11:20:49
Message-ID: 4125DE91.9030909@relevanttraffic.se (view raw or flat)
Thread:
Lists: pgsql-general
Hi John,

but how long is the exclusive lock taken? For the whole transaction?
My jobs are quite big, and transactions usually take several minutes.
I can not afford have all my other jobs stalled for that time.

Ulrich

> I believe foreign key constraints take an exclusive lock on the parent. 
> If you are inserting two child records that reference the same parent 
> (at the same time) one insert will block.
> 
> John Sidney-Woollett
> 
> Ulrich Wisser wrote:
> 
>> Hi,
>>
>> after some more debugging I found that my application does on average 
>> 3 inserts per second. Which is not very fast, but fast enough for now. 
>> But now and then the whole insert proces will be stalled and drop to 
>> 0.1 inserts per second. In the output of "ps aux Op" I see postgres in 
>> the state "INSERT WAITING".
>>
>> I have some other insert/update process running, but not on the same 
>> table. I am absolutely sure, that my insert process is the only one 
>> working on that table.
>>
>> Can foreign keys block inserts?
>>
>> TIA
>>
>> Ulrich
>>
>>
>> ---------------------------(end of broadcast)---------------------------
>> TIP 4: Don't 'kill -9' the postmaster



In response to

Responses

pgsql-general by date

Next:From: Jeff AmielDate: 2004-08-20 12:23:43
Subject: Re: int8, primary key, seq scan
Previous:From: Gaetano MendolaDate: 2004-08-20 11:15:47
Subject: Re: Help with optimizing query

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