Query data splitting
AssigneeRed Hat, Inc.
InventorsFilip Nguyen, Filip Eliá{hacek over (s)}
Life of this patent
Estimating the term…
Abstract
Implementations for query data splitting are disclosed. In one example, the method includes receiving, by a processing device, a first query and a second query, determining that the second query is a subset of the first query, determining a first set of attributes associated with the first query and a second set of attributes associated with the second query, and determining, by the processing device, whether to submit the second query or the first query to a database in view of the first set of attributes and the second set of attributes.
Claims16
A method comprising:
- receiving, by a processing device, a first query and a second query;
- determining that the second query is a subset of the first query based on a query tree, wherein the query tree comprises nodes representing queries received by the processing device and relationships between the queries, wherein the query tree comprises statistics from execution of the queries, wherein the first query is to select data from a first set of columns from a first set of tables of a relational database management system (RDBMS), and wherein the second query is to select data from at least a subset of the first set of columns from at least a subset of the first set of tables of the RDBMS;
- determining a first set of conditions associated with the first query and a second set of conditions associated with the second query;
- determining that the second query is a subset of the first query when the second set of tables is equal to or is a subset of the first set of tables, and when the second set of columns is equal to or is a subset of the first set of columns, and when each condition in the second set of conditions is included in the first set of conditions;
- determining, by the processing device, whether a cache stores a copy of first results from the first query;
- in response to the cache storing the copy of the first results from the first query, running the second query on the copy of the first results stored in the cache;
- in response to the cache not storing the copy of the first results from the first query:
- determining first statistics associated with the first query and second statistics associated with the second query, wherein the first statistics is based on a first frequency and first size of the first result from the first query, and the second statistic is based on a second frequency and second size of a second result from the second query;
- comparing the first statistics with the second statistics to determine one or more operations for obtaining the second result of the second query;
- in response the first statistics exceeding the second statistics, determining that the one or more operations for obtaining the second result of the second query include submitting the second query to the RDBMS over the network;
- and
- in response to the second statistics exceeding the first statistics, determining that the one or more operations for obtaining the second result of the second query include submitting the first query to the RDBMS over the network, storing the copy of the first results from the first query in the cache, and running the second query on the copy of the first results stored in the cache.
An apparatus comprising:
- a memory;
- and
- a processing device operatively coupled to the memory, the processing device to:
- receive a first query and a second query;
- determine that the second query is a subset of the first query based on a query tree, wherein the query tree comprises nodes representing queries received by the processing device and relationships between the queries, wherein the query tree comprises statistics from execution of the queries, wherein the first query is to select data from a first set of columns from a first set of tables of a relational database management system (RDBMS), and wherein the second query is to select data from at least a subset of the first set of columns from at least a subset of the first set of tables of the RDBMS;
- determine a first set of conditions associated with the first query and a second set of conditions associated with the second query;
- determine that the second query is a subset of the first query when the second set of tables is equal to or is a subset of the first set of tables, and when the second set of columns is equal to or is a subset of the first set of columns, and when each condition in the second set of conditions is included in the first set of conditions;
- determine whether a cache in the memory stores a copy of first results from the first query;
- run the second query on the copy of the first results stored in the cache in response to the cache storing the copy of the first results from the first query;
- in response to the cache not storing the copy of the first results from the first query:
- determine first statistics associated with the first query and second statistics associated with the second query, wherein the first statistics is based on a first frequency and first size of the first result from the first query, and the second statistic is based on a second frequency and second size of a second result from the second query;
- compare the first statistics with the second statistics to determine one or more operations for obtaining the second result of the second query;
- in response the first statistics exceeding the second statistics, determine that the one or more operations for obtaining the second result of the second query include submitting the second query to the RDBMS over the network;
- and
- in response to the second statistics exceeding the first statistics, determine that the one or more operations for obtaining the second result of the second query include submitting the first query to the RDBMS over the network, store the copy of the first results from the first query in the cache, and run the second query on the copy of the first results stored in the cache.
A non-transitory computer readable storage medium including instructions that, when executed by a processing device, cause the processing device to:
- receive a first query and a second query;
- determine that the second query is a subset of the first query based on a query tree, wherein the query tree comprises nodes representing queries received by the processing device and relationships between the queries, wherein the query tree comprises statistics from execution of the queries, wherein the first query is to select data from a first set of columns from a first set of tables of a relational database management system (RDBMS), and wherein the second query is to select data from at least a subset of the first set of columns from at least a subset of the first set of tables of the RDBMS;
- determine a first set of conditions associated with the first query and a second set of conditions associated with the second query;
- determine that the second query is a subset of the first query when the second set of tables is equal to or is a subset of the first set of tables, and when the second set of columns is equal to or is a subset of the first set of columns, and when each condition in the second set of conditions is included in the first set of conditions;
- determine whether a cache stores a copy of first results from the first query;
- in response to the cache storing the copy of the first results from the first query, run the second query on the copy of the first results stored in the cache;
- in response the cache not storing the copy of the first results from the first query:
- determine first statistics associated with the first query and second statistics associated with the second query, wherein the first statistics is based on a first frequency and first size of the first result from the first query, and the second statistic is based on a second frequency and second size of a second result from the second query;
- compare the first statistics with the second statistics to determine one or more operations for obtaining the second result of the second query with efficient use of resources;
- in response the first statistics exceeding the second statistics, determine that the one or more operations for obtaining the second result of the second query with efficient use of resources include submitting the second query to the RDBMS over the network without submitting the first query to the RDBMS over the network;
- and
- in response to the second statistics exceeding the first statistics, determine that the one or more operations for obtaining the second result of the second query with efficient use of resources include submitting the first query to the RDBMS over the network, store the copy of the first results from the first query in the cache, and run the second query on the copy of the first results stored in the cache.
Dependencies are inferred from the claim text.