Skip to content

Latest commit

 

History

History
81 lines (51 loc) · 3.02 KB

mViews.md

File metadata and controls

81 lines (51 loc) · 3.02 KB

Materialized View Operations

pgm.createMaterializedView( viewName, options, definition )

Create a new materialized view - postgres docs

Arguments:

  • viewName [Name] - name of the new materialized view
  • options [object] - options:
    • ifNotExists [boolean] - default false
    • columns [string or array] - use if you want to name columns differently then inferred from definition
    • tablespace [string] - optional
    • storageParameters [object] - optional key value pairs of Storage Parameters
    • data [boolean] - default undefined
  • definition [string] - SQL of SELECT statement

Reverse Operation: dropMaterializedView


pgm.dropMaterializedView( viewName, options )

Drop a materialized view - postgres docs

Arguments:

  • viewName [Name] - name of the view to delete
  • options [object] - options:
    • ifExists [boolean] - drops view only if it exists
    • cascade [boolean] - drops also dependent objects

pgm.alterMaterializedView( viewName, options )

Alter a materialized view - postgres docs

Arguments:

  • viewName [Name] - name of the view to alter
  • options [object] - options:
    • cluster [string] - optional index name for clustering
    • extension [string] - optional name of extension view is dependent on
    • storageParameters [object] - optional key value pairs of Storage Parameters

pgm.renameMaterializedView( viewName, newViewName )

Rename a materialized view - postgres docs

Arguments:

  • viewName [Name] - old name of the view
  • newViewName [Name] - new name of the view

pgm.renameMaterializedViewColumn( viewName, columnName, newColumnName )

Rename a materialized view column - postgres docs

Arguments:

  • viewName [Name] - name of the view to alter
  • columnName [string] - current column name
  • newColumnName [string] - new column name

pgm.refreshMaterializedView( viewName, options )

Refreshes a materialized view - postgres docs

Arguments:

  • viewName [Name] - old name of the view
  • options [object] - options:
    • concurrently [boolean] - default false
    • data [boolean] - default undefined