0

How would you create new or otherwise refresh a materialized view in Postgres?

I've tried something like this:

CREATE 
OR REFRESH MATERIALIZED VIEW institution_mv AS 
SELECT 
    entity_id, 
    equity_aum 
FROM ... 

but it will give me a syntax error:

syntax error at or near "REFRESH"

0

You can only issue a statement to create a materialized view or another one to refresh it.

To create a materialized view use:

CREATE MATERIALIZED VIEW weivdezilairetam
AS
SELECT ...;

Unless you specify the option WITH NO DATA at the end of the statement, it will be populated upon creation.

To refresh an existing materialized view use:

REFRESH MATERIALIZE VIEW weivdezilairetam;

See "CREATE MATERIALIZED VIEW" and "REFRESH MATERIALIZED VIEW" for more details.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.