Use the Materialized View dialog to define a materialized view. A materialized view is a stored or cached view that contains the result set of a query. Use the REFRESH MATERIALIZED VIEW command to update the content of a materialized view.
The Materialized View dialog organizes the development of a materialized_view through the following dialog tabs: General, Definition, Storage, Parameter, and Security. The SQL tab displays the SQL code generated by dialog selections.
Use the fields in the General tab to identify the materialized view:
Click the Definition tab to continue.
Use the text editor field in the Definition tab to provide the query that will populate the materialized view.
Click the Storage tab to continue.
Use the fields in the Storage tab to maintain the materialized view:
Click the Parameter tab to continue.
Use the tabs nested inside the Parameter tab to specify VACUUM and ANALYZE thresholds; use the Table tab and the Toast Table tab to customize values for the table and the associated toast table. To change the default values:
Click the Security tab to continue.
Use the Security tab to assign privileges and define security labels.
Use the Privileges panel to assign privileges to a role. Click the Add icon (+) to set privileges for the materialized view:
Click the Add icon (+) to assign additional privileges; to discard a privilege, click the trash icon to the left of the row and confirm deletion in the Delete Row popup.
Use the Security Labels panel to define security labels applied to the materialized view. Click the Add icon (+) to add each security label selection:
Click the Add icon (+) to assign additional security labels; to discard a security label, click the trash icon to the left of the row and confirm deletion in the Delete Row popup.
Click the SQL tab to continue.
Your entries in the Materialized View dialog generate a SQL command (see an example below). Use the SQL tab for review; revisit or switch tabs to make any changes to the SQL command.
Example
The following is an example of the sql command generated by user selections in the Materialized View dialog:
The example shown creates a query named new_hires that stores the result of the displayed query in the pg_default tablespace.