Patent ID: 9747338
Date: 2017-08-29
CPC Classifications: G06F

Claim:
1. A method for optimizing a multi-index database access at runtime, the method comprising: receiving, by one or more processors, a query that includes at least one predicate that is associated with a key to an index to a table; determining, by the one or more processors, a plan to satisfy the query and a record identifier (RID) results threshold for the plan, wherein i) the plan includes an access to the index and ii) wherein the RID results threshold is adaptively changed during execution of the plan based, at least in part, on an estimation of the size of the table; determining, by the one or more processors, a static risk threshold; determining, by the one or more processors, a static risk for the access; responsive to the static risk for the access exceeding the static risk threshold, determining, by the one or more processors, a risk bound for the access based, at least in part, on analyzing statistics on the index, wherein the statistics on the index include an estimate of at least one of i) a number of entries in the index, and ii) a greatest number of a same value in the index; responsive to the static risk for the access exceeding the static risk threshold, linking, by the one or more processors, the access to the risk bound; executing, by the one or more processors, the access to the index with the key; responsive to the access being linked to a risk bound, determining, by the one or more processors, a dynamic risk for the access during execution of the access; responsive to the access being linked to a risk bound, aborting, by the one or more processors, the access during the execution of the plan, wherein aborting the access during the execution plan includes, but is not limited to, performing a table scan of the table; receiving, by the one or more processors, one or more RID results during the execution of the plan; and responsive to the one or more RID results being less than the RID results threshold, aborting, by the one or more processors, the execution of the plan.