US 12,353,417 B1
Disk group-by with sorted merge
Andreas Amler, Heidelberg (DE); Till Merker, Sandhausen (DE); and Nico Bohnsack, Mauer (DE)
Assigned to SAP SE, Walldorf (DE)
Filed by SAP SE, Walldorf (DE)
Filed on Jul. 18, 2024, as Appl. No. 18/777,428.
Int. Cl. G06F 16/24 (2019.01); G06F 16/242 (2019.01); G06F 16/245 (2019.01); G06F 16/2455 (2019.01); G06F 16/27 (2019.01)
CPC G06F 16/24557 (2019.01) [G06F 16/244 (2019.01); G06F 16/24552 (2019.01); G06F 16/278 (2019.01)] 20 Claims
OG exemplary drawing
 
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.