Method, Apparatus and Data Structure for Copying Values of a Table of a Database
20170322997 · 2017-11-09
Inventors
- Eliezer Levy (Munich, DE)
- Zhibiao Chen (Shenzhen, CN)
- Usama Dar (Shenzhen, CN)
- Aharon Avitzur (Munich, DE)
- Shay Goikhman (Munich, DE)
- Antoni Wolski (Helsinki, FI)
Cpc classification
G06F2212/621
PHYSICS
G06F2201/84
PHYSICS
G06F16/278
PHYSICS
G06F16/28
PHYSICS
G06F16/2343
PHYSICS
G06F12/128
PHYSICS
G06F12/122
PHYSICS
International classification
G06F12/122
PHYSICS
G06F11/14
PHYSICS
Abstract
A method for copying values of a table of a database between a primary memory and a secondary memory comprises selecting one or more segments, wherein the table is organized in a plurality of stripes and a plurality of vertical partitions, wherein a stripe comprises at least two rows of the table, wherein a vertical partition comprises one or more columns of the table, wherein each of the plurality of segments comprises values at a cross-section of a stripe and a vertical partition, and wherein each of the plurality of segments stores adjacent column values in adjacent locations of the primary or the secondary memory, and copying the one or more selected segments between the primary memory and the secondary memory.
Claims
1. A method for copying values of a table of a database between a primary memory and a secondary memory, comprising: selecting one or more segments of the table, wherein the table is stored as a plurality of segments, wherein the table is organized in a plurality of stripes and a plurality of vertical partitions, wherein a stripe comprises at least two rows of the table, wherein a vertical partition comprises one or more columns of the table, wherein each of the plurality of segments comprises values at a cross-section of a stripe and a vertical partition, and wherein each of the plurality of segments stores adjacent column values in adjacent locations of the primary or the secondary memory; and copying the one or more selected segments between the primary memory and the secondary memory.
2. The method of claim 1, wherein the one or more segments are segments that have changed.
3. The method of claim 1, further comprising: selecting the one or more segments in the primary memory that have changed; freezing the one or more selected segments such that a state of the one or more selected segments is preserved; copying the one or more frozen segments to the secondary memory; and releasing the frozen segments.
4. The method of claim 3, wherein freezing the one or more selected segments comprises at least one of shadowing, copying on write, or locking of the one or more selected segments.
5. The method of claim 1, further comprising: detecting a need for data eviction; determining an extent of the needed data eviction; selecting the one or more segments to be evicted; determining whether each of the one or more selected segments has been checkpointed; copying each of the one or more selected segments that has not been checkpointed from the primary memory to the secondary memory; and deleting the one or more selected segments from the primary memory.
6. The method of claim 5, wherein selecting the one or more segments to be evicted comprises: selecting one or more least recently used segments; and selecting one or more full columns that are not likely to be used.
7. The method of claim 5, wherein selecting the one or more segments to be evicted comprises: selecting one or more least recently used segments; and selecting one or more segments based on a selection criterion that is based on an age of the data.
8. An apparatus for copying values of a table of a database between a primary memory and a secondary memory, comprising: a processor configured to: select one or more segments of the table, wherein the table is stored as a plurality of segments, wherein the table is organized in a plurality of stripes and a plurality of vertical partitions, wherein a stripe comprises at least two rows of the table, wherein a vertical partition comprises one or more columns of the table, wherein each of the plurality of segments comprises values at a cross-section of a stripe and a vertical partition, and wherein each of the plurality of segments stores adjacent column values in adjacent locations of the primary or the secondary memory; and copy the one or more segments between the primary memory and the secondary memory.
9. The apparatus of claim 8, wherein the one or more segments are segments that have changed.
10. The apparatus of claim 8, wherein the processor is further configured to: selecting the one or more segments in the primary memory that have changed; freezing the one or more selected segments such that a state of the one or more selected segments is preserved; copying the one or more frozen segments to the secondary memory; and releasing the frozen segments.
11. The apparatus of claim 10, wherein freezing the one or more selected segments comprises at least one of shadowing, copying on write, or locking of the one or more selected segments.
12. The apparatus of claim 10, wherein the processor is further configured to: detecting a need for data eviction; determining an extent of the needed data eviction; selecting the one or more segments to be evicted; determining whether each of the one or more selected segments has been checkpointed; copying each of the one or more selected segments that has not been checkpointed from the primary memory to the secondary memory; and deleting the one or more selected segments from the primary memory.
13. The apparatus of claim 10, wherein the processor is further configured to: select one or more least recently used segments; and select one or more full columns that are not likely to be used.
14. A computer-readable storage medium, comprising program code for: selecting one or more segments of a table of a database, wherein the table is stored as a plurality of segments, wherein the table is organized in a plurality of stripes and a plurality of vertical partitions, wherein a stripe comprises at least two rows of the table, wherein a vertical partition comprises one or more columns of the table, wherein each of the plurality of segments comprises values at a cross-section of a stripe and a vertical partition, and wherein each of the plurality of segments stores adjacent column values in adjacent locations of the primary or the secondary memory; and copying the one or more selected segments between a primary memory and a secondary memory.
15. The computer-readable storage medium of claim 14, wherein the one or more segments are segments that have changed.
16. The computer-readable storage medium of claim 14, further comprising program code for: selecting the one or more segments in the primary memory that have changed; and freezing the one or more selected segments such that a state of the one or more selected segments is preserved.
17. The computer-readable storage medium of claim 16, further comprising program code for: copying the one or more frozen segments to the secondary memory; and releasing the frozen segments.
18. The computer-readable storage medium of claim 14, wherein freezing the one or more selected segments comprises at least one of shadowing, copying on write, or locking of the one or more selected segments.
19. The computer-readable storage medium of claim 14, further comprising program code for: detecting a need for data eviction; determining an extent of the needed data eviction; and selecting the one or more segments to be evicted.
20. The computer-readable storage medium of claim 19, further comprising program code for: determining whether each of the one or more selected segments has been checkpointed; copying each of the one or more selected segments that has not been checkpointed from the primary memory to the secondary memory; and deleting the one or more selected segments from the primary memory.
Description
BRIEF DESCRIPTION OF THE DRAWINGS
[0037] To illustrate the technical features of embodiments of the present disclosure more clearly, the accompanying drawings provided for describing the embodiments are introduced briefly in the following. The accompanying drawings in the following description are merely some embodiments of the present disclosure, but modifications on these embodiments are possible without departing from the scope of the present disclosure as defined in the claims.
[0038]
[0039]
[0040]
[0041]
[0042]
[0043]
[0044]
[0045]
DETAILED DESCRIPTION OF THE EMBODIMENTS
[0046]
[0047]
[0048] In embodiments of the disclosure, the organization of the table is reflected in the physical storage of the table such that the segments of the table are stored subsequently on a physical storage. Furthermore, the segments are units of database checkpointing and data migration. The segments adhere to the principles of a columnar database in that they contain sequences of column values of one or more columns of the table.
[0049]
[0050] The system 300 shown in
[0051] Whenever a change to a segment is detected, the one or more changed segments 31a, 31b, 31c are copied to the secondary memory 320. In that way, the secondary memory 320 functions as a checkpoint storage for changed segments. On a subsequent segment restore, demand paging can be used whereby segments are actually loaded to primary memory 310 when they are needed. For example, the primary memory 310 can be the working memory of a computing device which is hosting the database and a database management system managing the database.
[0052]
[0053] In step S430, the changed segments are copied to a checkpoint storage, which can be a persistent storage. In step S440, the frozen segments are released, i.e. the frozen segments are made available for future modifications. In step S450, the method ends. In other embodiments, instead of the method ending in step S450, the method can be executed iteratively, i.e. a new checkpoint is begun.
[0054] A further embodiment of the present disclosure is related to an implementation of the operation of data migration from primary memory to persistent storage by way of segment eviction. A special case of a segment eviction is an eviction of a full column, as illustrated in
[0055] The system 500 shown in
[0056] The steps of carrying out the segment eviction are illustrated in the flow chart in
[0057] In embodiments of the disclosure, as indicated in
[0058] A third embodiment of the disclosure is an implementation of an operation of segment restore, after the segments have been evicted before. The need for restore can result from a query that accesses the evicted data, for example an evicted column.
[0059] The corresponding method steps are illustrated in the flow chart shown in
[0060] The foregoing descriptions are only implementation manners of the present disclosure, but the protection of the scope of the present disclosure is not limited to this. Any variations or replacements can be easily made through the person skilled in the art. Therefore, the protection scope of the present disclosure should be subject to the protection scope of the attached claims.