June 2002
Intermediate to advanced
800 pages
16h 3m
English
If you are writing software for a frequently used Web server, you'll need to take a closer look at locking. Usually locking is done by PostgreSQL internally. However, it is possible to influence locking explicitly. In many situations this is necessary, and it can help you to get around problems easily.
The most important thing when working with explicit locking is to see how concurrent PHP scripts treat locking.
In general, working with locks is easy. Everything can be done using just one command:
phpbook=# \h LOCK Command: LOCK Description: explicitly lock a table Syntax: LOCK [ TABLE ] name [, ...] LOCK [ TABLE ] name [, ...] IN lockmode MODE where lockmode is one of: ACCESS SHARE | ROW SHARE | ROW EXCLUSIVE | SHARE UPDATE EXCLUSIVE ...
Read now
Unlock full access