{
    "mode": "man",
    "parameter": "CREATE_MATERIALIZED_VIEW",
    "section": "7",
    "url": "https://www.chedong.com/phpMan.php/man/CREATE_MATERIALIZED_VIEW/7/json",
    "generated": "2026-11-12T04:12:23Z",
    "synopsis": "CREATE MATERIALIZED VIEW [ IF NOT EXISTS ] tablename\n[ (columnname [, ...] ) ]\n[ USING method ]\n[ WITH ( storageparameter [= value] [, ... ] ) ]\n[ TABLESPACE tablespacename ]\nAS query\n[ WITH [ NO ] DATA ]",
    "sections": {
        "NAME": {
            "content": "CREATEMATERIALIZEDVIEW - define a new materialized view\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "CREATE MATERIALIZED VIEW [ IF NOT EXISTS ] tablename\n[ (columnname [, ...] ) ]\n[ USING method ]\n[ WITH ( storageparameter [= value] [, ... ] ) ]\n[ TABLESPACE tablespacename ]\nAS query\n[ WITH [ NO ] DATA ]\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "CREATE MATERIALIZED VIEW defines a materialized view of a query. The query is executed and\nused to populate the view at the time the command is issued (unless WITH NO DATA is used) and\nmay be refreshed later using REFRESH MATERIALIZED VIEW.\n\nCREATE MATERIALIZED VIEW is similar to CREATE TABLE AS, except that it also remembers the\nquery used to initialize the view, so that it can be refreshed later upon demand. A\nmaterialized view has many of the same properties as a table, but there is no support for\ntemporary materialized views.\n\nCREATE MATERIALIZED VIEW requires CREATE privilege on the schema used for the materialized\nview.\n",
            "subsections": []
        },
        "PARAMETERS": {
            "content": "IF NOT EXISTS\nDo not throw an error if a materialized view with the same name already exists. A notice\nis issued in this case. Note that there is no guarantee that the existing materialized\nview is anything like the one that would have been created.\n\ntablename\nThe name (optionally schema-qualified) of the materialized view to be created. The name\nmust be distinct from the name of any other relation (table, sequence, index, view,\nmaterialized view, or foreign table) in the same schema.\n\ncolumnname\nThe name of a column in the new materialized view. If column names are not provided, they\nare taken from the output column names of the query.\n\nUSING method\nThis optional clause specifies the table access method to use to store the contents for\nthe new materialized view; the method needs be an access method of type TABLE. See\nChapter 63 for more information. If this option is not specified, the default table\naccess method is chosen for the new materialized view. See defaulttableaccessmethod\nfor more information.\n\nWITH ( storageparameter [= value] [, ... ] )\nThis clause specifies optional storage parameters for the new materialized view; see\nStorage Parameters in the CREATE TABLE (CREATETABLE(7)) documentation for more\ninformation. All parameters supported for CREATE TABLE are also supported for CREATE\nMATERIALIZED VIEW. See CREATE TABLE (CREATETABLE(7)) for more information.\n\nTABLESPACE tablespacename\nThe tablespacename is the name of the tablespace in which the new materialized view is\nto be created. If not specified, defaulttablespace is consulted.\n\nquery\nA SELECT, TABLE, or VALUES command. This query will run within a security-restricted\noperation; in particular, calls to functions that themselves create temporary tables will\nfail.\n\nWITH [ NO ] DATA\nThis clause specifies whether or not the materialized view should be populated at\ncreation time. If not, the materialized view will be flagged as unscannable and cannot be\nqueried until REFRESH MATERIALIZED VIEW is used.\n",
            "subsections": []
        },
        "COMPATIBILITY": {
            "content": "CREATE MATERIALIZED VIEW is a PostgreSQL extension.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "ALTER MATERIALIZED VIEW (ALTERMATERIALIZEDVIEW(7)), CREATE TABLE AS (CREATETABLEAS(7)),\nCREATE VIEW (CREATEVIEW(7)), DROP MATERIALIZED VIEW (DROPMATERIALIZEDVIEW(7)), REFRESH\nMATERIALIZED VIEW (REFRESHMATERIALIZEDVIEW(7))\n\nPostgreSQL 16.14                                2026                     CREATE MATERIALIZED VIEW(7)",
            "subsections": []
        }
    },
    "summary": "CREATEMATERIALIZEDVIEW - define a new materialized view",
    "flags": [],
    "examples": [],
    "see_also": [
        {
            "name": "ALTERMATERIALIZEDVIEW",
            "section": "7",
            "url": "https://www.chedong.com/phpMan.php/man/ALTERMATERIALIZEDVIEW/7/json"
        },
        {
            "name": "CREATETABLEAS",
            "section": "7",
            "url": "https://www.chedong.com/phpMan.php/man/CREATETABLEAS/7/json"
        },
        {
            "name": "CREATEVIEW",
            "section": "7",
            "url": "https://www.chedong.com/phpMan.php/man/CREATEVIEW/7/json"
        },
        {
            "name": "DROPMATERIALIZEDVIEW",
            "section": "7",
            "url": "https://www.chedong.com/phpMan.php/man/DROPMATERIALIZEDVIEW/7/json"
        },
        {
            "name": "REFRESHMATERIALIZEDVIEW",
            "section": "7",
            "url": "https://www.chedong.com/phpMan.php/man/REFRESHMATERIALIZEDVIEW/7/json"
        },
        {
            "name": "VIEW",
            "section": "7",
            "url": "https://www.chedong.com/phpMan.php/man/VIEW/7/json"
        }
    ]
}