2 13.7. Locking and Indexes #
4 Though PostgreSQL provides nonblocking read/write access to table data,
5 nonblocking read/write access is not currently offered for every index
6 access method implemented in PostgreSQL. The various index types are
9 B-tree, GiST and SP-GiST indexes
10 Short-term share/exclusive page-level locks are used for
11 read/write access. Locks are released immediately after each
12 index row is fetched or inserted. These index types provide the
13 highest concurrency without deadlock conditions.
16 Share/exclusive hash-bucket-level locks are used for read/write
17 access. Locks are released after the whole bucket is processed.
18 Bucket-level locks provide better concurrency than index-level
19 ones, but deadlock is possible since the locks are held longer
20 than one index operation.
23 Short-term share/exclusive page-level locks are used for
24 read/write access. Locks are released immediately after each
25 index row is fetched or inserted. But note that insertion of a
26 GIN-indexed value usually produces several index key insertions
27 per row, so GIN might do substantial work for a single value's
30 Currently, B-tree indexes offer the best performance for concurrent
31 applications; since they also have more features than hash indexes,
32 they are the recommended index type for concurrent applications that
33 need to index scalar data. When dealing with non-scalar data, B-trees
34 are not useful, and GiST, SP-GiST or GIN indexes should be used