Re: Feature: triggers on materialized views - Mailing list pgsql-hackers

From Mitar
Subject Re: Feature: triggers on materialized views
Date
Msg-id CAKLmikPoVqXtCU+r5-u+Hfskszr6Yft8Ou8zMo-2k-tqWDuE_w@mail.gmail.com
Whole thread Raw
In response to Re: Feature: triggers on materialized views  (Alvaro Herrera <alvherre@2ndquadrant.com>)
List pgsql-hackers
Hi!

On Wed, Dec 26, 2018 at 4:38 AM Alvaro Herrera <alvherre@2ndquadrant.com> wrote:
> Sounds like you could do this by fixing concurrent refresh to also work
> when the MV is WITH NO DATA.

Yes, I do not think this would be too hard to fix. I could do this nevertheless.

> > Ah, yes. I could just do TRUNCATE and INSERT, instead of heap swap.
> > That would then generate reasonable trigger calls.
>
> Right.

I have tested this yesterday and performance is 2x worse that heap
swap on the benchmark I made. So I do not think this is a viable
approach.

I am now looking into simply triggering TRUNCATE and INSERT triggers
after heap swap simulating the above. I made AFTER STATEMENT triggers
and it looks like it is working, only NEW table is not populated for
some reason. Any suggestions? See attached patch.


Mitar

-- 
http://mitar.tnode.com/
https://twitter.com/mitar_m

Attachment

pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: Feature: temporary materialized views
Next
From: Tom Lane
Date:
Subject: Re: reducing the footprint of ScanKeyword (was Re: Large writable variables)