Fast select for fetch first N rows with order by
Abstract
A method for fetching an ordered first N rows of a table, includes: reading a row in the table; determining that the read row qualifies as the first N rows of the table for rows read so far, and storing data of the read row; and determining an order of data of qualifying rows and storing the order. Only data in rows that qualify to be among the first N rows are ordered and stored. This provides a significantly more efficient processing. It eliminates tournament tree sorts, corresponding work file read and write I/O's, and associated CPU time. This reduces the time for the running of a query and improves the performance of other applications sharing the use of work files. Further, the improved performance is particular significant when the buffer sizes are within a page of records or rows, although multiple pages may be used.
Interactive Citation Constellation Global Citation Ranking
Interactive SVG Citation Constellation renders in Rust/WebAssembly. Prior art cited: 12 · Forward citations: 3.
Claims (1 — 1 Independent, 0 Dependent)
- Claim 1Independent 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
Technical Overview & Description
Full multi-page specification text is archived at the issuing office. Read complete official specification ↗
Cited By — Indexed Forward Citations (3 of 3 total)
References Cited — Backward Prior Art (12)
Non-Patent Literature (1)
- Skeina, The Algorthm Design Manual, Jun. 2, 1997, pp. 1-4.