SNF Prre MNGR Ytw
SNF Prre MNGR Ytw
MICRO PARTITIONS
What are micro partitions?
Table data is stored in files of size 50-500 MB. These are the contiguous storage units
The logical structure of the table is stored into physical structure in micro partitions as per
clustering key which snowflake maintains
Micro partitions can’t be modified once created while inserting/deleting/updating as they are
immutable
If you insert the data, the new micro partitions gets created
If you update the data, new micro partitions gets created with new updated data but it has to
scan and check the previous version of micro partition has that same data
If you delete any row, a new micro partition gets created with same data but that particular
row will not be there in new micro partition
Query pruning:
In simple words, if you don’t have a clustering key and run a query, all the partitions will be
scanned but when if you add a clustering key, micro partitions scan will be limited based on the
conditions that give in your query
Take any example and add clustering key to the table and run a query on it
Here is the image
You will get clarity of how will it selects partitions scanned in below theory.
What is overlapping micro partitions and overlap depth??
In the below image with different cases, overlapping of data in micro partition happens and
that’s the reason the terms overlapping micro-partitions and overlap depth (number of
overlapping micro partitions) comes into picture.
Let’s take case2 in below image, if you want to get data in between k to z, it has to scan 3
overlapping micro partitions which makes your execution faster rather than scanning all the
micro partitions
In previous post snowflake_11 as shown