Automatic detection of frequently used query patterns in a query workload
First Claim
1. A method for recording data comprising:
- receiving a plurality of queries;
obtaining at least one sub-expression for each query;
identifying duplicate occurrences of each sub-expression in the queries;
determining occurrence statistics on each sub-expression; and
maintaining a stored representation of the occurrence statistics for each sub-expression.
2 Assignments
0 Petitions
Accused Products
Abstract
In the course of an optimization, a query can be broken down into its sub-expressions. Materialized views may be substituted for the sub-expressions during query optimization. Encoded sub-expressions are generated and used in the comparison with stored materialized views. Instead of discarding the encoding of a query'"'"'s sub-expression if no matching materialization is found, the encoding is stored. If subsequently submitted queries contain the same sub-expression, a view matching mechanism will find the previously stored encoding. Because no materialization is associated with this expression, the view is not substituted. However, usage statistics counters are updated; e.g., a counter is incremented indicating that the sub-expression was found in another query. Because view matching is applied to the sub-expression that are candidates for being materialized, the statistics accurately reflect which are the most frequently occurring candidate sub-expressions in a workload. Users can view and analyze the types and frequencies of sub-expressions found in a workload by querying a system table or virtual table. The table provides an accurate, up-to-date workload synopsis without requiring additional tools or incurring the overhead of client-side tools.
78 Citations
35 Claims
-
1. A method for recording data comprising:
-
receiving a plurality of queries;
obtaining at least one sub-expression for each query;
identifying duplicate occurrences of each sub-expression in the queries;
determining occurrence statistics on each sub-expression; and
maintaining a stored representation of the occurrence statistics for each sub-expression. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17)
-
-
18. A method for maintaining data related to a query, comprising:
-
receiving a query;
determining a sub-expression of the query;
determining if the sub-expression matches any previously stored materialized view of a plurality of previously stored materialized views;
substituting the matching previously stored materialized view for the sub-expression in the query, if the sub-expression matches the previously stored materialized view;
storing the sub-expression in a storage device, if the sub-expression fails to match any of the previously stored materialized views. - View Dependent Claims (19, 20, 21, 22, 23, 24, 25, 26)
-
-
27. A computer system comprising:
-
a data store comprising a plurality of materialized views; and
a processor for receiving a sub-expression of a query, determining if the sub-expression matches any of the materialized views, substituting the matching materialized view for the sub-expression in the query if the sub-expression matches the materialized view, and storing the sub-expression in a storage device if the sub-expression fails to match any of the materialized views. - View Dependent Claims (28, 29, 30, 31, 32, 33, 34, 35)
-
Specification