Re: counting algorithm for incremental matview maintenance - Mailing list pgsql-hackers

From Amit Kapila
Subject Re: counting algorithm for incremental matview maintenance
Date
Msg-id 008601ce52f7$00bd0370$02370a50$@kapila@huawei.com
Whole thread Raw
In response to Re: counting algorithm for incremental matview maintenance  (Kevin Grittner <kgrittn@ymail.com>)
Responses Re: counting algorithm for incremental matview maintenance  (Kevin Grittner <kgrittn@ymail.com>)
List pgsql-hackers
On Thursday, May 16, 2013 7:02 PM Kevin Grittner wrote:
Josh Berkus <josh@agliodbs.com> wrote:

> Let's say there is a table and matview like this:

> create table foo (fooid int primary key, val int not null);
> create materialized view bar as select distinct val from foo;

> Let's say there are millions of rows in both, and that we have
> flagged the view for incremental maintenance.  (Syntax omitted to
> avoid distracting bikeshedding on that when the point is the
> algorithm.)

> Now, someone runs this:

> update foo set val = val + 1 where fooid between 1 and 10;

> What will happen is this:

> Since foo will be flagged as a relation which is referenced by an
> incrementally maintained matview, a delta relation will be
> materialized for this update, which will contain the net change to
> the underlying table in the count_t system column. 

How and when will it clear old rows of delta relation especially when there
are more than one matview is defined on table and how will it maintain from
where to start
second time refresh from this delta relation to matview.


With Regards,
Amit Kapila.




pgsql-hackers by date:

Previous
From: Amit Kapila
Date:
Subject: Re: counting algorithm for incremental matview maintenance
Next
From: Merlin Moncure
Date:
Subject: Re: fallocate / posix_fallocate for new WAL file creation (etc...)