Re: Query Rewrite for Materialized Views (Postgres Extension)

From: Corey Huinker <corey(dot)huinker(at)gmail(dot)com>
To: pavel(dot)stehule(at)gmail(dot)com
Cc: denty(at)qqdd(dot)eu, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Query Rewrite for Materialized Views (Postgres Extension)
Date: 2018-06-18 17:41:42
Message-ID: CADkLM=fGj104pdza=GgenarkSmA+V+P1voeg82mxiT=ZmO+Kww@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>
> Hope it is useful or interesting for someone! Questions or comments are
>> very welcome.
>>
>
> good idea.
>
> Regards
>
> Pavel
>

In a recent PgConf NYC presentation [1] I was talking about the technical
hurdles to implementing materialized views that could be kept up to date at
all times, and the benefits of having such a thing.

Some use cases can be addressed with eventually-consistent derivative table
structures (Vertica's projections, PipelineDB's continuous views, etc), but
those methods rely on the source data never having deletes or updates, or
confining those updates to the "hot" part of the source tables, so it
generally works for time-series data, but not for other cases.

It has occurred to me that Dave Fetter's work on ASSERTIONS [2] has common
underpinnings with true continuous materialized views. In both cases, the
creation of a system object causes the creations of insert/update/delete
triggers on one or more existing tables. In the case of assertions, those
triggers are run with the goal of raising an error if rows are returned
from a query. In the case of a materialized view, those same triggers would
be used to delete rows from a CMV and insert replacements rows.

If we can get always-up-to-date materialized views, then Denty's work on
query rewrite would have greatly enhanced utility.

[1]
https://postgresconf.org/conferences/2018/program/proposals/a-roadmap-to-continuous-materialized-views-b4644661-8d5a-4186-8c17-4fb82600e147
[2]
http://databasedoings.blogspot.com/2018/06/ive-posted-my-slides-for-my-asssertions.html

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2018-06-18 17:43:57 Re: Removing "Included attributes in B-tree indexes" section from docs
Previous Message Claudio Freire 2018-06-18 17:39:14 Re: Making all nbtree entries unique by having heap TIDs participate in comparisons