pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feeddeadlock detection
3+ messages / 3 participants
[nested] [flat]
* deadlock detection
@ 2003-04-08 06:03 SHOBHA HALDONKAR <shobha@phildigital.com>
2003-04-09 04:05 ` Re: deadlock detection Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 3+ messages in thread
From: SHOBHA HALDONKAR @ 2003-04-08 06:03 UTC (permalink / raw)
To: pgsql-admin
HI ,
We are currenlty using postgresql 7.2.1 database. But it does not
seem to detect deadlocks .
Suppose if a record is locked with update command and another
concurrent user tries to lock the same record and the first transaction
for some reason , eg. m/c hangings is not committed both the
transactions remains locked for indefinite period . I have checked the
setting in postgresql.config for deadlock_timeout which is set to 1000
. Than why doesn't the transaction deatect deadlock after 1000
millisecond .
Secondly if the frontend process is killed but due to some reason the
backend postgres process remains , than how can it be terminated .For
if i try to use kill command all the postgres processes gets
terminated .
Please help
--
Regards,
Shobha
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: deadlock detection
2003-04-08 06:03 deadlock detection SHOBHA HALDONKAR <shobha@phildigital.com>
@ 2003-04-09 04:05 ` Tom Lane <tgl@sss.pgh.pa.us>
2003-04-18 18:33 ` Re: deadlock detection Andrew Biagioni <andrew.biagioni@e-greek.net>
0 siblings, 1 reply; 3+ messages in thread
From: Tom Lane @ 2003-04-09 04:05 UTC (permalink / raw)
To: shobha@phildigital.com; +Cc: pgsql-admin
SHOBHA HALDONKAR <shobha@phildigital.com> writes:
> Suppose if a record is locked with update command and another
> concurrent user tries to lock the same record and the first transaction
> for some reason , eg. m/c hangings is not committed both the
> transactions remains locked for indefinite period . I have checked the
> setting in postgresql.config for deadlock_timeout which is set to 1000
> . Than why doesn't the transaction deatect deadlock after 1000
> millisecond .
Waiting for a client that chooses not to commit is not a deadlock.
regards, tom lane
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: deadlock detection
2003-04-08 06:03 deadlock detection SHOBHA HALDONKAR <shobha@phildigital.com>
2003-04-09 04:05 ` Re: deadlock detection Tom Lane <tgl@sss.pgh.pa.us>
@ 2003-04-18 18:33 ` Andrew Biagioni <andrew.biagioni@e-greek.net>
0 siblings, 0 replies; 3+ messages in thread
From: Andrew Biagioni @ 2003-04-18 18:33 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: shobha@phildigital.com; pgsql-admin
Tom Lane wrote:
>SHOBHA HALDONKAR <shobha@phildigital.com> writes:
>
>
>> Suppose if a record is locked with update command and another
>>concurrent user tries to lock the same record and the first transaction
>>for some reason , eg. m/c hangings is not committed both the
>>transactions remains locked for indefinite period . I have checked the
>>setting in postgresql.config for deadlock_timeout which is set to 1000
>>. Than why doesn't the transaction deatect deadlock after 1000
>>millisecond .
>>
>>
>
>Waiting for a client that chooses not to commit is not a deadlock.
>
> regards, tom lane
>
I used to be unclear on some of this, so I think I understand your
confusion. This is how it works:
The database assumes that you know what you are doing; if a transaction
is not committed or rolled back, the lock remains (in 7.3 you can have
transactions time out as well).
If a connection drops, and you CANNOT terminate the transaction, the DB
terminates it for you (ROLLBACK).
Anywhere you have to wait for user interaction to complete an operation,
AND you did a write before you started waiting for the user, you need ot
find a way to break up the operation into two transactions, otherwise
you WILL lock the DB (if the user goes to the restroom, or to lunch, or
their keyboard breaks, ...).
My approach is usually to store in the front end or middle layer
anything I need to write, and actually write to the DB after the user
interaction is complete (with no delays between start and end of
transaction).
Another approach is to set up the DB so that you can do your writes in
multiple transactions without compromising data validity, although some
times you need to run a clean-up every now and then to purge those
operations that never completed.
Beyond that... Get creative ! :-)
Andrew
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2003-04-18 18:33 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-04-08 06:03 deadlock detection SHOBHA HALDONKAR <shobha@phildigital.com>
2003-04-09 04:05 ` Tom Lane <tgl@sss.pgh.pa.us>
2003-04-18 18:33 ` Andrew Biagioni <andrew.biagioni@e-greek.net>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox