Maintaining sort order of data in databases
First Claim
1. A computer implemented method for maintaining sort order of data in a database, the method comprising:
- storing an input table in columnar fashion, wherein the input table is stored as a sorted set of rows followed by an unsorted set of rows;
partitioning the unsorted set of rows into a plurality of subsets of rows wherein each subset of rows comprises data stored in sorted order within the subset of rows; and
incrementally merging data from the unsorted set of rows to the sorted set of rows, the incremental merging comprising, iteratively;
selecting a set of rows from the plurality of subsets of rows, wherein the selected set of rows comprises rows with lowest rank in the sort order across the plurality of subsets of rows;
for each column, identifying a block corresponding to a last row of the selected set of rows being merged; and
for each column, storing the rows following the last row of the set of rows from the identified block in a new block, wherein the new block for each column is for processing in the next iteration; and
merging the selected set of rows with the sorted set of rows.
6 Assignments
0 Petitions
Accused Products
Abstract
A database system maintains table data in sorted order. The table data becomes unsorted over time due to add, delete, and update operations. These operations are performed such that the table comprises an initial sorted region followed by an unsorted region. The database system performs an incremental operation to rewrite the table in sorted order. The database system partitions the unsorted region into a plurality of partitions comprising sorted rows within each partition. The database system iteratively merges rows from the partitions to the sorted region of the table. The database system selects a set of lowest tanked rows from the partitions. The database system merges these lowest ranked rows with the sorted region while maintaining the sort order of the sorted region. The database system repeats these steps until all the partitions are processed. The database may store data in columnar fashion.
25 Citations
13 Claims
-
1. A computer implemented method for maintaining sort order of data in a database, the method comprising:
-
storing an input table in columnar fashion, wherein the input table is stored as a sorted set of rows followed by an unsorted set of rows; partitioning the unsorted set of rows into a plurality of subsets of rows wherein each subset of rows comprises data stored in sorted order within the subset of rows; and incrementally merging data from the unsorted set of rows to the sorted set of rows, the incremental merging comprising, iteratively; selecting a set of rows from the plurality of subsets of rows, wherein the selected set of rows comprises rows with lowest rank in the sort order across the plurality of subsets of rows; for each column, identifying a block corresponding to a last row of the selected set of rows being merged; and for each column, storing the rows following the last row of the set of rows from the identified block in a new block, wherein the new block for each column is for processing in the next iteration; and merging the selected set of rows with the sorted set of rows. - View Dependent Claims (2, 3, 4, 5, 6, 7)
-
-
8. A non-transitory computer-readable storage medium storing computer-executable code for maintaining sort order of data in a database, the code, when executed by a processor, causing the processor to:
-
store an input table in columnar fashion, wherein the input table is stored as a sorted set of rows followed by an unsorted set of rows; partition the unsorted set of rows into a plurality of subsets of rows wherein each subset of rows comprises data stored in sorted order within the subset of rows; and incrementally merge data from the unsorted set of rows to the sorted set of rows, the incremental merging comprising, iteratively; select a set of rows from the plurality of subsets of rows, wherein the selected set of rows comprises rows with lowest rank in the sort order across the plurality of subsets of rows; for each column, identify a block corresponding to a last row of the selected set of rows being merged; and for each column, store the rows following the last row of the set of rows from the identified block in a new block, wherein the new block for each column is for processing in the next iteration; and merge the selected set of rows with the sorted set of rows. - View Dependent Claims (9, 10)
-
-
11. A computer-implemented system for maintaining sort order of data in a database, the system comprising:
-
a computer processor; and a non-transitory computer-readable storage medium storing computer program modules configured to execute on the computer processor, the computer program modules comprising; a vacuum process manager configured to; store an input table in columnar fashion, wherein the input table is stored as a sorted set of rows followed by an unsorted set of rows region; partition the unsorted set of rows into a plurality of subsets of rows wherein each subset of rows comprises data stored in sorted order within the subset of rows; and incrementally merge data from the unsorted set of rows to the sorted set of rows, the incremental merging comprising, iteratively; select a set of rows from the plurality of subsets of rows, wherein the selected set of rows comprises rows with lowest rank in the sort order across the plurality of subsets of rows; for each column, identify a block corresponding to a last row of the selected set of rows being merged; and for each column, store the rows following the last row of the set of rows from the identified block in a new block, wherein the new block for each column is for processing in the next iteration; and merge the selected set of rows with the sorted set of rows. - View Dependent Claims (12, 13)
-
Specification