CREATE PROJECTION (Live Aggregate Projections)
Creates metadata for live aggregate projections in the Vertica catalog. Top-K projections are a type of live aggregate projection.
Information here focuses on creating live aggregate projections. For details about creating other types of projections, including projections with expressions, see CREATE PROJECTION.
Syntax
CREATE PROJECTION [ IF NOT EXISTS ] projection-name ...[ ( ........{ projection-col | grouped-clause ......... [ ENCODING encoding-type ] ......... [ ACCESSRANK integer ] ........} [,... ] ...) ] AS SELECT {table-col | expr-with-table-cols } [,... ] FROM table-reference ... GROUP BY column-expr ... [ KSAFE [ k-num ] ]
CREATE PROJECTION [ IF NOT EXISTS ] projection-name ...[ ( ........{ projection-col | grouped-clause ......... [ ENCODING encoding-type ] ......... [ ACCESSRANK integer ] ........} [,... ] .....) ...] AS SELECT {table-col | expr-with-table-cols } [ , ... ] FROM table-reference ... LIMIT num-rows OVER (PARTITION BY column-expr ORDER BY column-expr) ... [ KSAFE [ k-num ] ]
Parameters
IF NOT EXISTS
|
Specifies to generate an informational message if an object already exists under the specified name. If you omit this option and the object exists, Vertica generates a The For related information, see |
projection‑name
|
The name of the projection to create, where projection‑name conforms to conventions described in Identifiers. Vertica creates the projection in the same schema as the anchor table. |
projection‑col
|
The name of a projection column. If you do not specify projection column names, Vertica uses the anchor table column names in the |
grouped‑clause
|
See GROUPED Clause. |
ENCODING encoding‑type
|
Specifies the column encoding type, by default set to AUTO. |
ACCESSRANK integer
|
Overrides the default access rank for a column. Use this parameter to increase or decrease the speed at which Vertica accesses a column. For more information, see Overriding Default Column Ranking. |
table‑col
|
A table column or expression of table columns to be included in the projection. If you specify projection column names, the two lists of projection columns and table columns/expressions must exactly match in number and order. |
table‑reference
|
A schema table with the columns to include in the projection, as follows: table-name [ AS ] alias [ ( column-alias [,...] ) ] |
GROUP BY column‑expr[,...]
|
One or more column expressions from the |
LIMIT num‑rows
|
The number of rows to return from the specified partition. |
OVER (PARTITION BY column‑expr [,...]
|
Specifies window partitioning by one or more column expressions from the SELECT list. The first column-expr is the first column expression in the SELECT list, the second column-expr is the second column expression in the SELECT list, and so on. |
ORDER BY column-expr [,...] [ASC | DESC]
|
The order in which the top k rows are returned, by default in ascending ( Top-K projections support ORDER BY NULLS FIRST/LAST. |
KSAFE [ k‑num ]
|
Specifies K-safety for the projection, where k-num must be equal to or greater than system K-safety. Vertica ignores this parameter if set for unsegmented projections. If you omit k-num, Vertica uses system K-safety. Vertica sets projection K-safety as follows:
If the For general information, see K-Safety in Vertica Concepts. |
Privileges
Requirements and Restrictions
See:
Examples
See: