Skip to content

Materialized View Operations

Operation: createMaterializedView

pgm.createMaterializedView( viewName, options, definition )

IMPORTANT

Create a new materialized view - postgres docs

Arguments

NameTypeDescription
viewNamestringname of the new materialized view
optionsobjectCheck below for available options
definitionstringSQL of SELECT statement

Options

OptionTypeDescription
ifNotExistsbooleanadds IF NOT EXISTS clause
columnsstring or arrayuse if you want to name columns differently then inferred from definition
tablespacestringoptional
storageParametersobjectoptional key value pairs of Storage Parameters
databooleandefault undefined

Reverse Operation: dropMaterializedView

pgm.dropMaterializedView( viewName, options )

IMPORTANT

Drop a materialized view - postgres docs

Arguments

NameTypeDescription
viewNamestringname of the view to delete
optionsobjectCheck below for available options

Options

OptionTypeDescription
ifExistsbooleandrops view only if it exists
cascadebooleandrops also dependent objects

Operation: alterMaterializedView

pgm.alterMaterializedView( viewName, options )

IMPORTANT

Alter a materialized view - postgres docs

Arguments

NameTypeDescription
viewNamestringname of the view to alter
optionsobjectCheck below for available options

Options

OptionTypeDescription
clusterstringoptional index name for clustering
extensionstringoptional name of extension view is dependent on
storageParametersobjectoptional key value (null to reset) pairs of Storage Parameters

Operation: renameMaterializedView

pgm.renameMaterializedView( viewName, newViewName )

IMPORTANT

Rename a materialized view - postgres docs

Arguments

NameTypeDescription
viewNamestringold name of the view
newViewNamestringnew name of the view

Operation: alterMaterializedViewColumn

pgm.renameMaterializedViewColumn( viewName, columnName, newColumnName )

IMPORTANT

Rename a materialized view column - postgres docs

Arguments

NameTypeDescription
viewNamestringname of the view to alter
columnNamestringcurrent column name
newColumnNamestringnew column name

Operation: refreshMaterializedView

pgm.refreshMaterializedView( viewName, options )

IMPORTANT

Refreshes a materialized view - postgres docs

Arguments

NameTypeDescription
viewNamestringName of the view to refresh
optionsobjectCheck below for available options

Options

OptionTypeDescription
concurrentlybooleandefault false
databooleandefault undefined