pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedWhich SQL command creates ExclusiveLock?
2+ messages / 2 participants
[nested] [flat]
* Which SQL command creates ExclusiveLock?
@ 2004-04-21 14:58 Denis Khabas <dkhabas@bluecatnetworks.com>
0 siblings, 1 reply; 2+ messages in thread
From: Denis Khabas @ 2004-04-21 14:58 UTC (permalink / raw)
To: pgsql-sql
Hi everyone!
I have a web application that uses Postgresql on backend. The application performs selects, updates, inserts, and deletes by using Hibernate. Tables
contain indexed fields. When I run the following query, SELECT * FROM pg_locks, it shows that some transactions place
ExclusiveLock:
relation | database | transaction | pid | mode | granted
----------+----------+-------------+-------+-----------------+---------
16757 | 16976 | | 22770 | AccessShareLock | t
| | 17965163 | 22770 | ExclusiveLock | t
According to postgres documentation, all update operations place ROW EXCLUSIVE MODE locks, and
EXCLUSIVE MODE is not automatically acquired by any postgres SQL command. So, which command places
ExclusiveLock??? I suspect that indexes can account for this behaviour, but couldn't find anything in the docs.
I am also wondering why there is nothing shown in "relation" column. I think it is supposed to display a table or index id or any other
object that is being locked.
Thanks for help!
Dennis
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Which SQL command creates ExclusiveLock?
@ 2004-04-28 04:16 Tom Lane <tgl@sss.pgh.pa.us>
parent: Denis Khabas <dkhabas@bluecatnetworks.com>
0 siblings, 0 replies; 2+ messages in thread
From: Tom Lane @ 2004-04-28 04:16 UTC (permalink / raw)
To: Denis Khabas <dkhabas@bluecatnetworks.com>; +Cc: pgsql-sql
"Denis Khabas" <dkhabas@bluecatnetworks.com> writes:
> According to postgres documentation, all update operations place ROW EXCLUS=
> IVE MODE locks, and=20
> EXCLUSIVE MODE is not automatically acquired by any postgres SQL command. S=
> o, which command places
> ExclusiveLock?
It says that no SQL command acquires ExclusiveLock *on a table*. The
pg_locks row you show represents ExclusiveLock on a transaction number.
Every transaction gets ExclusiveLock on its transaction number for the
duration of its existence.
regards, tom lane
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2004-04-28 04:16 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-04-21 14:58 Which SQL command creates ExclusiveLock? Denis Khabas <dkhabas@bluecatnetworks.com>
2004-04-28 04:16 ` Tom Lane <tgl@sss.pgh.pa.us>
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