Data storage method, device, equipment, storage medium and program product

By creating an intermediate-tier storage table in memory and sorting its data values, and replacing the data values ​​in the target storage table, the problem of low range query performance of LSMT structure is solved, and more efficient data query is achieved.

CN118152401BActive Publication Date: 2025-03-07北京力控元通科技有限公司
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202410344687.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-03-25
Publication Date
2025-03-07
Estimated Expiration
2044-03-25

AI Technical Summary

Technical Problem

The LSMT structure designed with key-value separation has inefficiency in scope query performance.

Method used

By creating an intermediate layer storage table in memory, the data values ​​are stored in the target storage table and the intermediate layer storage table at the same time. If the data storage rate of the intermediate layer storage table is greater than the preset storage rate, the data values ​​in the intermediate layer storage table are sorted, and the sorted data values ​​are replaced with the data values ​​in the target storage table.

Benefits of technology

By storing sorted data values ​​on the target disk, the performance of range query is improved, so that the search process can be carried out in sequence, significantly improving query efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118152401B_ABST
    Figure CN118152401B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of database technology, and discloses a data storage method, device, equipment, storage medium and program product. The present invention stores a data value in a target storage table to obtain a first data value; the target storage table is located in a target disk; the data value is stored in an intermediate storage table to obtain a second data value; the intermediate storage table is located in a memory; the intermediate storage table corresponds to the target storage table; if the data storage rate of the intermediate storage table is greater than a preset storage rate, the second data value is sorted to obtain a third data value; the third data value is stored in the target disk, and the target storage table is cleared. In this way, the sorted data values ​​can be stored in the target disk, so that they can be searched in order when searching, which improves the performance of range queries.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of database technology, and in particular to a data storage method, device, computer equipment, storage medium and program product. Background Art

[0002] Digital management will gather a large amount of information data. The database will use two LSMT (LogStructured Merge Tree) structures with key-value separation as the storage layer. While retaining the write performance advantage of the LSMT structure, it improves the write amplification problem of the LSMT structure. However, it also has the problem of low performance of range queries. Summary of the invention

[0003] In view of this, the present invention provides a data storage method, apparatus, computer equipment, storage medium and program product to solve the problem of low range query performance in the LSMT structure designed with key-value separation.

[0004] In a first aspect, the present invention provides a data storage method, the method comprising:

[0005] The data value is stored in a target storage table to obtain a first data value; the target storage table is located in a target disk;

[0006] The data value is stored in the intermediate storage table to obtain a second data value; the intermediate storage table is located in the memory; the intermediate storage table corresponds to the target storage table;

[0007] If the data storage rate of the intermediate storage table is greater than the preset storage rate, sorting the second data value to obtain a third data value;

[0008] The third data value is stored in the target disk, and the target storage table is cleared.

[0009] In this way, sorted data values ​​can be stored in the target disk, so that they can be searched in order, which improves the performance of range queries.

[0010] In an optional implementation, sorting the second data values ​​to obtain the third data value includes:

[0011] Obtaining label information of each data value in the second data value;

[0012] The data values ​​in the second data value are sorted based on the tag information to obtain a third data value.

[0013] In this way, sorting data values ​​according to label information can improve the efficiency of data query.

[0014] In an optional implementation, storing the third data value in the target disk and clearing the target storage table includes:

[0015] Based on the sequence information recorded in the intermediate storage table, determine the storage directory of the target storage table in the target disk;

[0016] Storing the third data value in the storage directory;

[0017] Clear the first data value in the storage directory.

[0018] In this way, the storage location of the target storage table can be determined based on the sequence information of the associated intermediate storage table and the target storage table, and the sorted third data value stored in the intermediate storage table can be stored in the same storage location of the target storage table, thereby achieving the replacement of the first data value with the third data value, so that the data value stored in the target disk is a sorted data value.

[0019] In an optional embodiment, the method further includes:

[0020] If the target storage table does not have a corresponding intermediate storage table, create an intermediate storage table in memory;

