Thread: Why no CREATE TEMP MATERIALIZED VIEW ?

Why no CREATE TEMP MATERIALIZED VIEW ?

From
Ivan Voras
Date:
Hello,

Out of curiosity, since there's CREATE TEMP VIEW, any particular reason there's no CREATE TEMP MATERIALIZED VIEW?

Seems like it could be similar to a temp table.

Re: Why no CREATE TEMP MATERIALIZED VIEW ?

From
"David G. Johnston"
Date:
On Tue, Jul 16, 2019 at 9:29 AM Ivan Voras <ivoras@gmail.com> wrote:
Out of curiosity, since there's CREATE TEMP VIEW, any particular reason there's no CREATE TEMP MATERIALIZED VIEW?

Seems like it could be similar to a temp table.

Probably a lack (absence) of use cases resulted in people deciding (or defaulting) to not spend any effort in that area.  Incremental maintenance and refresh seem considerably less useful when only the current session can see the table.  Temp views and temp tables seem to provide sufficient options in the session lifetime space.

David J.

Re: Why no CREATE TEMP MATERIALIZED VIEW ?

From
Ron
Date:
On 7/16/19 11:56 AM, David G. Johnston wrote:
On Tue, Jul 16, 2019 at 9:29 AM Ivan Voras <ivoras@gmail.com> wrote:
Out of curiosity, since there's CREATE TEMP VIEW, any particular reason there's no CREATE TEMP MATERIALIZED VIEW?

Seems like it could be similar to a temp table.

Probably a lack (absence) of use cases resulted in people deciding (or defaulting) to not spend any effort in that area.  Incremental maintenance and refresh seem considerably less useful when only the current session can see the table.  Temp views and temp tables seem to provide sufficient options in the session lifetime space.

How different is a "temp materialized view" from a regular view?


--
Angular momentum makes the world go 'round.

Re: Why no CREATE TEMP MATERIALIZED VIEW ?

From
Adam Brusselback
Date:
> How different is a "temp materialized view" from a regular view?

If it existed, it would be useful for cases when you need to reference that view in multiple queries in the same session. I've gotten around this by just using temp tables.

Re: Why no CREATE TEMP MATERIALIZED VIEW ?

From
Alvaro Herrera
Date:
On 2019-Jul-16, Ivan Voras wrote:

> Hello,
> 
> Out of curiosity, since there's CREATE TEMP VIEW, any particular reason
> there's no CREATE TEMP MATERIALIZED VIEW?

Because it hasn't been implemented.  There is a patch, but it's not
done.  See this thread:
https://postgr.es/m/CAKLmikNoQR4ZNg_wt=-hU-uUxV2cXVdveeRsMFjr2SAopVxDxw@mail.gmail.com

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services