We can create projection on a table to improve the query performance.
Syntax:
CREATE PROJECTION <Schema Name>.<Projection Name>
( <Column Name1>, <Column Name2>,....) --table related all columns
AS
SELECT <Column Name1>,<Column Name2>,... --table related all columns
ORDER BY <Column Name1>,<Column Name2>,... --required key columns
SEGMENTED BY HASH(<Column Name1>,<Column Name2>,.. ) --required columns
ALL NODES;
Example:
Table Creation:
CREATE TABLE SAMPLE.SAMPLE1 (ID INT,NAME VARCHAR(50))
Projection Creation:
CREATE PROJECTION Sample.Proj_sample
(id, name)
AS
SELECT id, name
FROM Sample.sample1
ORDER BY id
SEGMENTED BY hash(id,name) ALL NODES;
No comments:
Post a Comment