Optimization of queries using retrieval status of resources used thereby
First Claim
Patent Images
1. A method of optimizing a database query, the method comprising:
- determining a retrieval status for a resource used by the database query, wherein determining the retrieval status includes determining a percentage of the resource that is resident in a working memory;
generating an access plan for the database query using the determined retrieval status for the resource, wherein generating the access plan includes;
generating a plurality of alternate access plans;
calculating a cost for each alternate access plan using the determined retrieval status for the resource; and
selecting one of the alternate access plans based upon the calculated costs for each alternate access plan;
storing the access plan, including associating with the stored access plan a retrieval status assumption for the stored access plan, the retrieval status assumption representing the determined retrieval status used to generate the access plan; and
in response to a request to execute the stored access plan;
determining a current retrieval status for the resource, wherein determining the current retrieval status includes determining a percentage of the resource that is currently resident in the working memory;
comparing the current retrieval status with the retrieval status assumption; and
selectively generating another access plan for the database query using the current retrieval status based upon the comparison of the current retrieval status with the retrieval status assumption.
3 Assignments
0 Petitions
Accused Products
Abstract
An apparatus, program product and method utilize the retrieval status of a resource to generate an access plan for a database query that uses the resource. The retrieval status, which indicates, for example, what percentage of a given resource is already stored in working memory, and thus need not be separately retrieved during query execution, may be used to generate more accurate input/output cost estimates for access plans, and thus enable a query optimizer to better select an access plan that is optimal under given runtime conditions.
-
Citations
20 Claims
-
1. A method of optimizing a database query, the method comprising:
-
determining a retrieval status for a resource used by the database query, wherein determining the retrieval status includes determining a percentage of the resource that is resident in a working memory; generating an access plan for the database query using the determined retrieval status for the resource, wherein generating the access plan includes; generating a plurality of alternate access plans; calculating a cost for each alternate access plan using the determined retrieval status for the resource; and selecting one of the alternate access plans based upon the calculated costs for each alternate access plan; storing the access plan, including associating with the stored access plan a retrieval status assumption for the stored access plan, the retrieval status assumption representing the determined retrieval status used to generate the access plan; and in response to a request to execute the stored access plan; determining a current retrieval status for the resource, wherein determining the current retrieval status includes determining a percentage of the resource that is currently resident in the working memory; comparing the current retrieval status with the retrieval status assumption; and selectively generating another access plan for the database query using the current retrieval status based upon the comparison of the current retrieval status with the retrieval status assumption. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8, 9, 10)
-
-
11. An apparatus, comprising:
-
at least one processor; a memory that includes a working memory; a resource manager; and program code resident in the memory and configured to be executed by the at least one processor to optimize a database query by determining a retrieval status for a resource used by the database query, and generating an access plan for the database query using the determined retrieval status for the resource, wherein the program code is configured to determine the retrieval status by accessing the resource manager to obtain the retrieval status of the resource, wherein the resource manager is configured to track a percentage of the resource that is in the working memory, and wherein the resource manager is further configured to store the percentage of the resource that is in working memory in a header of a persistent copy of the resource. - View Dependent Claims (12, 13, 14, 15, 16, 17, 18, 19, 20)
-
Specification