Detecting and processing cache hits for queries with aggregates
First Claim
1. A computer-readable program code embedded in a memory, wherein when a computer system executes the computer-readable program code embedded in the memory to perform a method for supporting query caching, the method comprising:
- determining a list of candidate queries from a plurality of queries that are stored in a cache in response to receiving a new query, wherein the list comprises a subset of the plurality of queries, wherein the subset is less than all of the plurality of queries, and wherein the determining comprisesfor each item in a select list of the new query, obtaining a set of cached queries that include the each item in the select list,for the each item in the select list of the new query without an exact match in the select list of at least one cached query, obtaining a set of cached queries using aggregate rewrite, andforming the list of candidate queries by intersecting the set of cached queries for the each item in the select list of the new query and the set of cached queries for the each item in the select list of the new query without an exact match in the select list of the at least one cached query;
evaluating each of the candidate queries in the list to determine one candidate query that is a cache hit, the cache hit indicating a stored result of the one candidate query which answers the new query, wherein the evaluating is performed using a set of rules that allows for inexact matches between one or more aggregates included in the new query and one or more aggregates included in the candidate queries in the list;
generating a result for the new query using the stored result for the one candidate query; and
storing the result of the new query.
2 Assignments
0 Petitions
Accused Products
Abstract
Techniques to improve query caching performance by efficiently selecting queries stored in a cache for evaluation and increasing the cache hit rate by allowing for inexact matches. A list of candidate queries stored in the cache that potentially could be used to answer a new query is first determined. This list may include all cached queries, cached queries containing exact matches for select list items, or cached queries containing exact and/or inexact matches. Each of at least one candidate query is then evaluated to determine whether or not there is a cache hit, which indicates that the candidate query could be used to answer the new query. The evaluation is performed using a set of rules that allows for inexact matches of aggregates, if any, in the new query. A query plan is generated for the new query based on a specific candidate query with a cache hit.
-
Citations
21 Claims
-
1. A computer-readable program code embedded in a memory, wherein when a computer system executes the computer-readable program code embedded in the memory to perform a method for supporting query caching, the method comprising:
-
determining a list of candidate queries from a plurality of queries that are stored in a cache in response to receiving a new query, wherein the list comprises a subset of the plurality of queries, wherein the subset is less than all of the plurality of queries, and wherein the determining comprises for each item in a select list of the new query, obtaining a set of cached queries that include the each item in the select list, for the each item in the select list of the new query without an exact match in the select list of at least one cached query, obtaining a set of cached queries using aggregate rewrite, and forming the list of candidate queries by intersecting the set of cached queries for the each item in the select list of the new query and the set of cached queries for the each item in the select list of the new query without an exact match in the select list of the at least one cached query; evaluating each of the candidate queries in the list to determine one candidate query that is a cache hit, the cache hit indicating a stored result of the one candidate query which answers the new query, wherein the evaluating is performed using a set of rules that allows for inexact matches between one or more aggregates included in the new query and one or more aggregates included in the candidate queries in the list; generating a result for the new query using the stored result for the one candidate query; and storing the result of the new query. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19)
-
-
20. In a computer system, a method comprising:
-
determining a list of at least two candidate queries from a plurality of queries stored in a cache in response to receiving a new query, wherein the list comprises a subset of the plurality of queries, wherein the subset is less than all of the plurality of queries, and wherein the determining comprises for each item in a select list of the new query, obtaining a set of cached queries that include the each item in the select list, for the each item in the select list of the new query without an exact match in the select list of at least one cached query, obtaining a set of cached queries using aggregate rewrite, and forming the list of candidate queries by intersecting the set of cached queries for the each item in the select list of the new query and the set of cached queries for the each item in the select list of the new query without an exact match in the select list of the at least one cached query; evaluating each of the candidate queries in the list to determine one candidate query that is a cache hit, the cache hit indicating a stored result of the one candidate query which answers the new query, wherein the evaluating is performed using a set of rules to allow for inexact matches between one or more aggregates included in the new query and one or more aggregates in the one candidate query; generating a result for the new query using the stored result of the one candidate query; and storing the result of the new query. - View Dependent Claims (21)
-
Specification