[0021] The sequence information of the target storage table is obtained and recorded to associate the intermediate storage table with the target storage table.

[0022] In an optional embodiment, the method further includes:

[0023] If the first data value is inconsistent with the second data value, obtaining the first data value in the target storage table;

[0024] The first data value is stored in the intermediate layer storage table to obtain the second data value.

[0025] In an optional implementation, after storing the third data value in the target storage table and clearing the target storage table, the method further includes:

[0026] Clear the intermediate storage table from memory.

[0027] In an optional implementation, the intermediate storage table corresponds to the target storage table, including:

[0028] The number of intermediate storage tables is consistent with the number of target storage tables, the storage space of the intermediate storage table is consistent with the storage space of the target storage table, the second data value in the intermediate storage table is consistent with the first data value in the target storage table, and the intermediate storage table records the sequence information of the target storage table.

[0029] In a second aspect, the present invention provides a data storage device, the device comprising:

[0030] A first data value storage module, used to store the data value in a target storage table to obtain a first data value; the target storage table is located in a target disk;

[0031] A second data value storage module is used to store the data value in an intermediate storage table to obtain a second data value; the intermediate storage table is located in the memory; the intermediate storage table corresponds to the target storage table;

[0032] A third data value determination module, configured to sort the second data values ​​to obtain a third data value if the data storage rate of the intermediate storage table is greater than a preset storage rate;

[0033] The third data value storage module is used to store the third data value in the target disk and clear the target storage table.

[0034] In a third aspect, the present invention provides a computer device, comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the data storage method of the first aspect or any corresponding embodiment thereof by executing the computer instructions.

[0035] In a fourth aspect, the present invention provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the data storage method of the first aspect or any corresponding embodiment thereof.

[0036] In a fifth aspect, the present invention provides a computer program product, comprising computer instructions for causing a computer to execute the data storage method of the first aspect or any corresponding embodiment thereof. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0038] Figure 1 is a schematic diagram of a flow chart of a data storage method according to an embodiment of the present invention;

[0039] Figure 2 is a flow chart of another data storage method according to an embodiment of the present invention;

[0040] Figure 3 is a flow chart of another data storage method according to an embodiment of the present invention;

[0041] Figure 4 is a structural block diagram of a data storage device according to an embodiment of the present invention;

[0042] Figure 5 It is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0043] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

[0044] Digital management will gather a large amount of information data. The database will use two LSMT (LogStructured Merge Tree) structures with key-value separation as the storage layer. While retaining the write performance advantage of the LSMT structure, it improves the write amplification problem of the LSMT structure. However, it also has the problem of low performance of range queries.

[0045] Based on this, an embodiment of the present invention provides a data storage method, which stores a data value in a target storage table to obtain a first data value; the target storage table is located in a target disk; the data value is stored in an intermediate storage table to obtain a second data value; the intermediate storage table is located in a memory; the intermediate storage table corresponds to the target storage table; if the data storage rate of the intermediate storage table is greater than a preset storage rate, the second data value is sorted to obtain a third data value; the third data value is stored in the target disk, and the target storage table is cleared. In this way, the sorted data values ​​can be stored in the target disk, so that they can be searched in order when searching, which improves the performance of range queries.

[0046] According to an embodiment of the present invention, a data storage method embodiment is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0047] In this embodiment, a data storage method is provided, which can be used in a database. Figure 1 is a flow chart of a data storage method according to an embodiment of the present invention. Figure 1 As shown, the process includes the following steps:

[0048] Step S101, storing the data value into a target storage table to obtain a first data value.

[0049] In the embodiment of the present invention, the target storage table is located in the target disk. The target storage table is SST (sorted string table), which is stored in the target disk and is used to store data values, which is equivalent to the SST used to store values ​​in the LSMT structure with key-value separation. The data value is the value of the data, and the first data value is the value of the data directly written into the target storage table after sorting, which is equivalent to the value stored separately in the LSMT structure with key-value separation.

