/create/materializedview

URL: https://<aws.fqdn>/<aws.cluster.name>/gpudb-0/create/materializedview

Initiates the process of creating a materialized view, reserving the view's name to prevent other views or tables from being created with that name.

For materialized view details and examples, see Materialized Views.

The response contains output parameter view_id, which is used to tag each subsequent operation (projection, union, aggregation, filter, or join) that will compose the view.

Input Parameter Description

NameTypeDescription
table_namestringName of the table to be created that is the top-level table of the materialized view, in [schema_name.]table_name format, using standard name resolution rules and meeting table naming criteria.
optionsmap of string to strings

Optional parameters. The default value is an empty map ( {} ).

Supported Parameters (keys)Parameter Description
collection_name[DEPRECATED--please specify the containing schema for the materialized view as part of input parameter table_name and use /create/schema to create the schema if non-existent] Name of a schema which is to contain the newly created view. If the schema provided is non-existent, it will be automatically created.
execute_asUser name to use to run the refresh job
persist

If true, then the materialized view specified in input parameter table_name will be persisted and will not expire unless a ttl is specified. If false, then the materialized view will be an in-memory table and will expire unless a ttl is specified otherwise. The default value is false. The supported values are:

  • true
  • false
refresh_spanSets the future time-offset(in seconds) at which periodic refresh stops
refresh_stop_timeWhen refresh_method is periodic, specifies the time at which a periodic refresh is stopped. Value is a datetime string with format 'YYYY-MM-DD HH:MM:SS'.
refresh_method

Method by which the join can be refreshed when the data in underlying member tables have changed. The default value is manual.

Supported ValuesDescription
manualRefresh only occurs when manually requested by calling /alter/table with an 'action' of 'refresh'
on_queryRefresh any time the view is queried.
on_changeIf possible, incrementally refresh (refresh just those records added) whenever an insert, update, delete or refresh of input table is done. A full refresh is done if an incremental refresh is not possible.
periodicRefresh table periodically at rate specified by refresh_period
refresh_periodWhen refresh_method is periodic, specifies the period in seconds at which refresh occurs
refresh_start_timeWhen refresh_method is periodic, specifies the first time at which a refresh is to be done. Value is a datetime string with format 'YYYY-MM-DD HH:MM:SS'.
ttlSets the TTL of the table specified in input parameter table_name.

Output Parameter Description

The GPUdb server embeds the endpoint response inside a standard response structure which contains status information and the actual response to the query. Here is a description of the various fields of the wrapper:

NameTypeDescription
statusString'OK' or 'ERROR'
messageStringEmpty if success or an error message
data_typeString'create_materialized_view_response' or 'none' in case of an error
dataStringEmpty string
data_strJSON or String

This embedded JSON represents the result of the /create/materializedview endpoint:

NameTypeDescription
table_namestringValue of input parameter table_name.
view_idstringValue of view_id.
infomap of string to strings

Additional information. The default value is an empty map ( {} ).

Possible Parameters (keys)Parameter Description
qualified_table_nameThe fully qualified name of the result table (i.e. including the schema)

Empty string in case of an error.