Data storage method and apparatus
First Claim
1. A data storage method for a database in a computer system, comprising:
- configuring, by the computer system, an identifier column comprising row identifiers for data records of two data objects, each row identifier identifying one of the data records, wherein the two data objects have a same column attribute, the identifier column associated with a format to represent the row identifiers, the format specified by a first field followed by a second field, the first filed for storing a value corresponding to the same column attribute, and the second filed for storing a data object identifier identifying one of the two data objects;
storing, by the computer system, the data records of the two data objects in a data table of the database, wherein the data table includes the identifier column, wherein a row of the data table includes a row identifier of the identifier column, the row identifier identifying one of the data records, each column attribute of the two data objects corresponds to one column attribute of the data table, wherein the row identifiers are used for a primary index of each data record in the data table;
constructing, by the computer system according to the format of the identifier column, query information for querying the data table in response to a data request, wherein the query information comprises the same column attribute; and
exporting, by the computer system, a data record whose primary index comprises the same column attribute.
1 Assignment
0 Petitions
Accused Products
Abstract
A data storage method and apparatus. The method includes: determining a same column attribute of at least two data objects that are to be stored in a KeyValue type distributed database; determining a format of a row identifier of each data object of the at least two data objects, where the row identifier format includes the same column attribute and a data object identifier; determining a row identifier value of each data record of each data object according to the determined row identifier format of each data object; and storing each data record and the row identifier value of each data record, where the row identifier value of each data record is used as a primary index. The data storage method and apparatus in embodiments of the present invention can improve data query efficiency.
30 Citations
18 Claims
-
1. A data storage method for a database in a computer system, comprising:
-
configuring, by the computer system, an identifier column comprising row identifiers for data records of two data objects, each row identifier identifying one of the data records, wherein the two data objects have a same column attribute, the identifier column associated with a format to represent the row identifiers, the format specified by a first field followed by a second field, the first filed for storing a value corresponding to the same column attribute, and the second filed for storing a data object identifier identifying one of the two data objects; storing, by the computer system, the data records of the two data objects in a data table of the database, wherein the data table includes the identifier column, wherein a row of the data table includes a row identifier of the identifier column, the row identifier identifying one of the data records, each column attribute of the two data objects corresponds to one column attribute of the data table, wherein the row identifiers are used for a primary index of each data record in the data table; constructing, by the computer system according to the format of the identifier column, query information for querying the data table in response to a data request, wherein the query information comprises the same column attribute; and exporting, by the computer system, a data record whose primary index comprises the same column attribute. - View Dependent Claims (2, 3, 4, 5, 6)
-
-
7. A non-transitory computer readable storage medium having program instructions embodied therewith, the program instructions executable by a computer to cause the computer to perform the operations of:
-
configuring an identifier column comprising row identifiers for data records of two data objects, each row identifier identifying one of the data records, wherein the two data objects have a same column attribute, the identifier column associated with a format to represent the row identifiers, the format specified by a first field followed by a second field, the first filed for storing a value corresponding to the same column attribute, and the second filed for storing a data object identifier identifying one of the two data objects; storing the data records of the two data objects in a data table of the database, wherein the data table includes the identifier column, wherein a row of the data table includes a row identifier of the identifier column, the row identifier identifying one of the data records, each column attribute of the two data objects corresponds to one column attribute of the data table, wherein the row identifiers are used for a primary index of each data record in the data table; constructing, according to the format of the identifier column, query information for querying the data table in response to a data request, wherein the query information comprises the same column attribute; and exporting a data record whose primary index comprises the same column attribute. - View Dependent Claims (8, 9, 10, 11, 12)
-
-
13. A computer system, comprising:
-
at least one processor; a database; a memory having computer instructions stored therein which, when executed by the at least one processor, cause the computer system to perform the operations of; configuring an identifier column comprising row identifiers for data records of two data objects, each row identifier identifying one of the data records, wherein the two data objects have a same column attribute, the identifier column associated with a format to represent the row identifiers, the format specified by a first field followed by a second field, the first filed for storing a value corresponding to the same column attribute, and the second filed for storing a data object identifier identifying one of the two data objects; storing the data records of the two data objects in a data table of the database, wherein the data table includes the identifier column, wherein a row of the data table includes a row identifier of the identifier column, the row identifier identifying one of the data records, each column attribute of the two data objects corresponds to one column attribute of the data table, wherein the row identifiers are used for a primary index of each data record in the; constructing, according to the format of the identifier column, query information for querying the data table in response to a data request, wherein the query information comprises the same column attribute; and exporting a data record whose primary index comprises the same column attribute. - View Dependent Claims (14, 15, 16, 17, 18)
-
Specification