Re: confused about material view locks please explain

Поиск
Список
Период
Сортировка
От Peter J. Holzer
Тема Re: confused about material view locks please explain
Дата
Msg-id 20240705154035.qjoey3eaqaqitthn@hjp.at
обсуждение исходный текст
Ответ на confused about material view locks please explain  (Krishnakant Mane <kkproghub@gmail.com>)
Ответы Re: confused about material view locks please explain
Список pgsql-general
On 2024-07-05 18:58:21 +0530, Krishnakant Mane wrote:
> I have decided to use materialised views (more precisely IVM ).
[...]
> Given this setup I have a very specific questionh.
>
> if client 1 has asked for his balance sheet and the view is being queried,
> then what will happen if client 2 happens to create an invoice concurrently?
>
> Will the invoice creation (and subsequent voucher table and view update )
> wait for client 1 to complete the select query, or will the select query
> halt till the update happen?

If I understand https://github.com/sraoss/pg_ivm correctly, the
materialized view will be updated within the same transaction. So it's
just the same as any other change in the database:

Neither client will wait for the other. The first client will see either
the old or the new state depending on whether the second client manages
to commit soon enough.

        hp

--
   _  | Peter J. Holzer    | Story must make more sense than reality.
|_|_) |                    |
| |   | hjp@hjp.at         |    -- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |       challenge!"

Вложения

В списке pgsql-general по дате отправления:

Предыдущее
От: Matt Hughes
Дата:
Сообщение: Planning of sub partitions
Следующее
От: Matt Hughes
Дата:
Сообщение: Re: Planning of sub partitions