pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedRe: [SQL] idiom to mv recs => [NEW] bleeding lock?
2+ messages / 2 participants
[nested] [flat]
* Re: [SQL] idiom to mv recs => [NEW] bleeding lock?
@ 1998-10-26 13:18 ` Thomas Good <tomg@nrnet.org>
1 sibling, 0 replies; 2+ messages in thread
From: Thomas Good @ 1998-10-26 13:18 UTC (permalink / raw)
To: pgsql-sql
On Mon, 26 Oct 1998, Jan Wieck wrote:
> Use a transaction and lock the source table first.
>
> BEGIN TRANSACTION;
> LOCK TABLE src_table;
Jan & Herouth,
I've been using this for some time but lately lots of data is going
into the system (hope this means more revenue as well ;-)
My point: when attempting to do a SELECT the table lock blocks even
this activity. Is this a bleeding lock? Shouldn't a simple SELECT
succeed? I dunno...but this is problematic as users are looking for
info while the data entry person is doing her thing...ouch.
Another bit of whining: in my PROGRESS dbs the user gets a NOTICE
when a table is LOCKED and his/her SELECT is on hold:
`tablename is in use by doofus on term/1a11...press CTRL-C or Wait'
Is there a way to implement this with pg?
Cheers,
Tom
----------- Sisters of Charity Medical Center ----------
Department of Psychiatry
----
Thomas Good, System Administrator <tomg@q8.nrnet.org>
North Richmond CMHC/Residential Services Phone: 718-354-5528
75 Vanderbilt Ave, Quarters 8 Fax: 718-354-5056
Staten Island, NY 10304 www.panix.com/~ugd
----
Powered by PostgreSQL 6.3.2 / Perl 5.004 / DBI-0.91::DBD-PG-0.69
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: [SQL] idiom to mv recs => [NEW] bleeding lock?
@ 1998-10-26 14:57 ` Herouth Maoz <herouth@oumail.openu.ac.il>
1 sibling, 0 replies; 2+ messages in thread
From: Herouth Maoz @ 1998-10-26 14:57 UTC (permalink / raw)
To: Thomas Good <tomg@nrnet.org>; pgsql-sql
At 15:18 +0200 on 26/10/98, Thomas Good wrote:
> My point: when attempting to do a SELECT the table lock blocks even
> this activity. Is this a bleeding lock? Shouldn't a simple SELECT
> succeed? I dunno...but this is problematic as users are looking for
> info while the data entry person is doing her thing...ouch.
This lock is an exclusive lock. There is no other kind of lock in Postgres.
One may give up the LOCK at the beginning of the transaction. This would
mean that if a reader came and went before the deletion of the record, it
would succeed, because up to that point the transaction holds a shared lock
on the table. If a writer appeared, then it would fail, because it would
try to change the lock on the table from shared to exclusive, which it
can't do until all readers relinquished their locks.
This, however, creates a possibility that the deletion phase (and the
entire transaction) would fail, because the lock would fail to convert to
exclusive because other readers are still holding it.
Herouth
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~1998-10-26 14:57 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1998-10-26 13:18 ` Thomas Good <tomg@nrnet.org>
1998-10-26 14:57 ` Herouth Maoz <herouth@oumail.openu.ac.il>
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