Re: Feature: triggers on materialized views

From: Mitar <mmitar(at)gmail(dot)com>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: David Fetter <david(at)fetter(dot)org>, pgsql-hackers(at)lists(dot)postgresql(dot)org, Kevin Grittner <kgrittn(at)gmail(dot)com>
Subject: Re: Feature: triggers on materialized views
Date: 2018-12-26 17:07:22
Views: Raw Message | Whole Thread | Download mbox
Lists: pgsql-hackers


On Wed, Dec 26, 2018 at 4:38 AM Alvaro Herrera <alvherre(at)2ndquadrant(dot)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

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.



Attachment Content-Type Size
heapswaptriggers.patch text/x-patch 1.7 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2018-12-26 17:07:36 Re: reducing the footprint of ScanKeyword (was Re: Large writable variables)
Previous Message Alvaro Herrera 2018-12-26 17:00:22 Re: Feature: temporary materialized views