Tablespace-relative database pointers
First Claim
Patent Images
1. A method of retrieving information from a computer database having a plurality of datafiles, said plurality of datafiles containing a plurality of data items, the method comprising the computer-implemented steps of:
- logically partitioning said plurality of datafiles into a plurality of tablespaces;
storing references to data items that are contained in said plurality of datafiles as tablespace-relative pointers, wherein each of said tablespace-relative pointers indicates a location of a corresponding data item relative to the tablespace of said plurality of tablespaces that contains said corresponding data item;
locating a data item within said plurality of datafiles by performing the steps of;
reading a tablespace-relative pointer associated with said data item;
determining, based on an operating context, an identity of the tablespace of said plurality of tablespaces that contains said data item; and
locating said data item based on said tablespace-relative pointer and the identity of the tablespace.
2 Assignments
0 Petitions
Accused Products
Abstract
A database containing datafiles is partitioned into a set of tablespaces. Every disk pointer pointing to a data item in a datafile refers to a tablespace-relative file number for the datafile. Data pointed to by a tablespace-relative disk pointer is retrieved by first checking the cache, and upon a cache miss, the tablespace-relative file number is translated into an absolute file number according to a latch-free look up technique.
-
Citations
19 Claims
-
1. A method of retrieving information from a computer database having a plurality of datafiles, said plurality of datafiles containing a plurality of data items, the method comprising the computer-implemented steps of:
-
logically partitioning said plurality of datafiles into a plurality of tablespaces;
storing references to data items that are contained in said plurality of datafiles as tablespace-relative pointers, wherein each of said tablespace-relative pointers indicates a location of a corresponding data item relative to the tablespace of said plurality of tablespaces that contains said corresponding data item;
locating a data item within said plurality of datafiles by performing the steps of;
reading a tablespace-relative pointer associated with said data item;
determining, based on an operating context, an identity of the tablespace of said plurality of tablespaces that contains said data item; and
locating said data item based on said tablespace-relative pointer and the identity of the tablespace. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8)
each data item of said plurality of data items is located at an absolute address; and
the step of locating said data item based on said tablespace-relative pointer and the identity of the tablespace comprises the steps of;
determining said absolute address based on said tablespace-relative pointer and the identity of the tablespace; and
locating said data item based on said absolute address.
-
-
3. The method of claim 2 wherein:
-
each datafile is associated with a unique file number;
the absolute address of a data item includes the unique file number of the datafile that contains the data item and an offset into the datafile that contains the data item; and
the step of determining said absolute address based on said tablespace-relative pointer and the identity of the tablespace includes the step of determining the unique file number of the datafile that contains the data item and an offset into the datafile that contains the data item based on said tablespace-relative pointer and the identity of the tablespace.
-
-
4. The method of claim 1 wherein:
-
each datafile in a tablespace is assigned a logical file identifier that is unique relative to the logical file identifiers assigned to other datafiles within the same tablespace;
the tablespace-relative pointers include a datafile portion and an offset portion;
the datafile portion of the tablespace-relative pointers specifies the logical file identifier of a corresponding datafile;
the offset portion specifies an offset into the corresponding datafile;
the step of locating said data item based on said tablespace-relative pointer and the identity of the tablespace includes the step of locating said data item based on the identity of the tablespace, said datafile portion and said offset portion.
-
-
5. The method of claim 1 wherein:
-
the identity of said tablespace is represented by a tablespace number;
the step of locating said data item based on said tablespace-relative pointer and the identity of the datafile that includes the data item includes the steps of;
determining whether said data item that corresponds to said tablespace-relative pointer and the tablespace number is present in a buffer cache;
if said data item that corresponds to said tablespace number and said tablespace-relative pointer is present in said buffer cache, then retrieving said data item from said buffer cache; and
if said data item that corresponds to said tablespace number and said tablespace-relative pointer is not present in said buffer cache, then performing the steps of;
translating said tablespace number and said tablespace-relative pointer into an absolute file number, opening a datafile uniquely identified by said absolute file number if not already opened, retrieving said data item from said datafile at an offset specified in said tablespace-relative pointer, and storing said data item, said absolute file number, and said tablespace-relative pointer in said buffer cache.
-
-
6. The method of claim 5 wherein the step of translating said tablespace-relative file number and said tablespace number into an absolute file number comprises the steps of:
-
getting a version number from a map, wherein said map has a busy flag and a latch;
after getting said version number, reading said busy flag;
if said busy flag is not set, then performing the steps of;
getting a mapped absolute file number from the map based upon said tablespace number and said tablespace-relative file number, getting a new version number from said map, and comparing said version number with said new version number;
if said busy flag is set or if said version number is not equal to said new version number, then performing the steps of;
obtaining said latch, getting a mapped absolute file number from the map based upon said tablespace number and said tablespace-relative file number, and releasing said latch; and
returning the mapped absolute file number as said absolute file number.
-
-
7. The method of claim 6, wherein:
-
said map further comprises a hash table having a set of hash table entries, each hash table entry comprising a hash tablespace number, a hash tablespace-relative file number, and a hash absolute file number; and
each step of getting a mapped absolute file number further comprises the steps of;
finding a hash table entry in the hash table such that the hash tablespace number of the hash table entry is equal to said tablespace number and the hash tablespace-relative file number of the hash table entry is equal to said tablespace-relative file number, and returning the hash absolute file number of the hash table entry as said mapped absolute file number.
-
-
8. The method of claim 6, further comprising the steps of:
-
obtaining said latch;
after obtaining said latch, setting said busy flag;
after setting said busy flag, incrementing said version number;
after incrementing said version number, updating said map;
after updating said map, resetting said busy flag; and
after resetting said busy flag, releasing said latch.
-
-
9. A database system, comprising:
-
a plurality of datafiles;
a plurality of tablespaces, forming a partition of and containing said plurality of datafiles;
a plurality of data items, contained in said plurality of datafiles; and
a plurality of references to data items stored in said plurality of datafiles as tablespace-relative pointers, wherein each of said tablespace-relative pointers indicates a location of a corresponding data item relative to the tablespace of said plurality of tablespaces that contains said corresponding data item. - View Dependent Claims (10)
reading a tablespace-relative pointer associated with said data item;
determining, based on an operating context, an identity of the tablespace of said plurality of tablespaces that contains said data item; and
locating said data item based on said tablespace-relative pointer and the identity of the tablespace.
-
-
11. A computer readable medium having stored thereon sequences of instructions for retrieving information from a computer database having a plurality of datafiles, said plurality of datafiles containing a plurality of data items, said sequences of instructions including instructions for performing the steps of:
-
logically partitioning said plurality of datafiles into a plurality of tablespaces; and
storing references to data items that are contained in said plurality of datafiles as tablespace-relative pointers, wherein each of said tablespace-relative pointers indicates a location of a corresponding data item relative to the tablespace of said plurality of tablespaces that contains said corresponding data item. - View Dependent Claims (12, 13, 14, 15, 16, 17, 18, 19)
reading a tablespace-relative pointer associated with said data item;
determining, based on an operating context, an identity of the tablespace of said plurality of tablespaces that contains said data item; and
locating said data item based on said tablespace-relative pointer and the identity of the tablespace.
-
-
13. The computer-readable medium of claim 12 wherein:
-
each data item of said plurality of data items is located at an absolute address; and
the step of locating said data item based on said tablespace-relative pointer and the identity of the tablespace comprises the steps of;
determining said absolute address based on said tablespace-relative pointer and the identity of the tablespace; and
locating said data item based on said absolute address.
-
-
14. The computer-readable medium of claim 13 wherein:
-
each datafile is associated with a unique file number;
the absolute address of a data item includes the unique file number of the datafile that contains the data item and an offset into the datafile that contains the data item; and
the step of determining said absolute address based on said tablespace-relative pointer and the identity of the tablespace includes the step of determining the unique file number of the datafile that contains the data item and an offset into the datafile that contains the data item based on said tablespace-relative pointer and the identity of the tablespace.
-
-
15. The computer-readable medium of claim 12 wherein:
-
each datafile in a tablespace is assigned a logical file identifier that is unique relative to the logical file identifiers assigned to other datafiles within the same tablespace;
the tablespace-relative pointers include a datafile portion and an offset portion;
the datafile portion of the tablespace-relative pointers specifies the logical file identifier of a corresponding datafile;
the offset portion specifies an offset into the corresponding datafile;
the step of locating said data item based on said tablespace-relative pointer and the identity of the tablespace includes the step of locating said data item based on the identity of the tablespace, said datafile portion and said offset portion.
-
-
16. The computer-readable medium of claim 12 wherein:
-
the identity of said tablespace is represented by a tablespace number; and
the step of locating said data item based on said tablespace-relative pointer and the identity of the datafile that includes the data item includes the steps of;
determining whether said data item that corresponds to said tablespace-relative pointer and the tablespace number is present in a buffer cache;
if said data item that corresponds to said tablespace number and said tablespace-relative pointer is present in said buffer cache, then retrieving said data item from said buffer cache; and
if said data item that corresponds to said tablespace number and said tablespace-relative pointer is not present in said buffer cache, then performing the steps of;
translating said tablespace number and said tablespace-relative pointer into an absolute file number, opening a datafile uniquely identified by said absolute file number if not already opened, retrieving said data item from said datafile at an offset specified in said tablespace-relative pointer, and storing said data item, said absolute file number, and said tablespace-relative pointer in said buffer cache.
-
-
17. The computer-readable medium of claim 16 wherein the step of translating said tablespace-relative file number and said tablespace number into an absolute file number comprises the steps of:
-
getting a version number from a map, wherein said map has a busy flag and a latch;
after getting said version number, reading said busy flag;
if said busy flag is not set, then performing the steps of;
getting a mapped absolute file number from the map based upon said tablespace number and said tablespace-relative file number, getting a new version number from said map, and comparing said version number with said new version number;
if said busy flag is set or if said version number is not equal to said new version number, then performing the steps of;
obtaining said latch, getting a mapped absolute file number from the map based upon said tablespace number and said tablespace-relative file number, and releasing said latch; and
returning the mapped absolute file number as said absolute file number.
-
-
18. The computer-readable medium of claim 17, wherein:
-
said map further comprises a hash table having a set of hash table entries, each hash table entry comprising a hash tablespace number, a hash tablespace-relative file number, and a hash absolute file number; and
each step of getting a mapped absolute file number further comprises the steps of;
finding a hash table entry in the hash table such that the hash tablespace number of the hash table entry is equal to said tablespace number and the hash tablespace-relative file number of the hash table entry is equal to said tablespace-relative file number and returning the hash absolute file number of the hash table entry as said mapped absolute file number.
-
-
19. The computer readable medium of claim 17, further comprising the steps of:
-
obtaining said latch;
after obtaining said latch, setting said busy flag;
after setting said busy flag, incrementing said version number;
after incrementing said version number, updating said map;
after updating said map, resetting said busy flag; and
after resetting said busy flag, releasing said latch.
-
Specification