Patent ID: 7792825

Claim:
A method, comprising: receiving a request to retrieve a number of rows of a table, wherein the retrieved number of rows are ordered; creating a fixed-size data buffer having a base address, wherein a data offset from the base address identifies each row stored at the data buffer, wherein a key offset from the base address identifies a key of each row stored at the data buffer, and wherein a number of elements in the data buffer is equal to the number of rows to be retrieved; creating a fixed-size order buffer to store a position number and the key of each row stored at the data buffer, wherein a number of elements in the order buffer is equal to the number of rows to be retrieved, and wherein the position number indicates a position of each row stored at the data buffer; creating an offset buffer to store the data offset and the key offset of each row stored at the data buffer, wherein each of the data buffer, the order buffer, and the offset buffer is entirely stored in a non disk-based memory; for each particular row of the table, wherein the particular row has a corresponding key: when the corresponding key of the particular row is less than a stored key of a last entry of the order buffer: replacing a row of the data buffer with the particular row; storing the data offset and the key offset associated with the particular row at the offset buffer; and reordering the order buffer based on a comparison of the key corresponding to the particular row to the key of each row stored at the data buffer, wherein the key of each row stored at the data buffer is located via the key offset corresponding to each row; and returning the rows stored in the data buffer in an order determined by the position numbers from the order buffer as the ordered number of rows of the data table.