IBM PureData System for Analytics, Version 7.1

Create materialized views

When you use SQL to create a materialized view from a base table, the system stores the view definition for the lifetime of the SPM view and the view is visible as a materialized view. Records that are associated with the SPM view are materialized into an IBM® Netezza® unique table. SPM data slices are co-located on the same data slices as the corresponding base table data slices and persistently stored on the user disk partitions.

To create a materialized view, enter:
   MYDB.SCHEMA(USER)=> CREATE MATERIALIZED VIEW customers_mview AS SELECT 
customer_name, customer_id FROM customers ORDER BY customer_id;
The following restrictions apply to creating a materialized view:
Note: As you insert new records into the base table that has an associated SPM view, the system appends the new records to the materialized view table as well. Thus, there are two areas in the materialized table: one area contains the sorted records that are generated when the view was created, the other area contains unsorted records that are inserted into the base table subsequent to the SPM view creation. If your query performance depends on the sorted nature of the SPM view, manually refresh the SPM view by suspending and refreshing it periodically.


Feedback | Copyright IBM Corporation 2014 | Last updated: 2014-02-28