Data storage method and related device
By introducing intermediate tables and temporary tables in the data storage system, using the characteristics of solid-state drives and mechanical hard disks to distinguish external data and optimize the writing process, the problem of insufficient data writing performance in the existing hot and cold storage methods is solved, and the implementation of the implementation of More efficient data storage.
Patent Information
- Application Number
- CN202411381199.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-30
- Publication Date
- 2025-01-17
- Estimated Expiration
- 2044-09-30
AI Technical Summary
The existing hot and cold storage methods have shortcomings in data writing performance and cannot meet actual usage requirements.
By introducing intermediate tables and temporary tables in the data storage system, external data are divided into current data and historical data, and distinguished according to time or retrieval frequency, the high read and write performance of solid-state hard disk is used to directly write the current data, and the mechanical hard disk is used to use the high read and write performance of the solid-state hard disk. The storage capacity transfers historical data in large quantities and optimizes the data writing process.
It improves the performance of data writing, ensures real-time writing of external data and efficient storage of historical data, and improves the performance of mechanical hard disks.
Smart Images

Figure CN118939201B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of data storage, and in particular to a data storage method and related devices. Background Art
[0002] At present, in order to reduce the cost of data storage, hot and cold storage methods are often adopted, that is, using both solid-state drives and mechanical hard disks for data storage, storing hot data in solid-state drives and cold data in mechanical hard disks.
[0003] The inventors of the present application have discovered during a long period of research that the existing hot and cold storage methods have poor overall data writing performance and cannot meet actual usage requirements. Summary of the invention
[0004] The main technical problem solved by the present application is to provide a data storage method and related devices, which can improve the performance of data writing.
[0005] To solve the above technical problems, the first aspect of the present application provides a data storage method, which is applied to a data storage system including a solid-state hard drive and a mechanical hard drive, the data storage system corresponds to a business table, the business table corresponds to an intermediate table and a temporary table, the business table matches the storage areas of the solid-state hard drive and the mechanical hard drive, and the intermediate table and the temporary table match the storage area of the solid-state hard drive, including: in response to obtaining external data, dividing the external data into current data and historical data; writing the historical data into the current intermediate table, and writing the current data into the solid-state hard drive matching the business table; in response to the historical data in the current intermediate table satisfying the data transfer condition, converting the intermediate table storing data into a temporary table, converting the temporary table that does not store data into an intermediate table, and transferring the data in the temporary table storing data to the mechanical hard drive matching the business table.
[0006] To solve the above technical problems, the second aspect of the present application provides an electronic device, comprising a memory and a processor coupled to each other, wherein the memory stores program instructions, and the processor is used to execute the program instructions to implement the data storage method described in the first aspect.
[0007] In order to solve the above technical problem, the third aspect of the present application provides a computer-readable storage medium, which stores program instructions that can be executed by a processor, and the program instructions are used to implement the data storage method described in the first aspect.
[0008] To solve the above technical problems, the fourth aspect of the present application provides a data storage system, including a solid-state drive and a mechanical hard disk, and an electronic device as described in the second aspect above, and the electronic device is coupled to the solid-state drive and the mechanical hard disk.
[0009] In the above scheme, after obtaining external data, the external data is divided into current data and historical data, the historical data is written into the storage area of the solid-state hard disk matched by the current intermediate table, and the current data is written into the storage area of the solid-state hard disk matched by the business table. When the historical data in the current intermediate table meets the data transfer conditions, the intermediate table storing the data is converted into a temporary table, the temporary table not storing the data is converted into an intermediate table, and the data in the temporary table storing the data is written into the mechanical hard disk matched by the business table. Since the read and write performance of the solid-state hard disk is higher than that of the mechanical hard disk, it not only ensures the real-time performance of directly writing external data into the solid-state hard disk, but also ensures that the historical data can be written into the mechanical hard disk in large quantities from the intermediate table matching the solid-state hard disk as a whole, which has higher performance for the use of the mechanical hard disk, thereby improving the performance of data writing. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. Among them:
[0011] Figure 1 This is a flow chart of an implementation method of the data storage method of the present application;
[0012] Figure 2 It is a structural schematic diagram of an embodiment of the electronic device of the present application;
[0013] Figure 3 It is a schematic diagram of the structure of an embodiment of a computer-readable storage medium of the present application;
[0014] Figure 4 It is a structural diagram of an implementation scheme of the data storage system of the present application. DETAILED DESCRIPTION
[0015] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments, and different implementation methods can be adaptively combined. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0016] It should be noted that the technical solution of the present application can be applied to relational databases, such as PostgreSQL, MySql, etc., and can also be applied to non-relational databases, such as Elasticsearch.
[0017] See also Figure 1 , Figure 1 This is a flow chart of an implementation method of the data storage method of the present application. The data storage method is applied to a data storage system including a solid-state hard disk and a mechanical hard disk. The data storage system corresponds to a business table, and the business table corresponds to an intermediate table and a temporary table. The business table matches the storage area of the solid-state hard disk and the mechanical hard disk, and the intermediate table and the temporary table match the storage area of the solid-state hard disk. The data storage method includes:
[0018] S101: In response to obtaining external data, the external data is divided into current data and historical data.
[0019] Specifically, after the external data is obtained, the external data is divided into current data and historical data, wherein the current data is 'hot' data and the historical data is 'cold' data.
[0020] In one application mode, the external data corresponds to time information, and the external data is divided into current data and historical data based on the time information.
[0021] In one application scenario, the mechanical hard disk matched by the business table corresponds to a time threshold, where the time threshold refers to the boundary value used to distinguish the time boundary of the "cold and hot" states of the data. According to the time information corresponding to the external data and the time threshold corresponding to the mechanical hard disk, the external data is divided into current data and historical data.
[0022] In a specific application scenario, the time threshold corresponding to the mechanical hard disk matched by the business table is 12:00 on March 1, 2024. When the time information corresponding to the acquired external data is 12:00 on April 1, 2024, the external data is divided into current data. When the time information corresponding to the acquired external data is 12:00 on February 1, 2024, the external data is divided into historical data.
[0023] It should be noted that the time threshold corresponding to the mechanical hard disk can be set according to actual conditions, and this application does not make any specific restrictions here.
[0024] In another application mode, the external data corresponds to a retrieval frequency, and the external data is divided into current data and historical data based on the retrieval frequency.
[0025] In one application scenario, the mechanical hard disk matched by the business table corresponds to a frequency threshold, where the frequency threshold refers to the boundary value of the frequency boundary used to distinguish the "cold and hot" states of the data. According to the retrieval frequency corresponding to the external data and the frequency threshold corresponding to the mechanical hard disk, the external data is divided into current data and historical data.
[0026] In a specific application scenario, the frequency threshold corresponding to the mechanical hard disk matched by the business table is 12 queries within half a year. When the retrieval frequency corresponding to the acquired external data is 20 queries within half a year, the external data is classified as current data. When the retrieval frequency corresponding to the acquired external data is 6 queries within half a year, the external data is classified as historical data.
[0027] It should be noted that the frequency threshold corresponding to the mechanical hard disk can be set according to actual conditions, and this application does not make any specific restrictions here.
[0028] Optionally, after obtaining the external data, the external data may be pre-processed such as parsing and formatting to facilitate subsequent writing into the business table and the intermediate table.
[0029] S102: Write the historical data into the current intermediate table, and write the current data into the solid state drive that matches the business table.
[0030] Specifically, the historical data is written into the storage area of the solid-state hard disk that matches the current intermediate table, and the current data is written into the storage area of the solid-state hard disk that matches the business table.
[0031] In one application method, the storage area of the solid-state hard disk matched by the business table is divided into multiple storage partitions according to time information, and the storage area of the solid-state hard disk matched by the intermediate table is also divided into multiple storage partitions according to time information. Historical data is written into the storage partition corresponding to the solid-state hard disk matched by the current intermediate table according to the time information, and current data is written into the storage partition corresponding to the solid-state hard disk matched by the business table according to the time information.
[0032] In one application scenario, the storage area of the solid state drive matched by the business table is divided into multiple storage partitions according to a first preset time interval, and the storage area of the solid state drive matched by the intermediate table is divided into multiple storage partitions according to a second preset time interval.
[0033] In a specific application scenario, the storage area of the solid-state hard disk matched by the business table is partitioned according to the length of one day as the first preset time interval, and the multiple storage partitions include solid-state partition 1 (today), solid-state partition 2 (yesterday), solid-state partition 3 (the day before yesterday), etc. The storage area of the solid-state hard disk matched by the intermediate table is partitioned according to the length of 90 days as the second preset time interval, and the multiple storage partitions include temporary partition 1 (between 180 days ago and 90 days ago), temporary partition 2 (between 270 days ago and 180 days ago), etc. The current time is 12:00 on July 1, 2024, and the time threshold corresponding to the mechanical hard disk is 12:00 on April 2, 2024. When the time information corresponding to the current data is 9:00 on July 1, 2024, the current data is written into solid-state partition 1 (today), and when the time information corresponding to the historical data is 12:00 on February 1, 2024, the historical data is written into temporary partition 1 (between 180 days ago and 90 days ago).
[0034] It should be noted that the first preset time interval and the second preset time interval can be specifically set according to actual conditions, and this application does not make any specific restrictions here.
[0035] In another application method, the storage area of the solid-state hard disk matched by the business table is divided into multiple storage partitions according to the retrieval frequency, and the storage area of the solid-state hard disk matched by the intermediate table is also divided into multiple storage partitions according to the retrieval frequency. The historical data is written into the storage partition corresponding to the solid-state hard disk matched by the current intermediate table according to the retrieval frequency, and the current data is written into the storage partition corresponding to the solid-state hard disk matched by the business table according to the retrieval frequency.
[0036] In one application scenario, the storage area of the solid state drive matched by the business table is divided into multiple storage partitions according to a first preset frequency interval, and the storage area of the solid state drive matched by the intermediate table is divided into multiple storage partitions according to a second preset frequency interval.
[0037] In a specific application scenario, the storage area of the solid-state hard disk matched by the business table is partitioned according to the number of queries within half a year, which differs by 12 times as the first preset frequency interval, and the multiple storage partitions include solid-state partition 1 (query within half a year is between 36 and 47 times), solid-state partition 2 (query within half a year is between 24 and 35 times), solid-state partition 3 (query within half a year is between 12 and 23 times), etc. The storage area of the solid-state hard disk matched by the intermediate table is partitioned according to the number of queries within half a year, which differs by 3 times as the second preset frequency interval, and the multiple storage partitions include temporary partition 1 (query within half a year is between 9 and 11 times), temporary partition 2 (query within half a year is between 6 and 8 times), etc. The frequency threshold corresponding to the mechanical hard disk is 12 queries within half a year. When the retrieval frequency corresponding to the current data is 40 queries within half a year, the current data is written into solid-state partition 1 (query within half a year is between 36 and 47 times), and when the retrieval frequency corresponding to the historical data is 10 queries within half a year, the historical data is written into temporary partition 1 (query within half a year is between 9 and 11 times).
[0038] It should be noted that the first preset frequency interval and the second preset frequency interval can be specifically set according to actual conditions, and this application does not make any specific restrictions here.
[0039] S103: In response to the historical data in the current intermediate table satisfying the data transfer condition, the intermediate table storing the data is converted into a temporary table, the temporary table not storing the data is converted into the intermediate table, and the data in the temporary table storing the data is transferred to the mechanical hard disk matching the business table.
[0040] Specifically, when the historical data in the current intermediate table meets the data transfer conditions, the intermediate table storing the data is converted into a temporary table, the temporary table not storing the data is converted into an intermediate table, and the data in the temporary table storing the data is written into the mechanical hard disk matching the business table.
[0041] Optionally, the data transcription condition may be that the amount of historical data exceeds a data volume threshold, such as 500,000 or 1,000,000 records, etc., or that the amount of historical data stored in the intermediate table does not exceed the data volume threshold but the storage time exceeds a duration threshold, such as 24 hours or 48 hours, etc. This application does not impose any specific restrictions here.
[0042] It is understandable that the data storage system will determine whether the amount of historical data in the intermediate table exceeds the data amount threshold at regular intervals, for example, once every hour, etc. This application does not make specific restrictions here.
[0043] In one application mode, the intermediate table and the temporary table are converted by renaming.
[0044] In another application mode, the intermediate table and the temporary table are converted through a data conversion tool.
[0045] Optionally, the storage area of the mechanical hard disk matching the business table can be partitioned in the same manner as the storage area of the solid-state hard disk matching the intermediate table, thereby improving the efficiency of writing data from the intermediate table or temporary table storing data to the mechanical hard disk.
[0046] In the above scheme, after obtaining external data, the external data is divided into current data and historical data, the historical data is written into the storage area of the solid-state hard disk matched by the current intermediate table, and the current data is written into the storage area of the solid-state hard disk matched by the business table. When the historical data in the current intermediate table meets the data transfer conditions, the intermediate table storing the data is converted into a temporary table, the temporary table not storing the data is converted into an intermediate table, and the data in the temporary table storing the data is written into the mechanical hard disk matched by the business table. Since the read and write performance of the solid-state hard disk is higher than that of the mechanical hard disk, it not only ensures the real-time performance of directly writing external data into the solid-state hard disk, but also ensures that the historical data can be written into the mechanical hard disk in large quantities from the intermediate table matching the solid-state hard disk as a whole, which has higher performance for the use of the mechanical hard disk, thereby improving the performance of data writing.
[0047] In one embodiment, the external data corresponds to time information, and the mechanical hard disk corresponds to a time threshold. Step S101 divides the external data into current data and historical data, specifically including: obtaining current data and historical data based on the time information corresponding to the external data and the time threshold corresponding to the mechanical hard disk.
[0048] Specifically, each piece of external data corresponds to time information. The time information corresponding to the external data is compared with the time threshold corresponding to the mechanical hard disk. If the time information corresponding to the external data is greater than the time threshold corresponding to the mechanical hard disk, the external data will be classified as current data, otherwise the external data will be classified as historical data.
[0049] In one implementation scenario, in step S103, the intermediate table storing data is converted into a temporary table, the temporary table not storing data is converted into an intermediate table, and before the data in the temporary table storing data is transferred to the mechanical hard disk matching the business table, it also includes: recording the transcription time when the historical data in the current intermediate table meets the data transcription conditions; based on the transcription time, modifying the time threshold corresponding to the mechanical hard disk.
[0050] Specifically, when the historical data in the current intermediate table meets the data transfer condition, the corresponding transfer time is recorded, and the time threshold corresponding to the mechanical hard disk is modified according to the transfer time, so as to ensure the real-time performance of data writing.
[0051] In a specific implementation scenario, the current time is 12:00 on July 1, 2024, and the time threshold corresponding to the mechanical hard disk is 12:00 on April 2, 2024. After one hour, that is, at 13:00 on July 1, 2024, the amount of historical data obtained in the current intermediate table exceeds 1 million, and it is considered that the data transfer conditions have been met. Then, 13:00 on July 1, 2024 is recorded as the transfer time, and the time threshold corresponding to the mechanical hard disk is modified to 13:00 on April 2, 2024 according to the transfer time.
[0052] In another specific implementation scenario, the current time is 12:00 on July 1, 2024, and the time threshold corresponding to the mechanical hard disk is 12:00 on April 2, 2024. After one day, that is, 13:00 on July 1, 2024, the amount of historical data obtained in the current intermediate table does not exceed 1 million and the storage time exceeds 24 hours. It is considered that the data transfer conditions are met, and 13:00 on July 2, 2024 is recorded as the transfer time. According to the transfer time, the time threshold corresponding to the mechanical hard disk is modified to 13:00 on April 3, 2024.
[0053] It is understandable that the difference in duration between the transfer time and the time threshold corresponding to the mechanical hard disk will not change and can be set according to actual conditions. This application does not make any specific restrictions here.
[0054] In one implementation scenario, the data storage method also includes: in response to the time information of the current data in the solid-state hard disk matched by the business table being less than the time threshold corresponding to the modified mechanical hard disk, transferring at least part of the data in the solid-state hard disk matched by the business table before the modified time threshold to the mechanical hard disk matched by the business table.
[0055] Specifically, when the time information of the current data in the solid-state hard disk matched by the business table is less than the time threshold corresponding to the modified mechanical hard disk, at least part of the data before the time threshold in the solid-state hard disk matched by the business table is written to the mechanical hard disk matched by the business table, thereby reducing the space occupied by the solid-state hard disk and optimizing data storage, thereby improving the overall read and write performance of the data storage system.
[0056] In a specific implementation scenario, when the time information of a current data in the solid-state drive is 12:30 on April 2, 2024, and the original time threshold corresponding to the mechanical hard disk is 12:00 on April 2, 2024, after modification, the corresponding time threshold is 13:00 on April 2, 2024, then the current data becomes historical data, and at least part of the data in the solid-state drive before 13:00 on April 2, 2024 is written to the mechanical hard disk.
[0057] It should be noted that once the current data is written into a specific storage partition, it will remain in the storage partition and will not be automatically written into other storage partitions. For example, if today's data is written into SSD partition 1 (today), then even if the time enters the next day, these data will not be automatically transferred to SSD partition 2 (yesterday). Only when these current data become historical data will at least part of the data that has become historical data be written into the mechanical hard disk, while some of the data that has not been transferred will still remain in the storage partition of the SSD, avoiding data loss and reducing data fragmentation, thereby improving the overall performance and stability of the data storage system.
[0058] In one embodiment, after writing the current data to the solid-state hard disk matched by the business table in step S102, it also includes: in response to the amount of data stored in the solid-state hard disk matched by the business table exceeding a first data amount threshold, transferring at least part of the data in the solid-state hard disk matched by the business table to the mechanical hard disk matched by the business table.
[0059] Specifically, when the amount of data stored in the solid-state hard disk matched by the business table exceeds a first data amount threshold, at least part of the data in the solid-state hard disk matched by the business table is transferred to the mechanical hard disk matched by the business table. By regularly organizing the data stored in the solid-state hard disk, the wear of the solid-state hard disk can be reduced, and the service life of the solid-state hard disk can be extended, thereby improving the stability of the data storage system.
[0060] In one implementation scenario, when the amount of data stored in the solid-state drive exceeds 80% of the capacity of the solid-state drive, the data in the solid-state partition with the oldest partition time in the solid-state drive is transferred to the mechanical hard disk.
[0061] Optionally, the first data volume threshold may be specifically set according to actual conditions, and this application does not impose any specific limitation thereto.
[0062] In one implementation scenario, the intermediate table corresponds to a first name, and the temporary table corresponds to a second name; in step S103, the intermediate table storing data is converted into a temporary table, and the temporary table not storing data is converted into the intermediate table specifically including: modifying the second name corresponding to the temporary table not storing data into a third name; modifying the first name corresponding to the intermediate table storing data into the second name corresponding to the temporary table; and modifying the third name corresponding to the temporary table not storing data into the first name corresponding to the intermediate table.
[0063] Specifically, after changing the second name corresponding to the temporary table that does not store data to the third name, the first name corresponding to the intermediate table that stores data is changed to the second name corresponding to the temporary table, and then the third name corresponding to the temporary table that does not store data is changed to the first name corresponding to the intermediate table. This ensures that there is always one table writing historical data while the other table is writing historical data to the mechanical hard disk, which does not damage the performance of the data storage system and avoids the situation where the database table is locked.
[0064] In one embodiment, after transferring the data in the temporary table storing the data to the mechanical hard disk matching the business table in step S103, it also includes: in response to the amount of data stored in the mechanical hard disk matching the business table exceeding a second data amount threshold, deleting at least part of the data in the mechanical hard disk matching the business table, and continuing to transfer the remaining data in the temporary table storing the data to the mechanical hard disk matching the business table.
[0065] Specifically, when the amount of data stored in the mechanical hard disk matched by the business table exceeds a second data amount threshold, at least part of the data in the mechanical hard disk matched by the business table is deleted, and the remaining data in the temporary table storing the data is continued to be transferred to the mechanical hard disk matched by the business table, so as to ensure that one of the data tables of the intermediate table and the temporary table is always in a clear state, ensuring that historical data can be written in large quantities to the mechanical hard disk, thereby improving the performance of data writing, and by regularly deleting infrequently used data in the mechanical hard disk, the performance of the mechanical hard disk can be improved and the service life of the mechanical hard disk can be extended.
[0066] See also Figure 2 , Figure 22 is a schematic diagram of the structure of an embodiment of an electronic device of the present application. The electronic device 20 includes a memory 201 and a processor 202 coupled to each other, wherein the memory 201 stores program data (not shown), and the processor 202 calls the program data to implement the method in any of the above embodiments. For the description of the relevant content, please refer to the detailed description of the above method embodiment, which will not be repeated here. Specifically, the electronic device 20 includes but is not limited to: a desktop computer, a laptop computer, a tablet computer, a server, etc., which are not limited here. In addition, the processor 202 can also be called a CPU (Center Processing Unit). The processor 202 may be an integrated circuit chip with signal processing capabilities. The processor 202 may also be a general-purpose processor, a digital signal processor (Digital Signal Processor, DSP), an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), a field-programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. In addition, the processor 202 may be implemented by an integrated circuit chip.
[0067] See also Figure 3 , Figure 3 It is a structural diagram of an implementation method of a computer-readable storage medium of the present application. The computer-readable storage medium 30 stores program data 300. When the program data 300 is executed by a processor, the method in any of the above embodiments is implemented. For an explanation of the relevant content, please refer to the detailed description of the above method embodiments, which will not be repeated here.
[0068] It should be noted that the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present implementation scheme.
[0069] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0070] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) or a processor to execute all or part of the steps of each implementation method of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc., and other media that can store program codes.
[0071] See also Figure 4 , Figure 4 1 is a schematic diagram of a data storage system of the present application. The data storage system 40 includes a solid state drive 400 and a mechanical hard disk 402, and the electronic device 20 as described above, and the electronic device 20 is coupled to the solid state drive 400 and the mechanical hard disk 402. For the description of the relevant contents, please refer to the detailed description of the above method embodiment, which will not be repeated here.
[0072] The above description is only an implementation method of the present application, and does not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly used in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. A data storage method, characterized in that: Applied to a data storage system including a solid-state hard disk and a mechanical hard disk, the data storage system corresponds to a business table, the business table corresponds to an intermediate table and a temporary table, the business table matches the storage area of the solid-state hard disk and the mechanical hard disk, the intermediate table and the temporary table match the storage area of the solid-state hard disk, including: In response to obtaining external data, dividing the external data into current data and historical data; Writing the historical data into the current intermediate table, and writing the current data into the solid-state hard disk that matches the business table; wherein writing into the current intermediate table means writing into the storage area of the solid-state hard disk that matches the intermediate table, and writing into the solid-state hard disk that matches the business table means writing into the storage area of the solid-state hard disk that matches the business table; In response to the historical data in the current intermediate table satisfying the data transfer conditions, the intermediate table storing the data is converted into a temporary table, the temporary table not storing the data is converted into an intermediate table, and the data in the temporary table storing the data is transferred to the mechanical hard disk matching the business table; wherein, the data in the temporary table storing the data represents the data in the storage area of the solid-state hard disk matching the temporary table, and the transfer to the mechanical hard disk matching the business table represents the transfer to the storage area of the mechanical hard disk matching the business table.
2. The data storage method according to claim 1, characterized in that: The external data corresponds to time information, and the mechanical hard disk corresponds to a time threshold; The dividing the external data into current data and historical data comprises: The current data and the historical data are obtained based on the time information corresponding to the external data and the time threshold corresponding to the mechanical hard disk.
3. The data storage method according to claim 2, characterized in that: Before converting the intermediate table storing data into a temporary table, converting the temporary table not storing data into the intermediate table, and transferring the data in the temporary table storing data to the mechanical hard disk matching the business table, the method further includes: Record the transfer time when the historical data in the current intermediate table meets the data transfer conditions; Based on the transfer time, the time threshold corresponding to the mechanical hard disk is modified.
4. The data storage method according to claim 3, characterized in that: Also includes: In response to the time information of the current data in the solid-state hard disk matched by the business table being less than the modified time threshold corresponding to the mechanical hard disk, at least part of the data before the modified time threshold in the solid-state hard disk matched by the business table is transferred to the mechanical hard disk matched by the business table.
5. The data storage method according to claim 1, characterized in that: After writing the current data into the solid state hard disk matched with the business table, the method further includes: In response to the amount of data stored in the solid state drive matched by the business table exceeding a first data amount threshold, at least part of the data in the solid state drive matched by the business table is transferred to the mechanical hard disk matched by the business table.
6. The data storage method according to claim 1, characterized in that: The intermediate table corresponds to a first name, and the temporary table corresponds to a second name; The step of converting the intermediate table storing data into a temporary table and converting the temporary table not storing data into the intermediate table includes: Change the second name corresponding to the temporary table that does not store data to the third name; Modify the first name corresponding to the intermediate table storing the data into the second name corresponding to the temporary table; The third name corresponding to the temporary table that does not store data is changed to the first name corresponding to the intermediate table.
7. The data storage method according to claim 1, characterized in that: After transferring the data in the temporary table storing the data to the mechanical hard disk matching the business table, the method further includes: In response to the amount of data stored in the mechanical hard disk matching the business table exceeding a second data amount threshold, at least part of the data in the mechanical hard disk matching the business table is deleted, and the remaining data in the temporary table storing the data continues to be transferred to the mechanical hard disk matching the business table.
8. An electronic device, characterized in that: It comprises a memory and a processor coupled to each other, wherein the memory stores program instructions, and the processor is used to execute the program instructions to implement the data storage method according to any one of claims 1 to 7.
9. A computer-readable storage medium, characterized in that: Program instructions that can be executed by a processor are stored, and the program instructions are used to implement the data storage method according to any one of claims 1 to 7.
10. A data storage system, characterized in that: It includes a solid state drive and a mechanical hard disk, and an electronic device as described in claim 8, and the electronic device is coupled to the solid state drive and the mechanical hard disk.
Citation Information
Patent Citations
Hybrid storage subsystem
CN102667704A
Data life cycle management method and device
CN113656380A