select open change scope Open full search

PG.CENTER connects PostgreSQL documentation, reference, and ecosystem knowledge. Maintained by Pigsty.

Unsupported versions: 7.1
Historical version. PostgreSQL 7.1 reached end of support in April 2006. See the current manual for supported releases.

9.7. Locking and Indices

Though Postgres provides nonblocking read/write access to table data, nonblocking read/write access is not currently offered for every index access method implemented in Postgres.

The various index types are handled as follows:

GiST and R-Tree indices

Share/exclusive index-level locks are used for read/write access. Locks are released after statement is done.

Hash indices

Share/exclusive page-level locks are used for read/write access. Locks are released after page is processed.

Page-level locks provide better concurrency than index-level ones but are subject to deadlocks.

Btree indices

Short-term share/exclusive page-level locks are used for read/write access. Locks are released immediately after each index tuple is fetched/inserted.

Btree indices provide the highest concurrency without deadlock conditions.

In short, btree indices are the recommended index type for concurrent applications.

Report a documentation issue

Read the upstream documentation. For corrections, first check the current manual.