CREATE VIEW — Creates a view into a table, used to optimize access to specific columns within a table.
CREATE VIEW view-name ( view-column-name [,...] )
AS SELECT table-column-name [,...] COUNT(*) AS alias [, aggregate [ ,... ]]
GROUP BY column-name [,...]
The CREATE VIEW statement creates a view of a table with selected columns and aggregates. VoltDB implements views as materialized views. In other words, the view is stored as a special table in the database and is updated each time the corresponding database table is updated. This means there is a small, incremental performance impact for any inserts or updates to the table, but selects on the view will execute efficiently.
The following limitations are important to note when using the CREATE VIEW statement with VoltDB:
Views are allowed on individual tables only. Joins are not supported.
The SELECT statement must obey the following constraints:
There must be a GROUP BY clause in the SELECT statement.
The first columns listed in the GROUP BY must match the initial columns in the SELECT statement in both name and order.
SELECT must include a field specified as COUNT(*). Other aggregates (SUM or COUNT) are allowed following the COUNT(*).