PHP Manual

PEAR Manual

Smarty Manual

PostgreSQL

MySQL Manual

Perl Manual

12.5. locking and indexes

though postgresql provides nonblocking read/write access to table data, nonblocking read/write access is not currently offered for every index access method implemented in postgresql. the various index types are handled as follows:

b-tree and gist indexes

short-term share/exclusive page-level locks are used for read/write access. locks are released immediately after each index row is fetched or inserted. these index types provide the highest concurrency without deadlock conditions.

hash indexes

share/exclusive hash-bucket-level locks are used for read/write access. locks are released after the whole bucket is processed. bucket-level locks provide better concurrency than index-level ones, but deadlock is possible since the locks are held longer than one index operation.

currently, b-tree indexes offer the best performance for concurrent applications; since they also have more features than hash indexes, they are the recommended index type for concurrent applications that need to index scalar data. when dealing with non-scalar data, b-trees are not useful, and gist indexes should be used instead.