Patent ID: 9697251
Date: 2017-07-04
CPC Classifications: G06F

Claim:
1. A computer-implemented method for determining a query execution plan based on transaction state, comprising: determining, by a computing device, that a first set of database values in a database table are in a committed transaction state and that a second set of database values in the database table are in an uncommitted transaction state, wherein the determining includes reading a first set of column values and second set of column values of a plurality of columns within one or more index objects, the first set of column values specifying that the first set of database values are in a committed transaction state, and the second set of column values specifying that the second set of database values are in an uncommitted transactions state; in response to the determining, generating, by the computing device, a first set of statistics for the first set of database values and generating a second set of statistics for the second set of database values, the first and second set of statistics for use in determining a query execution plan, wherein the first set of statistics and the second set of statistics include: histogram statistics, cardinality statistics, frequent value list statistics, and selectivity statistics; receiving, by the computing device, a first query request to access a first set of database records that includes one or more of the first set of database values and one or more of the second set of database values; determining, by the computing device, that a first isolation level allows a read of the first and second set of database values, wherein the isolation level determines whether database values in an uncommitted transaction state and database values in a committed transaction state can both be accessed for a particular query request; in response to the determining that a first isolation level allows a read of the first and second set of database values, using, by the computing device, one or more of the first set of statistics and one or more of the second set of statistics to determine a first query execution plan for accessing the first set of database records; receiving, by the computing device, a second request to modify a second set of database records that includes at least one of the first set of database values and at least one of the second set of database values; determining, by the computing device and for the second request, that a second isolation level only allows a modification of the first set of database values but not a modification of the second set of database values; using, by the computing device and for the second request, at least one of the first set of statistics for the at least one of the first set of database values to determine a second query execution plan, wherein the second set of statistics for the second set of database values are not used; changing, by the computing device, the uncommitted transaction state of the at least one of the second set of database values to a committed transaction state; in response to the changing, updating, by the computing device, the at least one of the first set of statistics by generating a third set of statistics and updating at least one of the second set of statistics by generating a fourth set of statistics; receiving, by the computing device, a third request to modify the second set of database records; determining, by the computing device and for the third request, that a third isolation level allows a modification of the first set of database values and the at least one of the second set of database values that have been changed to the committed transaction state; and using, by the computing device, the third and fourth set of statistics to change the second query execution plan to a third query execution plan.