US20250156379A1
OPTIMIZING STORAGE OF DATA IN ROW-ORIENTED DATA STORAGES
Publication
Application
Classifications
IPC Classifications
CPC Classifications
Applicants
Arista Networks, Inc.
Inventors
Benoit Sigoure, Michael Fink
Abstract
Embodiments of the present disclosure include techniques for optimizing storage of data in row-oriented data storages. A block of data comprising a plurality of rows of data. Each row of data comprises a set of values for a set of attributes. A set of unique schemas is determined based on the plurality of rows of data. A set of groups of rows of data is determined based on the set of unique schemas. For each group of rows of data in the set of groups of rows of data, the group of rows of data is stored in a column-oriented format. For each group of rows of data in the set of groups of rows of data, a set of encoding techniques are applied to values in the group of rows of data based on the sets of attributes of the group of rows of data.
Figures
Description
CROSS REFERENCE TO RELATED APPLICATIONS
[0001]This application is a continuation application and, pursuant to 35 U.S.C. § 120, is entitled to and claims the benefit of earlier filed application U.S. application Ser. No. 18/056,643 filed Nov. 17, 2022, the content of which is incorporated herein by reference in its entirety for all purposes.
BACKGROUND
[0002]Databases are typically used to store data in an organized manner and allow the data to be accessed for computing purposes. A database management system (DBMS) is software configured to manage such databases and provide access to clients of the databases (e.g., users, applications, services, computing devices, etc.). One way to organize data in a database is using tables of rows and columns. Each column in a table stores a value for an attribute while each row in a table represents a set of related data (i.e., the values specified in the columns in the row). Generally, there are two main ways in which data are stored in such tables. First, data can be stored using a row-oriented approach. Under such an approach, the data in each row in a table are stored together. A second technique for storing data in tables is a column-oriented approach where data in each column are stored together.
[0003]The following detailed description and accompanying drawings provide a better understanding of the nature and advantages of various embodiments of the present disclosure.
BRIEF DESCRIPTION OF THE DRAWINGS
[0004]
[0005]
[0006]
[0007]
[0008]
[0009]
[0010]
[0011]
DETAILED DESCRIPTION
[0012]In the following description, for purposes of explanation, numerous examples and specific details are set forth in order to provide a thorough understanding of the present disclosure. It will be evident, however, to one skilled in the art that various embodiments of the present disclosure as defined by the claims may include some or all of the features in these examples alone or in combination with other features described below, and may further include modifications and equivalents of the features and concepts described herein.
[0013]Described herein are techniques for optimizing storage of data in row-oriented data storages. In some embodiments, a data management system that manages row-oriented data storages manages data on a block-by-block basis. For example, when the data management system receives rows of data to store in a data storage, the data management system stores multiple rows of data in a block of data and stores the block in the data storage. When the data management system receives a request for a particular row of data, the data management system determines the block of data in the data storage that includes the particular row of data, reads the block of data from the data storage, identifies the particular row of data from the determined block of data, and then returns the identified particular row of data to the requestor. In some embodiments, the data management system optimizes the way such blocks of data are stored by processing the rows of data that are to be stored in a block of data in a certain manner. For instance, each row of data can be implemented as a key/value pair where the value specifies a set of attributes and a set of values for the set of attributes. Based on the set of attributes of each row of data to be stored in the block of data, the data management system determines a schema associated with the row of data. Then, the data management system groups rows of data that have the same schema together. For each group of rows of data, the data management system stores the values and attributes in a column-oriented format. For each group of rows of data, the data management system may apply different encoding techniques to the values of different attributes based on the type of data of the values in order to further optimize the storage of the values.
[0014]The techniques described in the present application provide a number of benefits and advantages over conventional methods for storing data in row-oriented data storages. For example, storing data for a row-oriented data storage in a column-oriented format allows encoding techniques typically applicable to only data stored in a column-oriented manner to be applied to the data for the row-oriented data storage. Such encoding techniques provide better data compression of the data. Conventional ways of storing data in row-oriented data storages prevent such encoding techniques from being used.
[0015]There are many possible applications of the techniques described here. For instance, the techniques are particularly useful in applications where multiple entries are stored for the same key, such as when storing network configurations and network telemetry. In these cases, the number of values associated with similar keys and thus with each schema is high. This allows for greater compression of the data and thus greater advantages when transforming between row oriented and column oriented storage.
[0016]
[0017]As illustrated in
[0018]
[0019]
[0020]As mentioned above, in some embodiments, the block of rows of data illustrated in row-oriented database 200 can use the same/similar structure as that depicted for block of rows of data 300. In some such embodiments, the blocks of rows of data in each of the database files 205a-j are sorted according to key values. Additionally, each of the database files 205a-j may further include an index on the keys of the rows of data included in the blocks of the database file 205. For example, in some embodiments, the index included in a database file 205 can store the offset of each block of rows of data included in the database file 205 and the first key of each of those blocks of rows of data. This way, when searching for a key in a database file 205, the index included in the database file 205 is loaded and a binary search may be performed on the index in order to find the block of rows of data where the key could be included.
[0021]Returning to
[0022]In some embodiments when determining the set of unique schemas the schema manager 115 may detect that the key contains information that is also stored in the value. For example, the key may be comprised of a set of keys and values itself, these keys also being present in the value. The schema manager 115 may extract the overlapping information into the schema such that the data is only stored in one of the key columns or the attribute columns.
[0023]Data format manager 120 is configured to store data arranged in a row-oriented format in a column-oriented format. For instance, when data format manager 120 receives from schema manager 115 several rows of data and the set of unique schemas, data format manager 120 groups the rows of data into a set of groups based on the unique set of schemas. For instance, data format manager 120 can group rows of data having the same unique schema into a separate group. In this fashion, each group of rows of data has the same common schema used to store its data. Next, data format manager 120 stores the data in each group of rows of data in a column-oriented format. Once the groups of rows of data are stored in a column-oriented format, data format manager 120 sends encoding manager 125 the groups of rows of data and the set of unique schemas for further processing.
[0024]Encoding manager 125 handles the encoding of data in groups of rows of data. For example, encoding manager 125 can receive groups of rows of data and a set of unique schemas from data format manager 120. In response to receiving this data, encoding manager 125 processes each group of rows of data by determining the data type of values stored in each column of data based on the unique schema associated with the group of rows of data. Based on the type of data values stored in a particular column of data, encoding manager 125 applies a defined encoding technique to encode the column of data. For example, if encoding manager 125 determines that the data type of values stored in a column of data is a numeric value such as an integer, encoding manager 125 can use a run-length encoding technique to encode the values stored in the column of data. As another example, if encoding manager 125 determines that the data type of values stored in a column of data is an enumeration (e.g., a set of possible values), encoding manager 125 can use a dictionary encoding technique to encode the values stored in the column of data. As yet another example, if encoding manager 125 determines that the data type of values stored in a column of data is a timestamp, encoding manager 125 can use a delta or zigzag encoding technique (e.g., differences between timestamps are zigzag encoded) to encode the values stored in the column of data. One of ordinary skill in the art will appreciate that any number of different types of encoding techniques may be employed for any number of different data types. After encoding the data in each group of rows of data, encoding manager 125 stores the encoded data in row-oriented data storage 130 (e.g., as a block of rows of data in a database file of a row-oriented database).
[0025]An example operation will now be described by reference to
[0026]
[0027]After determining that block of rows of data 400 is to be stored in row-oriented data storage 130, data management system 110 sends schema manager 115 block of rows of data 400 and a request to determine unique schemas for the block of rows of data 400. In response, schema manager 115 determines a set of unique schemas based on the data in the several rows of data. Here, schema manager 115 determines the set of unique schemas by iterating through each of the rows of data 405-430 and identifying unique schemas based on the attributes and values specified in values 465-490.
[0028]
[0029]When schema manager 115 iterates to row of data 410, schema manager 115 determines that the schema for row of data 410 has different attribute names than schema 500 and, thus, is a different schema that does not exist. As such, schema manager 115 generates schema 505, which specifies a product id attribute that stores an integer data type, a product name attribute that stores a string data type, and a price attribute that stores an integer data type. Schema manager 115 determines the data types for these attributes in the same fashion described above (e.g., examining the values of the attributes). Next, schema manager 115 iterates to row of data 415. Here, schema manager 115 determines that the schema for row of data 415 has different attribute names than schemas 500 and 510. Hence, schema manager 115 generates schema 510, which specifies a store id attribute that stores an integer data type, a city attribute that stores a string data type, and a state attribute that stores a string data type. Schema manager 115 determines the data types for these attributes in the same way explained above (e.g., examining the values of the attributes). Then, schema manager 115 iterates to row of data 420. The attribute names specified in row of data 420 and the data types that schema manager 115 determines for the attributes are the same as schema 500. Therefore, schema manager 115 determines that the schema for row of data 420 is the same as schema 500 and proceeds to row of data 425. Here, schema manager 115 determines that the schema for row of data 425 is also the same as schema 500 because the attribute names specified in row of data 425 and the data types that schema manager 115 determines for the attributes are the same as schema 500. Finally, schema manager 115 iterates to row of data 430 and determines that the schema for row of data 430 is the same as schema 505 as the attribute names specified in row of data 430 and the data types that schema manager 115 determines for the attributes are the same as schema 505.
[0030]Once schema manager 115 determines the set of unique schemas 500-510, schema manager 115 sends data format manager 120 rows of data 405-430 and the set of unique schemas 500-510. Upon receiving the rows of data 405-430 and the set of unique schemas 500-510, data format manager 120 groups rows of data 405-430 into a set of groups based on the unique set of schemas 500-510. In this example, data format manager 120 groups rows of data having the same unique schema into a separate group. Thus, data format manager 120 groups rows of data 405, 420, and 425 into a first group of rows of data. Then, data format manager 120 groups rows of data 410 and 430 into a second group of rows of data. Lastly, data format manager 120 groups row of data 415 into a third group of rows of data.
[0031]After the rows of data 405-430 are grouped, data format manager 120 stores the data in each group of rows of data in a column-oriented format.
[0032]When encoding manager 125 receives sets of data 600-610 and schemas 500-510, encoding manager 125 processes each group of rows of data by determining the data type of values stored in each column of data based on the unique schema associated with the group of rows of data. Here, encoding manager 125 determines, based on schema 500, the data type of the employee id attribute in set of data 600 to be an integer, the data type of the first name attribute in set of data 600 to be a string, and the data type of the last name attribute set of data 600 to be a string. Encoding manager 125 applies an encoding technique to values in a column of data (e.g., an attribute) based on the encoding technique defined for the data type determined for the column of data. Encoding manager 125 processes set of data 605 based on schema 505 in the same way. Encoding manager 125 does not encode any of the data in set of data 610 as there is only one value in each attribute. Finally, encoding manager 125 stores the encoded set of data 600-610 as block of rows of data 400 in row-oriented data storage 130.
[0033]Now, when data management system 110 receives a request to access block of rows of data 400, data management system 110 can reproduce rows of data 405-430 based on encoded sets of data 600-610. Specifically, data management system 110 decodes the values in each column data using the corresponding decoding technique to generate sets of data 600-610. Next, data management system 110 converts the column-oriented format data in set sets of data 600-610 into the row-oriented format of rows of data 405-430. Data management system 110 can then process the request to access block of rows of data 400. In some embodiments, data management system 110 may decode, on the fly, just the requested subset of the block of rows of data.
[0034]
[0035]Next, process 700 determines, at 720, a set of unique schemas based on the plurality of rows of data. Referring to
[0036]At 730, process 700 determines, from the plurality of rows of data, a set of groups of rows of data based on the set of unique schemas. Referring to
[0037]For each group of rows of data in the set of groups of rows of data, process 700 then stores, at 740, the group of rows of data in a column-oriented format. Referring to
[0038]Finally, for each group of rows of data in the set of groups of rows of data, process 700 applies, at 750, a set of encoding techniques to values in the group of rows of data based on the sets of attributes of the group of rows of data. Referring to
[0039]
[0040]As shown in
[0041]Bus subsystem 804 provides a mechanism for letting the various components and subsystems of computer system 800 communicate with each other as intended. Although bus subsystem 804 is shown schematically as a single bus, alternative embodiments of the bus subsystem can utilize multiple buses.
[0042]Network interface subsystem 816 serves as an interface for communicating data between computer system 800 and other computing devices or networks. Embodiments of network interface subsystem 816 can include wired (e.g., coaxial, twisted pair, or fiber optic) and/or wireless (e.g., Wi-Fi, cellular, Bluetooth, etc.) interfaces.
[0043]User interface input devices 812 can include a keyboard, pointing devices (e.g., mouse, trackball, touchpad, etc.), a scanner, a barcode scanner, a touch-screen incorporated into a display, audio input devices (e.g., voice recognition systems, microphones, etc.), and other types of input devices. In general, use of the term “input device” is intended to include all possible types of devices and mechanisms for inputting information into computer system 800.
[0044]User interface output devices 814 can include a display subsystem such as a flat-panel display or non-visual displays such as audio output devices, etc. In general, use of the term “output device” is intended to include all possible types of devices and mechanisms for outputting information from computer system 800.
[0045]Storage subsystem 806 includes a memory subsystem 808 and a file/disk storage subsystem 810. Subsystems 808 and 810 represent non-transitory computer-readable storage media that can store program code and/or data that provide the functionality of various embodiments described herein.
[0046]Memory subsystem 808 includes a number of memories including a main random access memory (RAM) 818 for storage of instructions and data during program execution and a read-only memory (ROM) 820 in which fixed instructions are stored. File storage subsystem 810 can provide persistent (i.e., non-volatile) storage for program and data files and can include a magnetic or solid-state hard disk drive, an optical drive along with associated removable media (e.g., CD-ROM, DVD, Blu-Ray, etc.), a removable flash memory-based drive or card, and/or other types of storage media known in the art.
[0047]It should be appreciated that computer system 800 is illustrative and many other configurations having more or fewer components than computer system 800 are possible.
[0048]The above description illustrates various embodiments of the present disclosure along with examples of how aspects of the present disclosure may be implemented. The above examples and embodiments should not be deemed to be the only embodiments, and are presented to illustrate the flexibility and advantages of the present disclosure as defined by the following claims. Based on the above disclosure and the following claims, other arrangements, embodiments, implementations, and equivalents will be evident to those skilled in the art and may be employed without departing from the spirit and scope of the disclosure as defined by the claims.
Claims
What is claimed is:
1. A method comprising:
receiving a data block comprising a plurality of rows of data, each row of data associated with a set of attributes and comprising values of the associated set of attributes;
defining a plurality of schemas that represent attributes of the plurality of rows of data, including defining a first schema that represents a first set of attributes associated with one or more rows of data in the plurality of rows of data and defining at least a second schema, different from the first schema, that represents a second set of attributes associated with one or more rows of data in the plurality of rows of data;
identifying groups of rows of data among the plurality of rows of data using the plurality of schemas, including identifying a first group of rows associated with attributes that are represented by the first schema and identifying at least a second group of rows associated with attributes that are represented by the second schema;
storing each of the identified group of rows in column-oriented format, including storing the first group of rows in column-oriented format and storing the second group of rows in column-oriented format.
2. The method of
3. The method of
4. The method of
5. The method of
6. The method of
7. The method of
8. A computer system comprising:
one or more computer processors; and
a computer-readable storage device comprising instructions that control the one or more computer processors to:
receive a data block comprising a plurality of rows of data, each row of data associated with a set of attributes;
define a first schema that represents a first set of attributes associated with one or more rows of data in the plurality of rows of data;
define at least a second schema, different from the first schema, that represents a second set of attributes associated with one or more rows of data in the plurality of rows of data;
identify a first group of rows from among the plurality of rows of data in the data block associated with the first set of attributes represented by the first schema;
identify at least a second group of rows from among the plurality of rows of data in the data block associated with the second set of attributes represented by the second schema;
store the first group of rows in column-oriented format; and
store the second group of rows in column-oriented format.
9. The computer system of
10. The computer system of
11. The computer system of
12. The computer system of
13. The computer system of
14. The computer system of
15. A non-transitory computer-readable storage device in a network device, the non-transitory computer-readable storage device having stored thereon computer executable instructions, which when executed, cause the network device to:
receive a data block comprising a plurality of rows of data, each row of data associated with a set of attributes;
define a first schema that represents a first set of attributes associated with one or more rows of data in the plurality of rows of data;
define at least a second schema, different from the first schema, that represents a second set of attributes associated with one or more rows of data in the plurality of rows of data;
identify a first group of rows from among the plurality of rows of data in the data block associated with the first set of attributes represented by the first schema;
identify at least a second group of rows from among the plurality of rows of data in the data block associated with the second set of attributes represented by the second schema;
store the first group of rows in column-oriented format; and
store the second group of rows in column-oriented format.
16. The non-transitory computer-readable storage device of
17. The non-transitory computer-readable storage device of
18. The non-transitory computer-readable storage device of
19. The non-transitory computer-readable storage device of