Re: Too coarse predicate locks granularity for B+ tree indexes - Mailing list pgsql-general

From Laurenz Albe
Subject Re: Too coarse predicate locks granularity for B+ tree indexes
Date
Msg-id f5ddc5fc7ef9fc3a8469bc7e0ee68e89ea8f1e2a.camel@cybertec.at
Whole thread Raw
Responses Re: Too coarse predicate locks granularity for B+ tree indexes
List pgsql-general
On Tue, 2023-02-07 at 16:23 +0600, Rinat Shigapov wrote:
> I have a concurrent testsuite that runs 14 test cases. Each test case operates
> on a disjoint set of records, doesn't retry transactions and is run under
> 'serializable' isolation level. The test data is small and likely fits within
> a single tuple page.
>
> When I finished the test suite I was surprised that PostgreSQL 14.5 returns
> serialization failure on every test suite run.

This is no question for the hackers list; redirecting to general.

That behavior sounds perfectly normal to me: if everything is in a single
page, PostgreSQL probably won't use an index scan.  With a sequential scan,
the predicate lock will be on the whole table.  So you should expect
serialization failures.  This is well documented.

Perhaps you should use a more realistic test case with a reasonable
amount of data.

Yours,
Laurenz Albe



pgsql-general by date:

Previous
From: Rahila Syed
Date:
Subject: Re: Logical Replication - "invalid ordering of speculative insertion changes"
Next
From: Sebastien Flaesch
Date:
Subject: Re: Get the sequence name corresponding to a GENERATED { ALWAYS | BY DEFAULT } AS IDENTITY column