Re: SI-read predicate locks on materialized views - Mailing list pgsql-hackers

From Richard Guo
Subject Re: SI-read predicate locks on materialized views
Date
Msg-id CAMbWs4_1HiFAkOdmUZv=6cs2NpYAKv6ud1hW6jS6CCXjgVMpNw@mail.gmail.com
Whole thread Raw
In response to SI-read predicate locks on materialized views  (Yugo NAGATA <nagata@sraoss.co.jp>)
Responses Re: SI-read predicate locks on materialized views
List pgsql-hackers

On Tue, Jul 26, 2022 at 3:44 PM Yugo NAGATA <nagata@sraoss.co.jp> wrote:
If such two transactions run concurrently, a write skew anomaly occurs,
and the result of order_summary refreshed in T1 will not contain the
record inserted in T2.

Indeed we have write skew anomaly here between the two transactions.
 
On the other hand, if the materialized view participates in predicate
locking and the transaction isolation level is SELIALIZABLE, this
anomaly can be avoided; one of the transaction will be aborted and
suggested to be retried.

The idea works for me.

Thanks
Richard 

pgsql-hackers by date:

Previous
From: Peter Smith
Date:
Subject: Re: Perform streaming logical transactions by background workers and parallel apply
Next
From: Dilip Kumar
Date:
Subject: Re: Max compact as an FSM strategy