From: | Greg Stark <gsstark(at)mit(dot)edu> |
---|---|
To: | Brendan Duddridge <brendan(at)clickspace(dot)com> |
Cc: | PostgreSQL Performance <pgsql-performance(at)postgresql(dot)org> |
Subject: | Re: App very unresponsive while performing simple update |
Date: | 2006-05-28 13:11:21 |
Message-ID: | 874pzanvk6.fsf@stark.xeocode.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-performance |
Brendan Duddridge <brendan(at)clickspace(dot)com> writes:
> Further to my issue, the update never did finish. I received the following
> message in psql:
>
> ssprod=# update product set is_hungry = 'true' where date_modified >
> current_date - 10;
> ERROR: deadlock detected
> DETAIL: Process 18778 waits for ShareLock on transaction 711698780; blocked
> by process 15784.
> Process 15784 waits for ShareLock on transaction 711697098; blocked by process
> 18778.
What queries are those two processes executing? And what foreign keys do you
have on the product table or elsewhere referring to the product table? And
what indexes do you have on those columns?
I think this indicates you have foreign keys causing the deadlock. One process
is waiting until an update elsewhere finishes before modifying a record that
other update refers to via a foreign key. But that other process is waiting
similarly for the first one.
Do you have any foreign keys in other tables referring to the product table?
Do you have indexes on those other tables? The update needs to check those
other tables to make sure there are no references to the records you're
updating. If there's no index it has to do a sequential scan.
To get a deadlock I think you would need another update running somewhere
though.
--
greg
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2006-05-28 16:04:52 | Re: App very unresponsive while performing simple update |
Previous Message | Cstdenis | 2006-05-28 10:49:06 | Re: How can I make this query faster (resend) |