| CPC G06F 16/24557 (2019.01) [G06F 16/244 (2019.01); G06F 16/24552 (2019.01); G06F 16/278 (2019.01)] | 20 Claims |

|
1. A system comprising:
at least one hardware processor;
a computer-readable medium storing instructions that, when executed by the at least one hardware processor, cause the at least one hardware processor to perform operations comprising:
receiving a database command, the database command comprising a group-by operator having a memory budget and a distinct or ordered operator;
grouping data into a plurality of different groups using the group-by operator, the grouping comprising creating a separate linked list in memory for each group of the plurality of different groups;
writing each separate linked list to a different partition on a disk;
for each partition on the disk:
writing rows from a corresponding partition into the memory;
sorting the rows;
writing the sorted rows back to the corresponding partition; and
moving a plurality of rows from the corresponding partition into an in-memory buffer unique to the corresponding partition;
performing a sorted merge on the in-memory buffers, reading out each row output by the sorted merge into the distinct or ordered operator; and
running the distinct or ordered operator on each row received from the in-memory buffers, until the distinct or ordered operator produces a result.
|