Query execution system with plan reuse
AssigneeSap SE
InventorsChristian Bensberg, Johannes Merx
Life of this patent
Estimating the term…
Abstract
System, method, and various embodiments for a query execution system with plan reuse are described herein. An embodiment operates by receiving a query on a database, the received query comprising one or more constants. Normalization is performed on the query, replacing the one or more constants with a variable-indicator. The normalized query is compared to one or more previously executed queries to identify a matching query. A matching execution plan corresponding to the matching query is selected. The matching execution plan is executed, for which the one or more constants are provided as runtime variables. A result from the execution of the matching execution plan is generated and returned.
Claims20
A computer-implemented method comprising:
- receiving a query on a database, the query comprising one or more first constants;
- performing normalization on the query to generate a normalized query, the normalization comprising replacing the one or more first constants with a variable-indicator;
- comparing the normalized query to one or more previously generated normalized queries to identify a matching query of the one or more previously generated normalized queries, wherein the matching query corresponds to a previously received query comprising one or more second constants;
- selecting a matching execution plan of one or more previously saved execution plans, based on the matching execution plan corresponding to the matching query, wherein each of the one or more previously saved execution plans is pre-compiled;
- executing the matching execution plan, for the query, on the database, wherein the executing comprises providing the one or more first constants as runtime variables;
- generating a result from the execution of the matching execution plan;
- and
- returning the result as a result of the query.
A system comprising:
- a memory;
- and
- at least one processor coupled to the memory and configured to perform operations comprising:
- receiving a query on a database, the query comprising one or more first constants;
- performing normalization on the query to generate a normalized query, the normalization comprising replacing the one or more first constants with a variable-indicator;
- comparing the normalized query to one or more previously generated normalized queries to identify a matching query of the one or more previously generated normalized queries, wherein the matching query corresponds to a previously received query comprising one or more second constants;
- selecting a matching execution plan of one or more previously saved execution plans, based on the matching execution plan corresponding to the matching query, wherein each of the one or more previously saved execution plans is pre-compiled;
- executing the matching execution plan, for the query, on the database, wherein the executing comprises providing the one or more first constants as runtime variables;
- generating a result from the execution of the matching execution plan;
- and
- returning the result as a result of the query.
A non-transitory computer-readable medium having instructions stored thereon that, when executed by at least one computing device, cause the at least one computing device to perform operations comprising:
- receiving a query on a database, the query comprising one or more first constants;
- performing normalization on the query to generate a normalized query, the normalization comprising replacing the one or more first constants with a variable-indicator;
- comparing the normalized query to one or more previously generated normalized queries to identify a matching query of the one or more previously generated normalized queries, wherein the matching query corresponds to a previously received query comprising one or more second constants;
- selecting a matching execution plan of one or more previously saved execution plans, based on the matching execution plan corresponding to the matching query, wherein each of the one or more previously saved execution plans is pre-compiled;
- executing the matching execution plan, for the query, on the database, wherein the executing comprises providing the one or more first constants as runtime variables;
- generating a result from the execution of the matching execution plan;
- and
- returning the result as a result of the query.
Dependencies are inferred from the claim text.