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
Message-ID: CAKLmikPoVqXtCU+r5-u+Hfskszr6Yft8Ou8zMo-2k-tqWDuE_w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi!

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
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 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