Re: postgres materialized view refresh performance - Mailing list pgsql-general

From Philip Semanchuk
Subject Re: postgres materialized view refresh performance
Date
Msg-id FE04128F-9905-4917-925B-0BCF6EC70804@americanefficient.com
Whole thread Raw
In response to Re: postgres materialized view refresh performance  (Ravi Krishna <sravikrishna@mail.com>)
Responses Re: postgres materialized view refresh performance
List pgsql-general

> On Oct 23, 2020, at 9:52 AM, Ravi Krishna <sravikrishna@mail.com> wrote:
>
>> My understanding is that when CONCURRENTLY is specified, Postgres implements the refresh as a series of INSERT,
UPDATE,
>> and DELETE statements on the existing view. So the answer to your question is no, Postgres doesn’t create another
tableand 
>> then swap it.
>
> The INSERTS/UPDATE/DELETE happens only for the difference.  PG first creates a new temp table and then compares it
with
> the MV and detects the difference.  That is why for CONCURRENTLY, a unique index is required on the MV.

Yes, thank you, that’s what I understand too but I expressed it very poorly.




pgsql-general by date:

Previous
From: Fabrízio de Royes Mello
Date:
Subject: Re: Conditional column filtering with pglogical replication
Next
From: PALAYRET Jacques
Date:
Subject: Re: Conditional column filtering with pglogical replication