From: Wicher <wicher+pglist@gavagai.nl>
To: Phil Endecott <spam_from_pgsql_lists@chezphil.org>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: Advice on using materialized views
Date: Tue, 7 Dec 2021 10:32:51 +0100
Message-ID: <20211207103251.59354436@tipi> (raw)
In-Reply-To: <1638816527952@dmwebmail.dmwebmail.chezphil.org>
References: <1638816527952@dmwebmail.dmwebmail.chezphil.org>
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.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: wicher+pglist@gavagai.nl, spam_from_pgsql_lists@chezphil.org
Subject: Re: Advice on using materialized views
In-Reply-To: <20211207103251.59354436@tipi>
References: <1638816527952@dmwebmail.dmwebmail.chezphil.org> <20211207103251.59354436@tipi>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox