Adaptive query cursor management
First Claim
1. A computer-readable storage medium containing computer program code that, when executed by operation of one or more computer processors, performs an operation comprising:
- collecting usage metrics for each of a plurality of database cursors, wherein the usage metrics further comprise a number of other database cursors that are associated with a job with which each respective database cursor is associated;
calculating a cost of each respective database cursor based on the collected usage metrics, wherein the cost describes an estimated amount of time to rebuild the respective database cursor, if closed, relative to an average runtime of the respective database cursor, and wherein the cost is calculated further based on at least one of;
(a) a size in memory of each respective database cursor, and (b) an amount of resources that are required when each respective database cursor is used;
upon determining that a database cursor threshold has been exceeded, wherein the database cursor threshold defines the maximum number of database cursors that are permitted to be open at a time;
selecting, based on the calculated costs, a database cursor of the plurality of database cursors; and
closing the selected cursor.
1 Assignment
0 Petitions
Accused Products
Abstract
Techniques are provided for managing a database cursor threshold. One embodiment provides a method that includes setting a database cursor threshold, for a first database job of a plurality of database jobs, to a first value. Generally, the cursor threshold defines the maximum number of database cursors that are permitted to be open at a time in a database system. One or more system resources of the database system are monitored, and upon detecting that a current state of the one or more system resources satisfies predefined criteria, embodiments set the database cursor threshold to a second value.
31 Citations
11 Claims
-
1. A computer-readable storage medium containing computer program code that, when executed by operation of one or more computer processors, performs an operation comprising:
-
collecting usage metrics for each of a plurality of database cursors, wherein the usage metrics further comprise a number of other database cursors that are associated with a job with which each respective database cursor is associated; calculating a cost of each respective database cursor based on the collected usage metrics, wherein the cost describes an estimated amount of time to rebuild the respective database cursor, if closed, relative to an average runtime of the respective database cursor, and wherein the cost is calculated further based on at least one of;
(a) a size in memory of each respective database cursor, and (b) an amount of resources that are required when each respective database cursor is used;upon determining that a database cursor threshold has been exceeded, wherein the database cursor threshold defines the maximum number of database cursors that are permitted to be open at a time; selecting, based on the calculated costs, a database cursor of the plurality of database cursors; and closing the selected cursor. - View Dependent Claims (2, 3, 4)
-
-
5. A computer-readable storage medium containing computer program code that, when executed by operation of one or more computer processors, performs an operation comprising:
-
collecting usage metrics for each of a plurality of database cursors, wherein the usage metrics further comprise a number of other database cursors that are associated with a job with which each respective database cursor is associated; calculating a cost of each respective database cursor based on the collected usage metrics, wherein the cost describes an estimated amount of time to rebuild the respective database cursor, if closed, relative to an average runtime of the respective database cursor, and wherein the cost is calculated further based on a history of each respective database cursor, wherein the history comprises at least one of;
(a) a measure of a frequency with which each respective database cursor is reused, and (b) how long each respective database cursor is likely to remain open before being closed by a respective thread or job;upon determining that a database cursor threshold has been exceeded, wherein the database cursor threshold defines the maximum number of database cursors that are permitted to be open at a time; selecting, based on the calculated costs, a database cursor of the plurality of database cursors; and closing the selected cursor. - View Dependent Claims (6, 7, 8)
-
-
9. A computer-readable storage medium containing computer program code that, when executed by operation of one or more computer processors, performs an operation comprising:
-
collecting usage metrics for each of a plurality of database cursors, wherein the usage metrics further comprise at least one of;
(a) a number of users who have used each respective database cursor, (b) a number of threads which have accessed each respective database cursor, (c) a number of jobs which have used each respective database cursor, and (d) a number of applications which have accessed each respective database cursor;calculating a cost of each respective database cursor based on the collected usage metrics, wherein the cost describes an estimated amount of time to rebuild the respective database cursor, if closed, relative to an average runtime of the respective database cursor, wherein the cost is calculated further based on at least one of;
(a) a size in memory of each respective database cursor, (b) an amount of resources that are required when each respective database cursor is used, and (c) a history of each respective database cursor, wherein the history comprises at least one of;
(i) a measure of a frequency with which each respective database cursor is reused, and (ii) how long each respective database cursor is likely to remain open before being closed by a respective thread or job;upon determining that a database cursor threshold has been exceeded, wherein the database cursor threshold defines the maximum number of database cursors that are permitted to be open at a time; selecting, based on the calculated costs, a database cursor of the plurality of database cursors; and closing the selected cursor. - View Dependent Claims (10, 11)
-
Specification