AUTOMATICALLY DETERMINING OPTIMIZATION FREQUENCIES OF QUERIES WITH PARAMETER MARKERS
First Claim
1. A computer-implemented method of automatically determining an optimization frequency of a query having one or more parameter markers, said method comprising:
- generating, by a computing system, a plurality of query execution plans for an execution of a query having one or more parameter markers, each query execution plan associated with one or more bind value sets of a plurality of bind values sets;
determining that no difference of a plurality of differences between pairs of execution costs exceeds a predefined threshold value or that at least one difference of said plurality of differences exceeds said predefined threshold value, each pair of execution costs including a first execution cost and a second execution cost, said first execution cost being a cost of executing said query with a bind value set of said plurality of bind value sets via a first query execution plan of said plurality of query execution plans and said second execution cost being a cost of optimally executing said query with said bind value set via a second query execution plan of said plurality of query execution plans;
automatically selecting an optimization frequency by said computing system; and
storing said optimization frequency in a computer-usable medium,wherein said optimization frequency is optimizing said query once as a result of a first determination by said determining that no difference of said plurality of differences exceeds said predefined threshold value, andwherein said optimization frequency is reoptimizing said query each time said query is executed as a result of a second determination by said determining that at least one difference of said plurality of differences exceeds said predefined threshold value.
0 Assignments
0 Petitions
Accused Products
Abstract
A method and system for automatically determining optimization frequencies of queries having one or more parameter markers. Execution plans for a query are generated and each plan is associated with one or more bind value sets. An optimization frequency is selected based on differences between pairs of execution costs where one execution cost of a pair is a cost of executing the query with a bind value set via a first execution plan and the other execution cost of the pair is a cost of optimally executing the query with the bind value set via a second execution plan. The differences are based on maximum selectivity or cardinality distances associated with the bind value sets. If none of the differences exceeds a predefined value, the query is optimized once. If at least one of the differences exceeds the predefined value, the query is reoptimized each time the query is executed.
52 Citations
20 Claims
-
1. A computer-implemented method of automatically determining an optimization frequency of a query having one or more parameter markers, said method comprising:
-
generating, by a computing system, a plurality of query execution plans for an execution of a query having one or more parameter markers, each query execution plan associated with one or more bind value sets of a plurality of bind values sets; determining that no difference of a plurality of differences between pairs of execution costs exceeds a predefined threshold value or that at least one difference of said plurality of differences exceeds said predefined threshold value, each pair of execution costs including a first execution cost and a second execution cost, said first execution cost being a cost of executing said query with a bind value set of said plurality of bind value sets via a first query execution plan of said plurality of query execution plans and said second execution cost being a cost of optimally executing said query with said bind value set via a second query execution plan of said plurality of query execution plans; automatically selecting an optimization frequency by said computing system; and storing said optimization frequency in a computer-usable medium, wherein said optimization frequency is optimizing said query once as a result of a first determination by said determining that no difference of said plurality of differences exceeds said predefined threshold value, and wherein said optimization frequency is reoptimizing said query each time said query is executed as a result of a second determination by said determining that at least one difference of said plurality of differences exceeds said predefined threshold value. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8)
-
-
9. A computing system comprising a processor coupled to a computer-readable memory unit, said memory unit comprising a software application and instructions that when executed by said processor implement a method of automatically determining an optimization frequency of a query having one or more parameter markers, said method comprising:
-
generating, by a computing system, a plurality of query execution plans for an execution of a query having one or more parameter markers, each query execution plan associated with one or more bind value sets of a plurality of bind values sets; determining that no difference of a plurality of differences between pairs of execution costs exceeds a predefined threshold value or that at least one difference of said plurality of differences exceeds said predefined threshold value, each pair of execution costs including a first execution cost and a second execution cost, said first execution cost being a cost of executing said query with a bind value set of said plurality of bind value sets via a first query execution plan of said plurality of query execution plans and said second execution cost being a cost of optimally executing said query with said bind value set via a second query execution plan of said plurality of query execution plans; automatically selecting an optimization frequency by said computing system; and storing said optimization frequency in a computer-usable medium, wherein said optimization frequency is optimizing said query once as a result of a first determination by said determining that no difference of said plurality of differences exceeds said predefined threshold value, and wherein said optimization frequency is reoptimizing said query each time said query is executed as a result of a second determination by said determining that at least one difference of said plurality of differences exceeds said predefined threshold value. - View Dependent Claims (10, 11, 12, 13, 14, 15)
-
-
16. A computer-implemented method of determining an optimization frequency of a query having one or more parameter markers, said method comprising:
-
obtaining, by a computing system, a plurality of bind value sets, each bind value set including one or more bind values and associated with one or more parameter markers of a query; obtaining, by said computing system, a plurality of measurement sets associated with said bind value sets in a one-to-one correspondence, each measurement set selected from the group consisting of one or more selectivity measurements and one or more cardinality measurements; determining, by said computing system, a plurality of query execution plans, each query execution plan capable of optimally executing said query with one or more bind value sets of said plurality of bind value sets; determining, by said computing system, a first set of execution costs associated with said query execution plans of said plurality of query execution plans in a one-to-one correspondence, each execution cost of said first set being a cost of optimally executing said query with a bind value set of said plurality of bind value sets; determining, by said computing system, one or more pairs of bind value sets (p1, . . . , pn)i, (q1, . . . , qn)i of said plurality of bind value sets, said determining said one or more pairs of bind value sets including determining one or more distances di between a first measurement set S1i associated with said bind value set (p1, . . . , pn)i and a second measurement set S2i associated with said (q1, . . . , qn)i, said S1i and said S2i included in said plurality of measurement sets, wherein each distance di is a maximum distance between any pair of measurement sets associated with query execution plans Pi and Qi of said plurality of query execution plans, wherein said query execution plan Pi is an optimal query execution plan associated with said bind value set (p1, . . . , pn)i and said query execution plan Qi is an optimal query execution plan associated with said bind value set (q1, . . . , qn)i, and wherein said i≧
1;determining, by said computing system, one or more pairs of execution costs C1i, C2i of a second set of execution costs, wherein said C1i is a cost of executing said query via said query execution plan Pi with bind value set (q1, . . . , qn)i and said C2i is a cost of executing said query via said query execution plan Qi with bind value set (p1, . . . , pn)i; determining, by said computing system, one or more pairs of differences D1i and D2i, wherein said D1i is a difference between said cost C1i and an optimal execution cost OC1i of said first set of execution costs and said D2i is a difference between said cost C2i and an optimal execution cost OC2i of said first set of execution costs, wherein said OC1i is a cost of optimally executing said query via said query execution plan Qi with bind value set (q1, . . . , qn)i, and said OC2i is a cost of optimally executing said query via said query execution plan Pi with bind value set (p1, . . . , pn)i; automatically selecting, by said computing system, an optimization frequency, wherein said optimization frequency is selected from the group consisting of optimizing said query once and reoptimizing said query each time said query is executed; and storing said optimization frequency in a computer-usable medium, wherein said optimization frequency is said optimizing said query once as a result of a first determination, via said determining said one or more pairs of differences, that no difference of said one or more pairs of differences exceeds a predefined threshold value, and wherein said optimization frequency is said reoptimizing said query each time said query is executed as a result of a second determination, via said determining said one or more pairs of differences, that at least one difference of said one or more pairs of differences exceeds said predefined threshold value. - View Dependent Claims (17, 18, 19, 20)
-
Specification