Re: Advice on using materialized views

From: Wicher <wicher+pglist(at)gavagai(dot)nl>
To: "Phil Endecott" <spam_from_pgsql_lists(at)chezphil(dot)org>
Cc: <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Advice on using materialized views
Date: 2021-12-07 09:32:51
Message-ID: 20211207103251.59354436@tipi
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, 06 Dec 2021 18:48:47 +0000
"Phil Endecott" <spam_from_pgsql_lists(at)chezphil(dot)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.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Vikas Sharma 2021-12-07 12:16:56 how to get value of parameter set in session for other user
Previous Message Klaudie Willis 2021-12-07 09:15:57 When Update balloons memory