[0050] Step S102: The data value is stored in the intermediate layer storage table to obtain a second data value.

[0051] In the embodiment of the present invention, the intermediate layer storage table is located in the memory. An intermediate layer is set in the memory, and an intermediate layer storage table is created in the intermediate layer for the target storage table, that is, the intermediate layer storage table corresponds to the target storage table. The data value stored in the intermediate layer storage table is the second data value. Since the intermediate layer storage table corresponds to the target storage table, and the data value is written to both the target storage table and the intermediate layer storage table when writing, the second data value should actually be consistent with the first data value.

[0052] In an optional implementation, the intermediate storage table corresponds to the target storage table, which is specifically embodied as follows: the number of intermediate storage tables is consistent with the number of target storage tables, the storage space of the intermediate storage table is consistent with the storage space of the target storage table, the second data value in the intermediate storage table is consistent with the first data value in the target storage table, and the intermediate storage table records the sequence information of the target storage table. Among them, the sequence information of the target storage table is the file sequence number of the target storage table, which is obtained by the target storage table from the file sequence of the database, and can uniquely identify a target storage table, which is equivalent to associating the data of the intermediate storage table and the target storage table. According to the sequence information, the corresponding target storage table can be found in the target disk.

[0053] In an optional implementation, when a data value is stored in a target storage table for the first time, or the storage space of a target storage table is full and a new target storage table needs to be created to continue storing data values, that is, when the target storage table does not have a corresponding intermediate-layer storage table, a new intermediate-layer storage table is created in memory, and the sequence information of the target storage table is obtained and recorded to associate the intermediate-layer storage table and the target storage table.

[0054] In an optional implementation, considering that abnormal situations such as power failure may cause loss of the intermediate storage table in the memory, if the first data value is inconsistent with the second data value, the first data value in the target storage table is obtained; the first data value is stored in the intermediate storage table to obtain the second data value. At this time, the existence of the target storage table can prevent data loss, thereby ensuring data integrity.

[0055] Step S103: if the data storage rate of the intermediate storage table is greater than the preset storage rate, the second data value is sorted to obtain a third data value.

[0056] In an embodiment of the present invention, if the data storage rate of the intermediate layer storage table is greater than the preset storage rate, data aggregation is performed on the intermediate layer storage table, that is, the second data values ​​stored in the intermediate layer storage table are sorted and re-stored in the sorted order to obtain the third data value.

[0057] In an optional implementation, when the storage space of a target storage table is exhausted, a new target storage table will be added to continue storing data values, and a new intermediate storage table will be created accordingly. At this time, multiple intermediate storage tables can be constructed into a group of intermediate storage tables, and correspondingly, their corresponding target storage tables also form a group of target storage tables. In this case, the data storage rate of multiple groups of intermediate storage tables can be used as a criterion for judging whether the second data value needs to be sorted. Specifically, the data storage rate of a group of intermediate storage tables can be used as a judgment criterion, or the data storage rate of all intermediate storage tables in multiple groups of intermediate storage tables can be used as a judgment criterion. For example, in a group of intermediate storage tables, when the data values ​​in the group of intermediate storage tables are full, the second data values ​​in the group of intermediate storage tables are sorted.

[0058] Step S104: store the third data value in the target disk, and clear the target storage table.

[0059] In an embodiment of the present invention, the third data value is stored in the storage location corresponding to the target storage table in the target disk, and the target storage table is cleared at the same time, thereby realizing the replacement of the first data value by the third data value, so that the data values ​​stored in the target disk are sorted, so that they can be directly searched in the sorted order during search, thereby improving the search efficiency.

[0060] In an optional implementation, after step S104, the method further includes a step of clearing the intermediate layer storage table from the memory, thereby releasing the memory occupied by the portion in the memory.

