Re: Advice on using materialized views - Mailing list pgsql-general

From Wicher
Subject Re: Advice on using materialized views
Date
Msg-id 20211207103251.59354436@tipi
Whole thread Raw
In response to Advice on using materialized views  ("Phil Endecott" <spam_from_pgsql_lists@chezphil.org>)
Responses Re: Advice on using materialized views  ("Phil Endecott" <spam_from_pgsql_lists@chezphil.org>)
List pgsql-general
On Mon, 06 Dec 2021 18:48:47 +0000
"Phil Endecott" <spam_from_pgsql_lists@chezphil.org> wrote:

> and 
> I need to modify the definition of a view that filters the "new" 
> values from the raw table each time the materialised view is 
> refreshed.

You won't necessarily need to rewrite the "recent data" view definitions, I think. What is
deemed "recent" depends on what's in the materialized views (it'd be anything newer than
whatever is in there). The good news is that you can simply query for that :-)
So trivially, in your "the data that is more recent than the stuff from the materialized
views" non-materialized view you'd use a definition like
SELECT .... WHERE sometimestamp > (select max(sometimestamp) from the_materialized_view)
or something along those lines.



pgsql-general by date:

Previous
From: Klaudie Willis
Date:
Subject: When Update balloons memory
Next
From: Vikas Sharma
Date:
Subject: how to get value of parameter set in session for other user