From: | greg(at)turnstep(dot)com |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Hard problem with concurrency |
Date: | 2003-02-17 02:54:08 |
Message-ID: | 9ef65642a223696da0751ac72525ad10@biglumber.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Solution one: use sequences for the unique value.
Solution two: use another table to effect the exclusive locking
and use it to store the "unique" values:
begin;
update row;
if (no rows affected) {
lock table foo in exclusive mode;
find a unique value that is not already in foo
store this value inside of foo
insert row;
}
commit;
Solution three: use your strategy two, but throw a loop around it and have
it try again (with a new value) if it gets a unique violation.
- --
Greg Sabino Mullane greg(at)turnstep(dot)com
PGP Key: 0x14964AC8 200302162143
-----BEGIN PGP SIGNATURE-----
Comment: http://www.turnstep.com/pgp.html
iD8DBQE+T0sFvJuQZxSWSsgRAvMbAJwNndfcRb8U+W4TCeSGMGg+j7CqMwCgpfbd
98bDZI1r5AOLv1iCyVTC/AI=
=0Nkm
-----END PGP SIGNATURE-----
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2003-02-17 02:58:54 | Re: Hard problem with concurrency |
Previous Message | Tom Lane | 2003-02-17 02:48:47 | Re: location of the configuration files |