[0061] The data storage method provided by the embodiment of the present invention creates an intermediate storage table in the memory, and stores the data values ​​stored in the target storage table in the intermediate storage table at the same time. On the one hand, since the data values ​​are stored in the target storage table, the integrity of the data can be guaranteed when the data in the intermediate storage table is lost under abnormal circumstances. On the other hand, the data values ​​are sorted through the intermediate storage table and the data values ​​in the target storage table are replaced, so that the sorted data values ​​are stored in the target disk, and they can be searched in order when searching, thereby improving the performance of range queries.

[0062] In this embodiment, a data storage method is provided, which can be used for the above database. Figure 2 is a flow chart of another data storage method according to an embodiment of the present invention. Figure 2 As shown, the process includes the following steps:

[0063] Step S201: Store the data value in the target storage table to obtain the first data value. Figure 1 Step S101 of the illustrated embodiment will not be described in detail here.

[0064] Step S202: The data value is stored in the intermediate storage table to obtain a second data value. Figure 1 Step S102 of the illustrated embodiment will not be described in detail here.

[0065] Step S203: If the data storage rate of the intermediate storage table is greater than the preset storage rate, the second data value is sorted to obtain a third data value.

[0066] Specifically, the above step S203 includes:

[0067] Step S2031, obtaining label information of each data value in the second data value.

[0068] In the embodiment of the present invention, the tag information is a tag ID of the data, which can uniquely identify a piece of data.

[0069] Step S2032: sort the data values ​​in the second data value based on the tag information to obtain a third data value.

[0070] In the embodiment of the present invention, the tag information is used as a reference for sorting, and the data values ​​in the second data value are sorted in the order of the tag information from small to large or from large to small, and the data aggregation of the intermediate layer storage table is completed to obtain the third data value. The data values ​​in the third data value are arranged in the order of the tag information, so that when searching, the search can be performed in the order of the tag information, thereby improving the efficiency of data query.

[0071] Step S204: store the third data value in the target disk and clear the target storage table. Figure 1 Step S104 of the illustrated embodiment will not be described in detail here.

[0072] In this embodiment, a data storage method is provided, which can be used for the above database. Figure 3 is a flowchart of another data storage method according to an embodiment of the present invention. Figure 3 As shown, the process includes the following steps:

[0073] Step S301: Store the data value in the target storage table to obtain the first data value. Figure 1 Step S101 of the illustrated embodiment will not be described in detail here.

[0074] Step S302: The data value is stored in the intermediate storage table to obtain the second data value. Figure 1 Step S102 of the illustrated embodiment will not be described in detail here.

[0075] Step S303: If the data storage rate of the intermediate storage table is greater than the preset storage rate, the second data value is sorted to obtain a third data value. Figure 1 Step S103 of the illustrated embodiment will not be described in detail here.

[0076] Step S304: store the third data value in the target disk, and clear the target storage table.

[0077] Specifically, the above step S304 includes:

[0078] Step S3041: Determine the storage directory of the target storage table in the target disk based on the sequence information recorded in the intermediate storage table.

[0079] In an embodiment of the present invention, the sequence information of the target storage table is the file sequence number of the target storage table, which is obtained by the target storage table from the file sequence of the database and can uniquely identify a target storage table, which is equivalent to the data of the associated intermediate storage table and the target storage table. According to the sequence information, the corresponding target storage table can be found in the target disk, thereby determining the storage directory of the target storage table in the target disk.

[0080] Step S3042, store the third data value in the storage directory.

[0081] In the embodiment of the present invention, the third data value is stored in the storage directory to replace the first data value, thereby replacing the unsorted data value with the sorted data value, so that the data stored in the disk is finally sorted data value.

[0082] Step S3043, clear the first data value in the storage directory.

[0083] In the embodiment of the present invention, since the third data value has been used as a replacement for the first data value and stored in the same storage directory, the unsorted first data value is no longer necessary, and clearing the first data value at this time will not affect the integrity of the data. Therefore, in order to fully utilize the storage space of the target disk, after the third data value is stored in the storage directory, the first data value in the storage directory is cleared, that is, the target storage table is released. Therefore, according to the sequence information of the associated intermediate storage table and the target storage table, the storage location of the target storage table is determined, and the sorted third data value stored in the intermediate storage table is stored in the same storage location of the target storage table, thereby realizing the replacement of the first data value by the third data value, so that the data value stored in the target disk is the sorted data value.

