Rather than creating or dropping the index in Snowflake, we can utilize the clustering key for achieving the query performance. For creating the clustering key, we use ALTER TABLE . CLUSTER BY command:
Syntax:
alter table table_name cluster by (column1, column2, …, columnN);
Example:
Cluster on a single column
alter table active_users1
cluster by (id1)
Looking forward to a career in a cloud data warehousing domain? Check out the "Snowflake Training" and get certified today |
Cluster on multiple columns
alter table active_users1
cluster by (id1, active1)
But, we should be careful about using the clustering keys. The clustering key must be used only when we are handling tables of the below properties:
Clustering enables us to co-locate the data in similar micro-partitions. It is suitable for huge tables where the ordering is not good. I hope this article gives you adequate information about creating Clustering keys.
Snowflake Related Articles
Our work-support plans provide precise options as per your project tasks. Whether you are a newbie or an experienced professional seeking assistance in completing project tasks, we are here with the following plans to meet your custom needs:
Name | Dates | |
---|---|---|
Snowflake Training | May 10 to May 25 | View Details |
Snowflake Training | May 13 to May 28 | View Details |
Snowflake Training | May 17 to Jun 01 | View Details |
Snowflake Training | May 20 to Jun 04 | View Details |
Viswanath is a passionate content writer of Mindmajix. He has expertise in Trending Domains like Data Science, Artificial Intelligence, Machine Learning, Blockchain, etc. His articles help the learners to get insights about the Domain. You can reach him on Linkedin