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.
|_|_) |                    |
| |   | h...@hjp.at         |    -- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |       challenge!"

Attachment: signature.asc
Description: PGP signature

Reply via email to