[KLUG Members] mysql and locking reads

Adam Tauno Williams members@kalamazoolinux.org
Wed, 25 Feb 2004 10:04:19 -0500


> Dirk, we chatted last night about your DB's READ and READU queries.
> I think the MySQL equivalent of READU would be the SELECT ... FOR
> UPDATE query.  That will lock the row(s) that are returned for both
> reading and writing, until they are UPDATEd (hopefully quickly
> afterwards).

SELECT ... FOR UPDATE ... is "standard" SQL and should be supported by anything
purporting itself to be a 'real' database.

For PostgreSQL you can read about this -
http://developer.postgresql.org/docs/postgres/sql-select.html#SQL-FOR-UPDATE

> If the rows only need to be locked for writing, there's a slightly
> different command that could do that too.