PARTITION BY

Create table option

Description

PARTITION BY is an optional clause that controls table partitioningarrow-up-right.

This is not supported by Snowflake but all data in Snowflake tables is automatically divided into micro-partitions, which are contiguous units of storage. Each micro-partition contains between 50 MB and 500 MB of uncompressed data. Groups of rows in tables are mapped into individual micro-partitions, organized in a columnar fashion. This size and structure allows for extremely granular pruning of very large tables, which can be comprised of millions, or even hundreds of millions, of micro-partitions.

circle-exclamation

Sample Source

BigQuery (Input Code)

CREATE TABLE table1(
    transaction_id INT, 
    transaction_date DATE
)
PARTITION BY transaction_date;

Snowflake (Output Code)

CREATE TABLE table1(
    transaction_id INT, 
    transaction_date DATE
)
----** MSC-WARNING - MSC-BQ0005 - MICRO-PARTITIONING IS AUTOMATICALLY PERFORMED ON ALL SNOWFLAKE TABLES. **
--PARTITION BY transaction_date
;
  1. MSC-BQ0005arrow-up-right: Micro-partitioning is automatically performed on all Snowflake tables.

Last updated

Was this helpful?