info > CREATE_MATERIALIZED_VIEW

📖 NAME

CREATE_MATERIALIZED_VIEW — define a new materialized view

🚀 Quick Reference

Use CaseCommandDescription
Create a materialized viewCREATE MATERIALIZED VIEW view_name AS select_query;Defines and populates a new materialized view.
Create an empty materialized viewCREATE MATERIALIZED VIEW view_name AS select_query WITH NO DATA;Defines the view but marks it as unscannable until refreshed.
Create with specific columnsCREATE MATERIALIZED VIEW view_name (col1, col2) AS select_query;Creates a materialized view with specific column names.
Create with storage parametersCREATE MATERIALIZED VIEW view_name WITH (fillfactor = 90) AS select_query;Creates a materialized view with custom storage settings.
Create in a specific tablespaceCREATE MATERIALIZED VIEW view_name TABLESPACE fast_space AS select_query;Stores the materialized view data in a specific tablespace.
Create if not existsCREATE MATERIALIZED VIEW IF NOT EXISTS view_name AS select_query;Creates a materialized view only if it doesn't already exist.

📝 SYNOPSIS

CREATE MATERIALIZED VIEW [ IF NOT EXISTS ] table_name
    [ (column_name [, ...] ) ]
    [ USING method ]
    [ WITH ( storage_parameter [= value] [, ... ] ) ]
    [ TABLESPACE tablespace_name ]
    AS query
    [ WITH [ NO ] DATA ]

📖 DESCRIPTION

CREATE MATERIALIZED VIEW defines a materialized view of a query. The query is executed and used to populate the view at the time the command is issued (unless WITH NO DATA is used) and may be refreshed later using REFRESH MATERIALIZED VIEW.

CREATE MATERIALIZED VIEW is similar to CREATE TABLE AS, except that it also remembers the query used to initialize the view, so that it can be refreshed later upon demand. A materialized view has many of the same properties as a table, but there is no support for temporary materialized views.

CREATE MATERIALIZED VIEW requires CREATE privilege on the schema used for the materialized view.

⚙️ PARAMETERS

🔗 COMPATIBILITY

CREATE MATERIALIZED VIEW is a PostgreSQL extension.

📚 SEE ALSO


PostgreSQL 14.23 2026 CREATE MATERIALIZED VIEW(7)

CREATE_MATERIALIZED_VIEW
📖 NAME 🚀 Quick Reference 📝 SYNOPSIS 📖 DESCRIPTION ⚙️ PARAMETERS 🔗 COMPATIBILITY 📚 SEE ALSO

Generated by phpman v4.9.26-5-g7740029 Author: Che Dong Under GNU General Public License
2026-08-14 21:37 @2600:1f28:365:80b0:4d23:66fa:c2bb:7bae
CrawledBy CCBot/2.0 (https://commoncrawl.org/faq/)
Valid XHTML 1.0 Transitional!Valid CSS!