IP Library Granted Patent US 10,997,215
Granted Patent B2
US 10,997,215 · App. 17/030,565 · Granted May 4, 2021

Maintaining states of partitions of a table for reclustering

Inventors: Thierry Cruanes (San Mateo, CA); Marcin Zukowski (San Mateo, CA); Benoit Dageville (San Mateo, CA); Jiaqi Yan (San Mateo, CA)
Assignee: Snowflake Inc.
G06F16/285G06F16/211G06F16/2282G06F16/245
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 10,997,215
App. No.
17/030,565
Granted
May 4, 2021
Kind
B2
Abstract

The subject technology creates partitions based on changes to a table, at least one of the one or more partitions overlapping with respect to values of one or more attributes with at least one of another partition and a previous partition. The subject technology maintains states for the partitions, each state from the plurality of states representing a particular degree of clustering of the table. The subject technology determines a number of overlapping partitions and a depth of the overlapping partitions, and determines a clustering ratio based at least in part on the number of overlapping partitions and the depth. The subject technology reclusters partitions of the table to increase the clustering ratio, the clustering ratio determined by at least a proportion of rows in a layout of the table that satisfy an ordering criteria based at least in part a particular attribute of the one or more attributes.

Claims (59)

1. A method comprising:

creating one or more partitions based on changes to a table, at least one of the one or more partitions overlapping with respect to values of one or more attributes with at least one of another partition and a previous partition;

maintaining a plurality of states for the one or more partitions, each state from the plurality of states representing a particular degree of clustering of the table, the maintaining further comprising:

determining that an incremental increase in respective clustering ratios between a first state and a second state has occurred, the first state representing a first stage of the table prior to the second state of the table, the second state corresponding to a subsequent stage after reclustering has been performed on the table at the first state;

for each state of the plurality of states:

determining a number of overlapping partitions and a depth of the overlapping partitions;

determining a clustering ratio based at least in part on the number of overlapping partitions and the depth; and

reclustering the one or more partitions of the table to increase the clustering ratio, the clustering ratio determined by at least a proportion of rows in a layout of the table that satisfy an ordering criteria based at least in part on a particular attribute of the one or more attributes.

2. The method of claim 1 , wherein the clustering ratio comprises a value within a specified range that indicates whether a clustering state of the table has improved or deteriorated based on changes to data in the table.

3. The method of claim 2 , wherein a higher value of the clustering ratio within the specified range indicates a more optimally clustered table, and with a highest value of within the specified range indicates that the table is fully clustered.

4. The method of claim 1 , wherein determining the clustering ratio is further based on an example query and a threshold time for how long the example query should take, the example query comprising a commonly executed query or a query specified for testing clustering.

5. The method of claim 1 , further comprising:

determining that a second incremental increase in respective clustering ratios between the second state and a third state has occurred, the third state corresponding to a second subsequent stage after reclustering has been performed on the table at the second state.

6. The method of claim 5 , further comprising:

determining that a third incremental increase in respective clustering ratios between the third state and a fourth state has occurred, the fourth state indicating a particular clustering ratio where the table is fully clustered.

7. The method of claim 1 , wherein reclustering comprises merging two or more partitions.

8. The method of claim 1 , further comprising:

determining at least one clustering key for reorganizing the table, wherein reclustering the one or more partitions of the table to increase the clustering ratio is based at least in part on the at least one clustering key.

9. The method of claim 8 , wherein the at least one clustering key comprises a subset of columns or expressions on the table that are designated for co-locating data in a same micro-partition.

10. A system, the system comprising:

one or more processors; and

a memory device storing instructions that, when executed by one or more processors, cause the one or more processors to perform operations comprising:

creating one or more partitions based on changes to a table, at least one of the one or more partitions overlapping with respect to values of one or more attributes with at least one of another partition and a previous partition;

maintaining a plurality of states for the one or more partitions, each state from the plurality of states representing a particular degree of clustering of the table, the maintaining further comprising:

determining that an incremental increase in respective clustering ratios between a first state and a second state has occurred, the first state representing a first stage of the table prior to the second state of the table, the second state corresponding to a subsequent stage after reclustering has been performed on the table at the first state;

for each state of the plurality of states:

determining a number of overlapping partitions and a depth of the overlapping partitions;

determining a clustering ratio based at least in part on the number of overlapping partitions and the depth; and

reclustering the one or more partitions of the table to increase the clustering ratio, the clustering ratio determined by at least a proportion of rows in a layout of the table that satisfy an ordering criteria based at least in part on a particular attribute of the one or more attributes.

11. The system of claim 10 , wherein the clustering ratio comprises a value within a specified range that indicates whether a clustering state of the table has improved or deteriorated based on changes to data in the table.

12. The system of claim 11 , wherein a higher value of the clustering ratio within the specified range indicates a more optimally clustered table, and with a highest value of within the specified range indicates that the table is fully clustered.

