US 11,966,399 B1
Processing top-K queries on data in relational database systems
Dennis Lui, San Jose, CA (US); Allison L Holloway, San Carlos, CA (US); and Shasank Kisan Chavan, Menlo Park, CA (US)
Assigned to Oracle International Corporation, Redwood Shores, CA (US)
Filed by Oracle International Corporation, Redwood Shores, CA (US)
Filed on Oct. 14, 2022, as Appl. No. 17/966,749.
Int. Cl. G06F 16/2455 (2019.01); G06F 16/23 (2019.01); G06F 16/2453 (2019.01)
CPC G06F 16/24554 (2019.01) [G06F 16/23 (2019.01); G06F 16/24537 (2019.01); G06F 16/24542 (2019.01)] 20 Claims
OG exemplary drawing
 
1. A method comprising:
receiving a database statement that requests top K results related to a database object and that indicates (1) a first column, of the database object, by which to partition a result set of processing the database statement and (2) a second column, of the database object, by which to order the result set;
generating a temporary buffer that comprises a plurality of slots;
for each row of multiple rows in the database object:
identifying a first key value that is associated with a first value in the first column of said each row;
identifying a second key value that is associated with a second value in the second column of said each row;
identifying a slot in the temporary buffer based on the first key value and the second key value;
determining whether to update the slot in the temporary buffer based on the second key value and any key values already in the slot;
based on the temporary buffer, responding to the database statement;
wherein the method is performed by one or more computing devices.