Patent ID: 7689550

Claim:
A method comprising: while a particular cursor is in a first state, performing the steps of: determining, using a first cursor sharing technique, whether the particular cursor that was created for a particular query should be used to execute one or more queries; in response to determining that the particular cursor should be used to execute the one or more queries, using the particular cursor to execute the one or more queries; in response to determining that the particular cursor should not be used to execute the one or more queries, executing the one or more queries without using the particular cursor; generating statistics that reflect suitability of using the first cursor sharing technique to execute queries that are semantically-equivalent to the particular query; after executing the one or more queries and generating the statistics, determining whether the statistics indicate that the first cursor sharing technique is suitable to use to execute queries that are semantically-equivalent to the particular query; in response to determining that the statistics indicate that the first cursor sharing technique is not suitable to use to execute queries that are semantically-equivalent to the particular query, changing the state of the particular cursor from the first state to a second state that is different than the first state; and while the particular cursor is in the second state, using a second cursor sharing technique to determine whether to use the particular cursor to execute a subsequently-received query; wherein the first cursor sharing technique is one of a first technique or a second technique; wherein the second cursor sharing technique is the other of the first technique and the second technique.