Tracking and maintaining expression statistics across database queries
First Claim
1. A method comprising:
- maintaining, by a database server instance, an expression statistics store that includes metadata values for each expression of a plurality of expressions;
wherein each expression of the plurality of expressions, when evaluated by the database server instance, causes the database server instance to perform a corresponding operation using values from at least one column of a table in a database managed by the database server instance;
receiving, by the database server instance, a database query;
parsing, by the database server instance, the database query to identify expressions within the database query;
based on the parsing, identifying an occurrence of a particular expression within the database query;
in response to identifying the occurrence of the particular expression within the database query, the database server instance updating the expression statistics store to reflect the occurrence of the particular expression;
determining, from the metadata values maintained for the particular expression, a time-period-based cumulative cost for the particular expression;
wherein the time-period-based cumulative cost is determined, based at least in part, on a fixed cost per evaluation of the particular expression and on an evaluation count that tracks how many times the particular expression was evaluated;
based, at least in part, on the time-period-based cumulative cost for the particular expression, performing at least one of;
storing an evaluation result for the particular expression in an in-memory cache, and modifying an execution plan of a query that includes the particular expression to access the evaluation results in the in-memory cache rather than evaluate the particular expression;
rearranging an order in which expressions in a query that includes the particular expression are evaluated;
changing a level of compression applied to a column or database object referenced in the particular expression;
determining where to store a column or database object referenced in the particular expression;
ordetermining a format for storing a column or database object referenced in the particular expression.
1 Assignment
0 Petitions
Accused Products
Abstract
Techniques are described for maintaining an expression statistics store that stores and updates metadata values for query expressions based on the occurrence of those query expressions within queries. In an embodiment, a database server instance receives a database query. In response, the database server instance identifies expressions within the database queries. The database server instance then determines whether an expression statistics store includes an entry for the particular expression. Responsive to determining that the expression statistics store includes an entry for the particular expression, the database server instance updates at least one metadata value in the entry based on the occurrence of the particular expression. Responsive to determining that the expression statistics store does not include an entry for the particular expression, the database server instance adds an entry for the particular expression.
-
Citations
20 Claims
-
1. A method comprising:
-
maintaining, by a database server instance, an expression statistics store that includes metadata values for each expression of a plurality of expressions; wherein each expression of the plurality of expressions, when evaluated by the database server instance, causes the database server instance to perform a corresponding operation using values from at least one column of a table in a database managed by the database server instance; receiving, by the database server instance, a database query; parsing, by the database server instance, the database query to identify expressions within the database query; based on the parsing, identifying an occurrence of a particular expression within the database query; in response to identifying the occurrence of the particular expression within the database query, the database server instance updating the expression statistics store to reflect the occurrence of the particular expression; determining, from the metadata values maintained for the particular expression, a time-period-based cumulative cost for the particular expression; wherein the time-period-based cumulative cost is determined, based at least in part, on a fixed cost per evaluation of the particular expression and on an evaluation count that tracks how many times the particular expression was evaluated; based, at least in part, on the time-period-based cumulative cost for the particular expression, performing at least one of; storing an evaluation result for the particular expression in an in-memory cache, and modifying an execution plan of a query that includes the particular expression to access the evaluation results in the in-memory cache rather than evaluate the particular expression; rearranging an order in which expressions in a query that includes the particular expression are evaluated; changing a level of compression applied to a column or database object referenced in the particular expression; determining where to store a column or database object referenced in the particular expression;
ordetermining a format for storing a column or database object referenced in the particular expression. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12)
-
-
13. One or more non-transitory computer-readable media storing instructions which, when executed by one or more processors, cause:
-
maintaining, by a database server instance, an expression statistics store that includes metadata values for each expression of a plurality of expressions; wherein each expression of the plurality of expressions, when evaluated by the database server instance, causes the database server instance to perform a corresponding operation using values from at least one column of a table in a database managed by the database server instance; receiving, by the database server instance, a database query; parsing, by the database server instance, the database query to identify expressions within the database query; based on the parsing, identifying an occurrence of a particular expression within the database query; in response to identifying the occurrence of the particular expression within the database query, the database server instance updating the expression statistics store to reflect the occurrence of the particular expression; determining, from the metadata values maintained for the particular expression, a time-period-based cumulative cost for the particular expression; wherein the time-period-based cumulative cost is determined, based at least in part, on a fixed cost per evaluation of the particular expression and on an evaluation count that tracks how many times the particular expression was evaluated; based, at least in part, on the time-period-based cumulative cost for the particular expression, performing at least one of; storing an evaluation result for the particular expression in an in-memory cache, and modifying an execution plan of a query that includes the particular expression to access the evaluation results in the in-memory cache rather than evaluate the particular expression; rearranging an order in which expressions in a query that includes the particular expression are evaluated; changing a level of compression applied to a column or database object referenced in the particular expression; determining where to store a column or database object referenced in the particular expression;
ordetermining a format for storing a column or database object referenced in the particular expression. - View Dependent Claims (14, 15, 16, 17, 18, 19, 20)
-
Specification