Method and system for effectively representing query results in a limited amount of memory
First Claim
1. A method in a computer system for managing the size of a result set produced in response to a database query, the result set comprising a plurality of rows each having information including a sort key, the sort keys of all of the rows of the result set together comprising a sort key range, the method comprising the steps of:
- dividing the rows of the result set into a plurality of segments, each segment being either a full segment containing complete information for each of its rows or an abridged segment containing incomplete information for each of its rows, the sort keys of the rows of each segment comprising a sort key subrange within the sort key range, such that the sort key subranges of the segments are non-overlapping;
selecting a segment to abridge based on a likelihood of receiving a request for complete information for one of the rows in the segment; and
abridging the selected segment by discarding at least a portion of the information for each row of the selected segment, such that the size of the selected segment and the size of the result set as a whole are both reduced.
2 Assignments
0 Petitions
Accused Products
Abstract
A method and system for effectively representing a result set in a limited amount of memory is provided. The result set is made up of a number of ordered rows. At least some of the rows contain row data, while each of the rows contains a bookmark that may be used to retrieve row data for the row. When it is determined that the size of the result set should be reduced, a subset of the rows of the result set is identified. The identified subset of rows is contiguous within the order of the results set and includes rows that contain row data. For each row of the identified subset, the row data is removed from the result set while retaining in the result set the bookmarks of the rows in the identified subset. As the result of the removal of row data, the size of the result set is reduced. In a further embodiment of the invention, when a request is received to return the row data for a row among the identified subset of rows, the retained bookmarks for the identified subset of rows are used to retrieve row data for the rows back into the result set. The requested row data is then returned from the result set in response to the request.
92 Citations
53 Claims
-
1. A method in a computer system for managing the size of a result set produced in response to a database query, the result set comprising a plurality of rows each having information including a sort key, the sort keys of all of the rows of the result set together comprising a sort key range, the method comprising the steps of:
-
dividing the rows of the result set into a plurality of segments, each segment being either a full segment containing complete information for each of its rows or an abridged segment containing incomplete information for each of its rows, the sort keys of the rows of each segment comprising a sort key subrange within the sort key range, such that the sort key subranges of the segments are non-overlapping; selecting a segment to abridge based on a likelihood of receiving a request for complete information for one of the rows in the segment; and abridging the selected segment by discarding at least a portion of the information for each row of the selected segment, such that the size of the selected segment and the size of the result set as a whole are both reduced. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 24, 25, 26, 27)
-
-
10. A method in a computer system for managing the size of a result set produced in response to a database query, the result set comprising a plurality of rows each having information including a sort key, the sort keys of all of the rows of the result set together comprising a sort key range, the method comprising the steps of:
-
dividing the rows of the result set into a plurality of segments, each segment being either a full segment containing complete information for each of its rows or an abridged segment containing incomplete information for each of its rows, the sort keys of the rows of each segment comprising a sort key subrange within the sort key range, such that the sort key subranges of the segments are non-overlapping; selecting a segment to abridge based on a likelihood of receiving a request for complete information for one of the rows in the segment; and abridging the selected segment by discarding at least a portion of the information for each row of the selected segment, such that the size of the selected segment and the size of the result set as a whole are both reduced, wherein the information for all of the rows of the selected segment is divided into a plurality of columns including a bookmark column containing, for each row, information usable to efficiently obtain complete information for the row, and wherein the abridging step discards, for each row in the selected segment, all of the columns except the bookmark column.
-
-
23. A method in a computer system for managing the size of a result set produced in response to a database query, the result set comprising a plurality of rows each having information including a sort key, the sort keys of all of the rows of the result set together comprising a sort key range, the method comprising the steps of:
-
dividing the rows of the result set into a plurality of segments, each segment being either a full segment containing complete information for each of its rows or an abridged segment containing incomplete information for each of its rows, the sort keys of the rows of each segment comprising a sort key subrange within the sort key range, such that the sort key subranges of the segments are non-overlapping; selecting a segment to abridge based on a likelihood of receiving a request for complete information for one of the rows in the segment; abridging the selected segment by discarding at least a portion of the information for each row of the selected segment, such that the size of the selected segment and the size of the result set as a whole are both reduced; receiving a request for the complete information of a specified row in a specified segment; if the specified segment is incomplete, retrieving into the specified segment the complete information for the rows of the specified segment; and in response to the received request, returning the complete information for the specified row from the specified segment, wherein the information for the rows of the specified segment contained in the specified segment includes, for each row, a bookmark usable to efficiently obtain complete information for the row, and wherein the retrieving step includes the step of using the bookmarks to efficiently obtain complete information for the rows of the specified segment.
-
-
28. A computer-readable medium whose contents cause a computer system to manage the size of a result set, the result set comprising a plurality of rows each having information including a sort key, the sort keys of all of the rows of the result set together comprising a sort key range, by performing the steps of:
-
dividing the rows of the result set into a plurality of segments, each segment being either a full segment containing complete information for each of its rows or an abridged segment containing incomplete information for each of its rows, the sort keys of the rows of each segment comprising a distinct sort key subrange within the sort key range; when each new row is received for the result set, adding the new row to a segment whose subrange encompasses the sort key of the new row; in response to the adding step, selecting a segment to abridge based on the relative likelihood of, for each segment, receiving a request for complete information for one of the rows in the segment, which corresponds to the likelihood of, for each segment, receiving a request for complete information for a row whose sort key is encompassed by the sort key subrange of the segment; and abridging the selected segment by discarding at least a portion of the information for each row of the selected segment, such that the size of the selected segment and the size of the result set as a whole are both reduced. - View Dependent Claims (29)
-
-
30. A computer-readable medium whose contents cause a computer system to manage the size of a result set, the result set comprising a plurality of rows each having information including a sort key, the sort keys of all of the rows of the result set together comprising a sort key range, by performing the steps of:
-
dividing the rows of the result set into a plurality of segments, each segment being either a full segment containing complete information for each of its rows or an abridged segment containing incomplete information for each of its rows, the sort keys of the rows of each segment comprising a distinct sort key subrange within the sort key range; when each new row is received for the result set, adding the new row to a segment whose subrange encompasses the sort key of the new row; in response to the adding step, selecting a segment to abridge based on the relative likelihood of, for each segment, receiving a request for complete information for one of the rows in the segment, which corresponds to the likelihood of, for each segment, receiving a request for complete information for a row whose sort key is encompassed by the sort key subrange of the segment; and abridging the selected segment by discarding at least a portion of the information for each row of the selected segment, such that the size of the selected segment and the size of the result set as a whole are both reduced, wherein the information for all of the rows of the selected segment is divided into a plurality of columns including a bookmark column containing, for each row, information usable to efficiently obtain complete information for the row, and wherein the abridging step discards, for each row in the selected segment, all of the columns except the bookmark column.
-
-
31. A method in a computer system for managing the size of a representation of a result set produced by a row source program, the representation of the result set comprising an ordered plurality of rows, at least some of the rows containing row data, each of the rows containing a bookmark usable to retrieve row data for the row, the method comprising the steps of:
-
determining that the size of the representation of the result set should be reduced; in response to the determining step, identifying a subset of the rows of the representation of the result set that is contiguous within the order of the representation of the result set, at least some of the rows in the identified subset containing row data; and removing from the representation of the result set any row data contained by rows among the identified subset while retaining in the representation of the result set the bookmarks contained by rows among the identified subset, such that the size of the representation of the result set is reduced. - View Dependent Claims (32, 33, 34, 35, 36, 37)
-
-
38. A computer-readable medium whose contents cause a computer system to manage the size of a representation of a result, the representation of the result set comprising an ordered plurality of rows, at least some of the rows containing row data, each of the rows containing a bookmark usable to retrieve row data for the row, by performing the steps of:
-
determining that the size of the representation of the result set should be reduced; in response to the determining step, identifying a subset of the rows of the representation of the result set that is contiguous within the order of the representation of the result set, at least some of the rows in the identified subset containing row data; and removing from the representation of the result set any row data contained by rows among the identified subset while retaining in the representation of the result set the bookmarks contained by rows among the identified subset, such that the size of the representation of the result set is reduced. - View Dependent Claims (39, 40)
-
-
41. A method in a computer system for responding to requests each requesting the contents of a specified row of a query result set, the method comprising the steps of:
-
receiving a first request requesting the contents of a first specified row; in response to receiving the first request; determining that the first specified row is among a subset of the rows of the result set whose row contents have been partially discarded, but whose remaining row contents include, for each row, a bookmark usable to efficiently retrieve complete contents for the row, retrieving the contents of each row of the subset using the bookmarks, and returning the retrieved contents of the first specified row; receiving a second request requesting the contents of a second specified row that is also among the subset; and in response to receiving the second request, returning the retrieved contents of the second specified row.
-
-
42. A computer-readable medium whose contents cause a computer system to respond to requests each requesting the contents of a specified row of a query result set by performing the steps of:
-
receiving a first request requesting the contents of a first specified row; in response to receiving the first request; determining that the first specified row is among a subset of the rows of the result set whose row contents have been partially discarded, but whose remaining row contents include, for each row, a bookmark usable to efficiently retrieve complete contents for the row, retrieving the contents of each row of the subset using the bookmarks, and returning the retrieved contents of the specified row; receiving a second request requesting the contents of a second specified row that is also among the subset; and in response to receiving the second request, returning the retrieved contents of the second specified row.
-
-
43. A computer-readable medium whose contents cause a computer system to respond to requests each requesting the contents of a specified row of a query result set by performing the steps of:
-
receiving a first request requesting the contents of a first specified row; in response to receiving the first request; determining that the first specified row is among a subset of the rows of the result set whose row contents have been completely discarded, retrieving the contents of each row of the subset by reexecuting the query for the subset, and returning the retrieved contents of the specified row; receiving a second request requesting the contents of a second specified row that is also among the subset; and in response to receiving the second request, returning the retrieved contents of the second specified row.
-
-
44. A method in a computer system for responding to requests each requesting the contents of a specified row of a query result set, the method comprising the steps of:
-
receiving a first request requesting the contents of a first specified row; in response to receiving the first request; determining that the first specified row is among a subset of the rows of the result set whose row contents have been completely discarded, retrieving the contents of each row of the subset by reexecuting the query for the subset, and returning the retrieved contents of the specified row; receiving a second request requesting the contents of a second specified row that is also among the subset; and in response to receiving the second request, returning the retrieved contents of the second specified row.
-
-
45. A computer-readable medium whose contents cause a computer system to instantiate the following programmatic objects for managing a database query result set in a limited amount of memory:
-
a table object having the following methods; a method invocable by a row source program to supply to the table with rows of the result set, a method invocable by a row sink program to request row data for rows in the result set provided by the row source program, a method for checking and adjusting overall memory usage, and a segment type changing method for changing the type of a segment object to a type that maintains less information for the rows it manages when the table object determines that the size of the segment should be reduced, the segment type changing method being invoked by the method of the table object for checking and adjusting overall memory usage; and a plurality of segment objects, each segment object for managing the row data for a portion of the rows in the result set, each segment object being of one of a range of two or more types, each type of segment object maintaining a different level of information about the rows whose row data it manages, the segment objects each having the following methods; a method invocable by the table to add rows to the segment object, a method invocable by the table for requesting the row data for rows managed by the segment object, and a method invocable by the segment type changing method of the table to transfer the row data for rows of the segment object to the segment object of the new type, such that the table and segment objects can be employed to expeditiously service row data requests from the row sink program while utilizing a limited amount of memory.
-
-
46. An apparatus for managing a query result set comprising an ordered series of rows produced in response to a database query, each row having contents, the apparatus comprising:
-
a memory for containing the query result set, the query result set being divided in the memory into a plurality of segments each containing a distinct subset of the rows of the result set that is contiguous within the ordered series of rows; a result set size monitor that determines when the amount of the memory occupied by the result set should be reduced; and a result set size reduction subsystem that, in response to a determination by the result set size monitor that the size of the result set should be reduced, reduces the amount of the memory occupied by the result set by; selecting a segment for which row contents are relatively unlikely to be requested, and for each row of the selected segment, deleting at least a portion of the contents of the row. - View Dependent Claims (47, 48)
-
-
49. A method in a computer system for responding to requests each requesting the contents of a specified row of a query result set, each row of the query result set having row information, the method comprising the steps of:
-
dividing the rows of the query result set into a plurality of segments; discarding at least a portion of the row information of each row of a selected segment in order to reduce the amount of memory used to store the result set; after the discarding step, receiving a request for a specified row of the selected segment; and in response to the receiving step; subdividing the rows of the selected segment into a plurality of subsegments, for each row of the subsegment containing the specified row, but for none of the rows of the subsegments not containing the specified row, retrieving the row data of the row discarded in the discarding step, and returning the row data for the specified row, including the retrieved row data.
-
-
50. A method in a computer system for maintaining a query result set using a plurality of row information segments, the query result set comprised of rows each comprised of row information, each segment representing a portion of the rows of the result set, the row information segments being coordinated by a primary table, the method comprising the steps of:
-
for each row of the result set; receiving the row information for the row, under the control of the primary table, identifying a segment in which to represent the row, and storing at least a portion of the received row information for the row in the identified segment of the primary table; under the control of the primary table, discarding at least a portion of the row information stored for each row of a selected segment of the primary table in order to reduce the amount of memory used to store the result set; after the discarding step, receiving a request for a specified row of the selected segment of the primary table; and in response to the step of receiving a request; creating a secondary table having its own segments, for each row represented by the selected segment; retrieving the row information for the row; under the control of the secondary table, identifying a segment of the secondary table in which to represent the row; and storing at least a portion of the retrieved row information for the row in the identified segment of the secondary table, and replacing the selected segment of the primary table with the segments of the secondary table. - View Dependent Claims (51, 52)
-
-
53. A method in a computer system for maintaining the state of a result set produced in response to a database query, the result set being comprised of rows, the method comprising the steps of:
-
receiving a plurality of row addition requests from a row source program each specifying a row to be added to the result set; for each received row addition request, processing the row addition request to modify the state of the result set established by processing earlier-processed row addition requests to reflect the addition of the row specified by the row addition request; receiving a plurality of row retrieval requests each specifying a row to be retrieved from the result set from a row sink program that is distinct from and that operates asynchronously with respect to the row source program, such that receipt of at least one row retrieval request is succeeded by receipt of at least one row addition request; and for each received row retrieval request, processing the received row retrieval request to retrieve the row specified by the row retrieval request in accordance with the state of the result set established by processing earlier-processed row addition requests.
-
Specification