13. The system of claim 10 , wherein determining the clustering ratio is further based on an example query and a threshold time for how long the example query should take, the example query comprising a commonly executed query or a query specified for testing clustering.

14. The system of claim 10 , wherein the operations further comprise:

determining that a second incremental increase in respective clustering ratios between the second state and a third state has occurred, the third state corresponding to a second subsequent stage after reclustering has been performed on the table at the second state.

15. The system of claim 14 , wherein the operations further comprise:

determining that a third incremental increase in respective clustering ratios between the third state and a fourth state has occurred, the fourth state indicating a particular clustering ratio where the table is fully clustered.

16. The system of claim 10 , wherein reclustering comprises merging two or more partitions.

17. The system of claim 10 , wherein the operations further comprise:

determining at least one clustering key for reorganizing the table, wherein reclustering the one or more partitions of the table to increase the clustering ratio is based at least in part on the at least one clustering key.

18. The system of claim 17 , wherein the at least one clustering key comprises a subset of columns or expressions on the table that are designated for co-locating data in a same micro-partition.

19. A non-transitory computer readable storage media storing instructions that, when executed by one or more processors, cause the one or more processors to perform operations comprising:

creating one or more partitions based on changes to a table, at least one of the one or more partitions overlapping with respect to values of one or more attributes with at least one of another partition and a previous partition;

maintaining a plurality of states for the one or more partitions, each state from the plurality of states representing a particular degree of clustering of the table, the maintaining further comprising:

determining that an incremental increase in respective clustering ratios between a first state and a second state has occurred, the first state representing a first stage of the table prior to the second state of the table, the second state corresponding to a subsequent stage after reclustering has been performed on the table at the first state;

for each state of the plurality of states:

determining a number of overlapping partitions and a depth of the overlapping partitions;

determining a clustering ratio based at least in part on the number of overlapping partitions and the depth; and

reclustering the one or more partitions of the table to increase the clustering ratio, the clustering ratio determined by at least a proportion of rows in a layout of the table that satisfy an ordering criteria based at least in part on a particular attribute of the one or more attributes.

20. The non-transitory computer readable storage media of claim 19 , wherein the clustering ratio comprises a value within a specified range that indicates whether a clustering state of the table has improved or deteriorated based on changes to data in the table.

21. The non-transitory computer readable storage media of claim 20 , wherein a higher value of the clustering ratio within the specified range indicates a more optimally clustered table, and with a highest value of within the specified range indicates that the table is fully clustered.

22. The non-transitory computer readable storage media of claim 19 , wherein determining the clustering ratio is further based on an example query and a threshold time for how long the example query should take, the example query comprising a commonly executed query or a query specified for testing clustering.

23. The non-transitory computer readable storage media of claim 19 , wherein the operations further comprise:

determining that a second incremental increase in respective clustering ratios between the second state and a third state has occurred, the third state corresponding to a second subsequent stage after reclustering has been performed on the table at the second state.

24. The non-transitory computer readable storage media of claim 23 , wherein the operations further comprise:

determining that a third incremental increase in respective clustering ratios between the third state and a fourth state has occurred, the fourth state indicating a particular clustering ratio where the table is fully clustered.

25. The non-transitory computer readable storage media of claim 19 , wherein reclustering comprises merging two or more partitions.

26. The non-transitory computer readable storage media of claim 19 , wherein the operations further comprise:

determining at least one clustering key for reorganizing the table, wherein reclustering the one or more partitions of the table to increase the clustering ratio is based at least in part on the at least one clustering key.

27. The non-transitory computer readable storage media of claim 26 , wherein the at least one clustering key comprises a subset of columns or expressions on the table that are designated for co-locating data in a same micro-partition.

Assignments (3)
CORRECTIVE ASSIGNMENT TO CORRECT THE CONVEYING PARTY'S EXECUTION DATE PREVIOUSLY RECORDED AT REEL: 054106 FRAME: 0987. ASSIGNOR(S) HEREBY CONFIRMS THE CHANGE OF NAME. Recorded Jul 22, 2021
From: SNOWFLAKE COMPUTING INC.
To: SNOWFLAKE INC.
Reel/Frame 056964/0023 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Oct 20, 2020
From: CRUANES, THIERRY; ZUKOWSKI, MARCIN; DAGEVILLE, BENOIT; YAN, JIAQI
To: SNOWFLAKE COMPUTING INC.
Reel/Frame 054106/0906 →
CHANGE OF NAME Recorded Oct 20, 2020
From: SNOWFLAKE COMPUTING INC.
To: SNOWFLAKE INC.
Reel/Frame 054106/0987 →
Continuity (3)
Continuation 15694436 · Sep 1, 2017
Provisional Application 62383201 · Sep 2, 2016
Related Publication 20210019336A1 · Jan 21, 2021