[0084] In the present embodiment, a data storage device is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceived.

[0085] This embodiment provides a data storage device, such as Figure 4 As shown, including:

[0086] A first data value storage module 401 is used to store the data value in a target storage table to obtain a first data value; the target storage table is located in a target disk;

[0087] A second data value storage module 402 is used to store the data value in an intermediate storage table to obtain a second data value; the intermediate storage table is located in the memory; the intermediate storage table corresponds to the target storage table;

[0088] A third data value determination module 403, configured to sort the second data values ​​to obtain a third data value if the data storage rate of the intermediate storage table is greater than a preset storage rate;

[0089] The third data value storage module 404 is used to store the third data value in the target disk and clear the target storage table.

[0090] In an optional implementation, the third data value determination module 403 includes:

[0091] a label information acquisition unit, used to acquire label information of each data value in the second data value;

[0092] The sorting unit is used to sort the data values ​​in the second data value based on the tag information to obtain a third data value.

[0093] In an optional implementation, the third data value storage module 404 includes:

[0094] A storage directory determining unit, used to determine the storage directory of the target storage table in the target disk based on the sequence information recorded in the intermediate storage table;

[0095] A third data value storage unit, used to store the third data value in a storage directory;

[0096] The first data value clearing unit is used to clear the first data value in the storage directory.

[0097] In an optional embodiment, the device further includes:

[0098] The intermediate storage table creation module is used to create an intermediate storage table in memory if the target storage table does not have a corresponding intermediate storage table;

[0099] The sequence information acquisition unit is used to acquire and record the sequence information of the target storage table to associate the intermediate storage table with the target storage table.

[0100] In an optional embodiment, the device further includes:

[0101] A first data value acquisition unit, configured to acquire the first data value in the target storage table if the first data value is inconsistent with the second data value;

[0102] The first data value storage unit is used to store the first data value in the intermediate layer storage table to obtain the second data value.

[0103] In an optional embodiment, the device further includes:

[0104] The intermediate layer storage table clearing module is used to clear the intermediate layer storage table from the memory.

[0105] In an optional implementation, the intermediate storage table corresponds to the target storage table, including:

[0106] The number of intermediate storage tables is consistent with the number of target storage tables, the storage space of the intermediate storage table is consistent with the storage space of the target storage table, the second data value in the intermediate storage table is consistent with the first data value in the target storage table, and the intermediate storage table records the sequence information of the target storage table.

[0107] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.

[0108] The data storage device in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.

[0109] The embodiment of the present invention also provides a computer device having the above Figure 4 The data storage device shown.

[0110] See also Figure 5 , Figure 5 is a schematic diagram of the structure of a computer device provided by an optional embodiment of the present invention, such as Figure 5 As shown, the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the computer device, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple computer devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 5 A processor 10 is taken as an example.

[0111] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.

[0112] The memory 20 stores instructions executable by at least one processor 10, so that the at least one processor 10 executes the method shown in the above embodiment.

[0113] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0114] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.

[0115] The computer device further comprises a communication interface 30 for the computer device to communicate with other devices or a communication network.

[0116] The embodiment of the present invention also provides a computer-readable storage medium. The method according to the embodiment of the present invention can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium through a network download, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state hard disk, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.

[0117] A part of the present invention may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present invention through the operation of the computer. Those skilled in the art should understand that the existence of the computer program instruction in a computer-readable medium includes, but is not limited to, a source file, an executable file, an installation package file, etc., and accordingly, the way in which the computer program instruction is executed by the computer includes, but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium may be any available computer-readable storage medium or communication medium accessible to the computer.

[0118] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.

Claims

