Skip to main content

SHOW CREATE MATERIALIZED VIEW

Use the SHOW CREATE MATERIALIZED VIEW command to see what query was used to create the specified materialized view.

Syntax

SHOW CREATE MATERIALIZED VIEW mv_name;

Parameters

ParameterDescription
mv_nameThe materialized view to show the query of.

Example

CREATE MATERIALIZED VIEW v1 AS SELECT id FROM taxi_trips;
SHOW CREATE MATERIALIZED VIEW v1;

Here is the result.

   Name    |                 Create Sql
-----------+---------------------------------------------
public.v1 | CREATE MATERIALIZED VIEW v1 AS SELECT id FROM taxi_trips
(1 row)

SHOW CREATE VIEW

SHOW CREATE TABLE

Help us make this doc better!