Re: SI-read predicate locks on materialized views

From: Richard Guo <guofenglinux(at)gmail(dot)com>
To: Yugo NAGATA <nagata(at)sraoss(dot)co(dot)jp>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: SI-read predicate locks on materialized views
Date: 2022-07-26 10:00:57
Message-ID: CAMbWs4_1HiFAkOdmUZv=6cs2NpYAKv6ud1hW6jS6CCXjgVMpNw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Jul 26, 2022 at 3:44 PM Yugo NAGATA <nagata(at)sraoss(dot)co(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dilip Kumar 2022-07-26 10:02:28 Re: Max compact as an FSM strategy
Previous Message Peter Smith 2022-07-26 09:56:07 Re: Perform streaming logical transactions by background workers and parallel apply