1. A data storage method, characterized in that: Applied to the LSMT structure of key-value separation, the method includes: Storing the data value in a target storage table to obtain a first data value; the target storage table is located in a target disk; The data value is stored in the intermediate storage table to obtain a second data value; the intermediate storage table is located in the memory; the intermediate storage table corresponds to the target storage table; the second data value in the intermediate storage table is consistent with the first data value in the target storage table, and the intermediate storage table records the sequence information of the target storage table; If the data storage rate of the intermediate storage table is greater than the preset storage rate, sorting the second data values ​​to obtain a third data value; storing the third data value in the target disk and clearing the target storage table; The step of storing the third data value in the target disk and clearing the target storage table comprises: Determine the storage directory of the target storage table in the target disk based on the sequence information recorded in the intermediate storage table; Storing the third data value in the storage directory; Clearing the first data value in the storage directory; When writing data values, they are written to both the target storage table and the intermediate storage table; The sorted third data values ​​stored in the intermediate storage table are stored in the same storage location of the target storage table.

2. The method according to claim 1, characterized in that The step of sorting the second data values ​​to obtain a third data value includes: Obtaining label information of each data value in the second data value; The respective data values ​​in the second data values ​​are sorted based on the tag information to obtain the third data value.

3. The method according to claim 1, characterized in that: The method further comprises: If the target storage table does not have a corresponding intermediate storage table, creating the intermediate storage table in the memory; The sequence information of the target storage table is acquired and recorded to associate the intermediate storage table with the target storage table.

4. The method according to claim 1, characterized in that: The method further comprises: If the first data value is inconsistent with the second data value, obtaining the first data value in the target storage table; The first data value is stored in the intermediate layer storage table to obtain the second data value.

5. The method according to claim 1, characterized in that After storing the third data value in the target disk and clearing the target storage table, the method further includes: The intermediate layer storage table is cleared from the memory.

6. The method according to any one of claims 1 to 5, characterized in that: The intermediate storage table corresponds to the target storage table and includes: The number of the intermediate storage tables is consistent with the number of the target storage tables, and the storage space of the intermediate storage tables is consistent with the storage space of the target storage tables.

7. A data storage device, characterized in that: Applied to the LSMT structure of key-value separation, the device comprises: A first data value storage module, used to store the data value into a target storage table to obtain a first data value; The target storage table is located in the target disk; A second data value storage module is used to store the data value in an intermediate storage table to obtain a second data value; the intermediate storage table is located in the memory; the intermediate storage table corresponds to the target storage table; the second data value in the intermediate storage table is consistent with the first data value in the target storage table, and the intermediate storage table records the sequence information of the target storage table; A third data value determination module, configured to sort the second data values ​​to obtain a third data value if the data storage rate of the intermediate storage table is greater than a preset storage rate; A third data value storage module, used for storing the third data value in the target disk and clearing the target storage table; Storing the data value in a target storage table to obtain a first data value; the target storage table is located in a target disk; The data value is stored in the intermediate storage table to obtain a second data value; the intermediate storage table is located in the memory; the intermediate storage table corresponds to the target storage table; the second data value in the intermediate storage table is consistent with the first data value in the target storage table, and the intermediate storage table records the sequence information of the target storage table; If the data storage rate of the intermediate storage table is greater than the preset storage rate, sorting the second data values ​​to obtain a third data value; Determine the storage directory of the target storage table in the target disk based on the sequence information recorded in the intermediate storage table; Storing the third data value in the storage directory; Clearing the first data value in the storage directory; When writing data values, they are written to both the target storage table and the intermediate storage table; The sorted third data values ​​stored in the intermediate storage table are stored in the same storage location of the target storage table.

8. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the data storage method according to any one of claims 1 to 6 by executing the computer instructions.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the data storage method according to any one of claims 1 to 6.

10. A computer program product, characterized in that The method comprises computer instructions for causing a computer to execute the data storage method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Method and device for writing index data into disk and terminal equipment

    CN113961153A