Query processing for disk based hybrid transactional analytical processing system
A method for processing a query may include receiving a query associated with one or more predicate columns and one or more aggregate columns. To respond to the query, one or more partial data pages including the one or more predicate columns but not the one or more aggregate columns may be loaded from disk to memory. For each partial data page, a first value occupying the one or more predicate columns may be evaluated to identify one or more rows satisfying a predicate associated with the query. A portion of a data page containing the aggregate columns may be loaded from disk into memory. A result of the query corresponding to a second value occupying the aggregate columns may be generated based on the portion of the data page loaded in the memory. Related systems and articles of manufacture are also provided.
1. A system, comprising:
at least one data processor; and
at least one memory storing instructions which, when executed by the at least one data processor, cause operations comprising:
receiving a query comprising an analytical processing query operating on one or more predicate columns and one or more aggregate columns;
responding to the query by at least loading, from a disk into a first cache of memory, one or more partial data pages corresponding to the one or more predicate columns but not the one or more aggregate columns, the memory further including a second cache for storing full data pages, the loading of the one or more partial data pages into the first cache evicting one or more other partial data pages from the first cache but not one or more full data pages from the second cache;
evaluating, for each of the one or more partial data pages, a first value occupying the one or more predicate columns to identify one or more rows satisfying a predicate associated with the query;
loading, from the disk into the first cache of the memory, a first portion of a data page containing the one or more aggregate columns but not a second portion of the data page not containing the one or more aggregate columns, the loading of the first portion of the data page into the first cache evicting another partial data page from the first cache but not a full data page from the second cache; and
generating, based at least on the first portion of the data page loaded in the memory, a result of the query corresponding to a second value occupying the one or more aggregate columns.
2. The system of claim 1 , further comprising:
identifying, based at least on an identifier of the one or rows satisfying the predicate, the data page as containing the one or more rows.
3. The system of claim 1 , further comprising:
updating a data structure to indicate that the first portion of the data page has been loaded into the first cache; and
in response to the data structure indicating that the data page has been loaded into the first cache in its entirety, transferring the data page from the first cache to the second cache.
4. The system of claim 1 , further comprising:
in response to loading the first portion of the data page into the memory, applying one or more cache replacement policies to evict another partial data page from the first cache.
5. The system of claim 4 , wherein the one or more cache replacement policies include a least recently used (LRU) policy and a least frequently used (LFU) policy.
6. The system of claim 1 , wherein each partial data page includes some but not all of the rows included in a database table.
7. The system of claim 1 , further comprising:
performing one or more input output (IO) operations to access the first portion of the data page stored in the disk, the one or more input output operations being performed asynchronously by executing one or more coroutines.
8. The system of claim 1 , wherein the one or more rows are identified by at least filtering the one or more predicate columns based at least on whether the first value occupying the one or more predicate columns satisfies the predicate.
9. The system of claim 1 , wherein the result of the query is determined by applying, to the second value occupying the one or more aggregate columns, one or more operations including a drill up operation, a drill down operation, a slice and dice operation, an aggregation operation, a sort operation, a calculate key figures operation, and a hierarchy operation.
10. The system of claim 1 , further comprising:
determining, based at least on a metadata associated with the data page, to load the first portion of the data page, the metadata being stored on a metadata page in the disk, and the metadata includes a byte range on the data page at which the one or more columns of data are stored.
11. The system of claim 1 , further comprising:
generating a data structure identifying one or more portions of the data page required for responding to the query, the data structure including a first value for each portion of the data page required for responding to the query and a second value for each portion of the data page not required for responding to the query.
12. A computer-implemented method, comprising:
receiving a query comprising an analytical processing query operating on one or more predicate columns and one or more aggregate columns;
responding to the query by at least loading, from a disk into a first cache of memory, one or more partial data pages corresponding to the one or more predicate columns but not the one or more aggregate columns, the memory further including a second cache for storing full data pages, the loading of the one or more partial data pages into the first cache evicting one or more other partial data pages from the first cache but not one or more full data pages from the second cache;
evaluating, for each of the one or more partial data pages, a first value occupying the one or more predicate columns to identify one or more rows satisfying a predicate associated with the query;
loading, from the disk into the first cache of the memory, a first portion of a data page containing the one or more aggregate columns but not a second portion of the data page not containing the one or more aggregate columns, the loading of the first portion of the data page into the first cache evicting another partial data page from the first cache but not a full data page from the second cache; and
generating, based at least on the first portion of the data page loaded in the memory, a result of the query corresponding to a second value occupying the one or more aggregate columns.
13. The method of claim 12 , further comprising:
identifying, based at least on an identifier of the one or rows satisfying the predicate, the data page as containing the one or more rows.
14. A non-transitory computer readable medium storing instructions, which when executed by at least one data processor, result in operations comprising:
receiving a query comprising an analytical processing query operating on one or more predicate columns and one or more aggregate columns;
responding to the query by at least loading, from a disk into a first cache of memory, one or more partial data pages corresponding to the one or more predicate columns but not the one or more aggregate columns, the memory further including a second cache for storing full data pages, the loading of the one or more partial data pages into the first cache evicting one or more other partial data pages from the first cache but not one or more full data pages from the second cache;
evaluating, for each of the one or more partial data pages, a first value occupying the one or more predicate columns to identify one or more rows satisfying a predicate associated with the query;
loading, from the disk into the first cache of the memory, a first portion of a data page containing the one or more aggregate columns but not a second portion of the data page not containing the one or more aggregate columns, the loading of the first portion of the data page into the first cache evicting another partial data page from the first cache but not a full data page from the second cache; and
generating, based at least on the first portion of the data page loaded in the memory, a result of the query corresponding to a second value occupying the one or more aggregate columns.