Data compression method and related device

By mapping data pages to logical blocks and determining whether to compress them based on attribute information, the problem of resource waste in existing technologies is solved, achieving more efficient data compression and saving system resources.

WO2026113307A1PCT designated stage Publication Date: 2026-06-04HUAWEI CLOUD COMPUTING TECHNOLOGIES CO LTD

Patent Information

Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
HUAWEI CLOUD COMPUTING TECHNOLOGIES CO LTD
Filing Date
2025-06-04
Publication Date
2026-06-04

AI Technical Summary

Technical Problem

Existing data compression methods still consume system resources even when there is only a small amount of cold data or no cold data in the data page, resulting in a waste of I/O resources.

Method used

By mapping multiple data pages to logical blocks, the system determines whether to compress data based on the attribute information of the logical blocks. Compression is only performed when the total size of cold data is greater than or equal to a first threshold, thus avoiding unnecessary compression operations.

Benefits of technology

It reduces I/O overhead, saves system resources, improves compression efficiency, and makes better use of computing resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2025098970_04062026_PF_FP_ABST
    Figure CN2025098970_04062026_PF_FP_ABST
Patent Text Reader

Abstract

A data compression method and a related device, used for reducing I / O overhead. The data compression method comprises: acquiring attribute information of a logic block, wherein the logic block comprises a plurality of data pages, and the attribute information indicates data sizes of data contained in the plurality of data pages across a plurality of time periods; if the attribute information indicates that the total data size of the data contained in the plurality of data pages during a target time period is greater than or equal to a first threshold, compressing the data contained in the logic block, and storing the result obtained by compression, wherein the target time period includes at least time period among the plurality of time periods, and the time interval between the target time period and the current moment is greater than or equal to a time threshold; and if the attribute information indicates that the total data size of the data contained in the plurality of data pages during the target time period is less than the first threshold, determining not to compress the data contained in the logic block.
Need to check novelty before this filing date? Find Prior Art

Description

A data compression method and related equipment

[0001] This application claims priority to Chinese Patent Application No. 202411751593.5, filed with the State Intellectual Property Office of China on November 30, 2024, entitled “A Data Compression Method and Related Equipment”, the entire contents of which are incorporated herein by reference. Technical Field

[0002] This application relates to the field of computers, and more particularly to a data compression method and related equipment. Background Technology

[0003] With the continuous development of database technology, data compression has become a key means to improve storage efficiency, optimize performance, and reduce storage and operating costs. In practical applications, choosing the right compression method has become a pressing issue.

[0004] One data compression method employs row-level scanning granularity. The compression task traverses all data pages in the data table, scanning each row of data in each page sequentially. By recording the timestamp and compression status of each row, uncompressed cold data is identified from the data pages. If cold data offers a compression benefit, compression is performed on that data page, even if the cold data is only a portion of its content.

[0005] In this compression method, the compression task needs to traverse all data page by page and read the timestamp and compression status of each line to determine whether to perform compression. For scenarios where there is only a small amount of cold data or no cold data in the data page, this method still consumes system resources, resulting in a large waste of input / output (I / O) resources. Summary of the Invention

[0006] This application provides a data compression method and related equipment to reduce I / O overhead and save system resources.

[0007] Firstly, this application provides a data compression method, including:

[0008] Obtain the attribute information of a logical block, which comprises multiple data pages. The attribute information indicates the data size of the data pages across multiple time periods. If the attribute information indicates that the total data size of the data pages within a target time period is greater than or equal to a first threshold, compress the data within the logical block and store the compressed result. The target time period includes at least one of multiple time periods, and the time interval between the target time period and the current time is greater than or equal to a time threshold. If the attribute information indicates that the total data size of the data pages within a target time period is less than the first threshold, then it is determined that the data within the logical block will not be compressed. That is, no processing is performed on the data within the logical block.

[0009] In this application, multiple data pages are mapped to logical blocks, and the decision to compress the data contained within a logical block is determined based on the block's attribute information. Specifically, the attribute information indicates the data size of the multiple data pages within the logical block at different time periods. The data within the logical block is compressed only if the total data size of the cold data in these multiple data pages is greater than or equal to a first threshold. Otherwise, the data within the logical block is not compressed. The timestamps of the cold data are located within the target time period. In other words, for logical blocks where the total data size of the cold data is less than the first threshold, no compression operation is performed, reducing I / O overhead and saving system resources.

[0010] In some alternative implementations of the first aspect, the attribute information includes time period information and data size information corresponding to the time period information. The time period information indicates the time period in which the timestamp of the data is located. The data size information indicates the data volume, and the first threshold includes a data volume threshold. Alternatively, the data size information indicates the number of data rows, and the first threshold includes a data row count threshold.

[0011] In this application, the attribute information includes time period information and the corresponding data scale. Based on the attribute information, the relationship between the total data scale of the target time period and the first threshold can be determined, thereby determining whether the data of the corresponding logical block needs to be compressed. This provides technical support for the implementation of the technical solution of this application and improves the feasibility of the technical solution. In addition, the data scale includes the data volume or the number of data rows, which enriches the implementation methods and application scenarios of the technical solution of this application.

[0012] In some optional implementations of the first aspect, before obtaining the attribute information of the logic block, a first correspondence set is also obtained. This first correspondence set indicates a one-to-one correspondence between the identifiers and attribute information of multiple logic blocks. The identifier of the logic block is obtained, as it uniquely identifies the logic block. Then, obtaining the attribute information of the logic block specifically involves retrieving the attribute information corresponding to the logic block from the first correspondence set based on its identifier.

[0013] In this application, an attribute information is maintained for each logical block, and a one-to-one correspondence between the identifiers of multiple logical blocks and the attribute information is stored in a first correspondence set. Therefore, based on the identifier of the logical block, the attribute information can be determined from the first correspondence set. This provides technical support for the implementation of the technical solution of this application and improves its feasibility.

[0014] In several possible implementations of the first aspect, obtaining the identifier of the logical block can take several forms. Optionally, a second correspondence set is obtained, which includes the correspondence between logical block identifiers and data page numbers, where one logical block identifier corresponds to multiple data page numbers, and one data page number uniquely corresponds to one logical block identifier. The number of the currently read data page is then obtained. Based on the number of the currently read data page, the identifier of the logical block is determined from the second correspondence set.

[0015] In this application, the identifier of the logical block where the currently read data page is located is directly determined based on the second correspondence set, which is simple to operate and saves computing resources.

[0016] In some optional implementations of the first aspect, the identifier of the logical block can also be obtained based on the following methods: Obtain the number of the currently read data page, the data size of the data page, and the data size of the logical block. Based on the number of the currently read data page, the data size of the data page, and the data size of the logical block, determine the number of the target data page in the logical block; the target data page is either the starting data page or the ending data page of the logical block. Based on the number of the target data page and the target data size, determine the identifier of the logical block; the target data size is either the data size of the logical block or the data size of any data page within the logical block.

[0017] In this application, the target data page within the logical block containing the currently read data page is determined by its number. This target data volume is then combined with the target data volume to determine the identifier of the logical block. The target data page can be either the starting or ending data page of the logical block; the target data volume can be either the data volume of a data page or the data volume of a logical block. This provides multiple possibilities for the implementation of the technical solution in this application, enriching the application scenarios and implementation methods.

[0018] In some optional implementations of the first aspect, the identifier of the logical block can also be obtained based on the following method: Obtain the number of the currently read data page and the target data volume, where the target data volume is the data volume of the logical block, or the data volume of any one of multiple data pages. Determine the target identifier based on the number of the currently read data page and the target data volume. Determine the identifier of the logical block based on the identifier corresponding to the currently read logical page and the first correspondence set, where the target identifier is the same as the identifier of the logical block, or the target identifier is less than or greater than the identifier of the logical block, and the identifier of the logical block is closest to the target identifier in the correspondence set.

[0019] In this application, a target identifier is determined based on the number of the currently read data page and the target data volume. This target identifier is then compared with the identifiers of the logical blocks included in the first correspondence set to determine the identifier of the logical block containing the currently read data page. Since the relationship between the identifier of the logical block defined by the system configuration and the target data volume can be varied, and the server can determine the identifier of the logical block in multiple ways, this enriches the application scenarios of the technical solution in this application and improves its flexibility.

[0020] In some optional implementations of the first aspect, the data included in the compression logic block refers to the data page containing the cold data obtained from multiple data pages, where the timestamp of the cold data is located within the target time period. Compression is then performed on the data page containing the cold data. In other words, the data actually compressed is the cold data within the logic block that is located within the target time period.

[0021] In this application, the compressed data is cold data located in the target time period. Cold data has a low probability of being accessed again, and compressing it is in line with the data access pattern.

[0022] Secondly, this application provides a data compression apparatus, comprising:

[0023] An acquisition unit is used to acquire attribute information of a logical block, wherein the logical block includes multiple data pages, and the attribute information indicates the data scale of the data included in the multiple data pages in multiple time periods;

[0024] A processing unit is configured to compress the data included in the logic block and store the compressed result if the attribute information indicates that the total data size of the data included in the plurality of data pages in the target time period is greater than or equal to a first threshold; wherein the target time period includes at least one of the plurality of time periods, and the time interval between the target time period and the current time is greater than or equal to a time threshold.

[0025] The processing unit is further configured to determine not to compress the data included in the logical block if the attribute information indicates that the total data size of the data included in the plurality of data pages in the target time period is less than the first threshold.

[0026] The data compression device is used to implement the method shown in the first aspect or any possible implementation of the first aspect, which will not be described in detail here.

[0027] Thirdly, this application provides a computing device including a processor and a memory. The processor of the computing device is used to execute instructions stored in the memory, causing the computing device to implement the method shown in the first aspect or any possible implementation of the first aspect.

[0028] Fourthly, this application provides a computing device cluster, including at least one computing device, each computing device including a processor and a memory; the processor of the at least one computing device is used to execute instructions stored in the memory of the at least one computing device, so that the computing device cluster implements the method disclosed in the first aspect or any possible implementation of the first aspect.

[0029] Fifthly, this application provides a computer program product containing instructions that, when executed on a processor, implement the method shown in the first aspect or any possible implementation of the first aspect; or, when the instructions are run by a cluster of computer devices, cause the cluster of computer devices to implement the method disclosed in the first aspect or any possible implementation of the first aspect.

[0030] Sixthly, this application provides a computer-readable storage medium storing computer program instructions that, when executed on a processor, implement the method described in the first aspect or any possible implementation of the first aspect; or, when executed by a cluster of computer devices, cause the cluster of computer devices to implement the method disclosed in the first aspect or any possible implementation of the first aspect.

[0031] The beneficial effects shown in any of the second to sixth aspects are similar to those of the first aspect or any possible implementation of the first aspect, and will not be repeated here. Attached Figure Description

[0032] Figure 1 is a schematic diagram of a system architecture provided in an embodiment of this application;

[0033] Figure 2 is a schematic diagram of another system architecture provided in an embodiment of this application;

[0034] Figure 3 is a flowchart illustrating a data compression method provided in an embodiment of this application;

[0035] Figure 4 is a schematic diagram of the logic block provided in an embodiment of this application;

[0036] Figure 5 is a schematic diagram of a histogram provided in an embodiment of this application;

[0037] Figure 6 is another flowchart illustrating the data compression method provided in an embodiment of this application;

[0038] Figure 7 is a schematic diagram of a data compression device provided in an embodiment of this application;

[0039] Figure 8 is a schematic diagram of a computing device provided in an embodiment of this application;

[0040] Figure 9 is a schematic diagram of a computing device cluster provided in an embodiment of this application;

[0041] Figure 10 is another schematic diagram of the computing device cluster provided in the embodiment of this application. Detailed Implementation

[0042] This application provides a data compression method and related equipment to reduce I / O overhead and save system resources.

[0043] The embodiments of this application will now be described with reference to the accompanying drawings. Those skilled in the art will recognize that, with technological advancements and the emergence of new scenarios, the technical solutions provided in the embodiments of this application are equally applicable to similar technical problems.

[0044] The terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such terms are interchangeable where appropriate; this is merely a way of distinguishing objects with the same attributes in the embodiments of this application. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion, so that a process, method, system, product, or apparatus that comprises a series of units is not necessarily limited to those units, but may include other units not explicitly listed or inherent to those processes, methods, products, or apparatuses. Additionally, "at least one" means one or more, and "more than one" means two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one of the following" or similar expressions refer to any combination of these items, including any combination of single or multiple items. For example, at least one of a, b, or c can be expressed as: a, b, c, ab, ac, bc, or abc, where a, b, and c can be single or multiple.

[0045] First, please refer to Figures 1 and 2, which are schematic diagrams of the system architecture provided in the embodiments of this application.

[0046] As shown in Figure 1, a communication connection is established between the terminal device and the server. Based on this connection, the terminal device accesses data stored on the server or uses services provided by the server. In the data compression method provided in this embodiment, the user can trigger the server to perform a data compression operation through the terminal device. The server responds to the instruction from the terminal device and, based on this instruction, compresses the data stored on the server or the data managed by the server. The specific implementation process of data compression will be described in detail later and will not be elaborated here.

[0047] The technical solutions provided in this application can also be applied to cloud computing scenarios. As shown in Figure 2, tenants log in to the cloud service platform via the Internet using a terminal device and an account and password registered on the cloud service platform. The cloud service platform manages the infrastructure, which includes multiple data centers located in different regions. For example, region 1 in Figure 2 includes cloud data center 1 and cloud data center 2, and region 2 includes cloud data center 3 and cloud data center 4. Each cloud data center has multiple servers, and the servers run business instances (including at least one of virtual machines, containers, and dedicated hosts).

[0048] In this embodiment, a data compression service is deployed in the business instance. The tenant purchases cloud services through a client on the cloud service platform and sends a request to the cloud service platform to request cloud services. The specific content of the cloud services includes providing the tenant with the data compression method described below.

[0049] In summary, the data compression method provided in this application can be applied to servers, virtual machines, cloud service platforms, etc. In the following description, a server is used as the execution subject. The implementation process for other types of execution subjects is similar.

[0050] It should be noted that the terminal device mentioned in the embodiments of this application can be a device with wireless transceiver function, specifically referring to user equipment (UE), access terminal, subscriber unit, user station, mobile station, remote station, remote terminal, mobile device, user terminal, wireless communication device, user agent, or user device. Terminal devices can also be satellite phones, cellular phones, smartphones, wireless data cards, wireless modems, machine-type communication devices, cordless phones, session initiation protocol (SIP) phones, wireless local loop (WLL) stations, personal digital assistants (PDAs), handheld devices with wireless communication capabilities, computing devices or other processing devices connected to a wireless modem, in-vehicle devices, communication devices mounted on high-altitude aircraft, wearable devices, drones, robots, terminals in device-to-device (D2D) communication, terminals in vehicle-to-everything (V2X) communication, virtual reality (VR) terminal devices, augmented reality (AR) terminal devices, mixed reality (MR) terminal devices, wireless terminals in industrial control, wireless terminals in self-driving, wireless terminals in remote medical care, wireless terminals in smart grids, wireless terminals in transportation safety, and wireless terminals in smart cities. This application does not limit the scope of wireless terminals, such as those in a city, smart homes, or future communication networks.

[0051] In addition, in the embodiments of this application, there may be more or fewer terminal devices in this communication system. The number and type of terminal devices are determined according to actual needs, and are not limited here.

[0052] Please refer to Figure 3 below. Figure 3 is a flowchart illustrating the data compression method provided in this embodiment of the application, including:

[0053] 301. Obtain the attribute information of the logical block. The logical block includes multiple data pages. The attribute information indicates the data scale of the data included in the multiple data pages in multiple time periods.

[0054] A database runs on the server, or the server manages the database. Data in the database is stored in the form of data pages, with each data page containing the same amount of data. In this embodiment, multiple consecutive data pages are mapped to a logical block. This operation can also be understood as logically dividing the data into blocks, each logical block comprising multiple consecutive data pages. Furthermore, the amount of data in each logical block is the same; that is, each logical block includes the same number of data pages.

[0055] For example, please refer to Figure 4, which is a schematic diagram of a logic block provided in an embodiment of this application. In the embodiment shown in Figure 4, N logic blocks are set, and each logic block includes n data pages. Logic block 1 includes data pages 0 to n-1, and logic block 2 includes data pages n to n-1.

[0056] In this embodiment, the granularity of the logic block is controllable; that is, the amount of data included in a logic block, or the number of logic blocks, can be set based on the needs of the actual application. Optionally, the amount of data included in a logic block, or the number of logic blocks, can be set by the user or defined by system parameters.

[0057] For example, assume that the data size of each data page in the database is fixed at 30MB. If the user-defined logical block size is 500MB, then each logical block includes 16 data pages. If the user-defined logical block size is 600MB, then each logical block includes 20 data pages.

[0058] For example, suppose the database has a storage capacity of 100GB, and each data page has a fixed size of 64MB. If the user sets the number of logical blocks to 200, then each logical block will have a size of 512MB, comprising 8 data pages. If the user sets the number of logical blocks to 100, then each logical block will have a size of 1024MB, comprising 16 data pages.

[0059] During database operation, the database responds to data read / write operations, and the data in the database is updated accordingly, including being read, written with new data, modified, and deleted. The server obtains the attribute information of logical blocks, which indicates the data scale of the logical block at different times. In other words, the attribute information reflects the distribution of data in the logical block.

[0060] Furthermore, the attribute information includes time period information and the corresponding data scale information. The time period information indicates the time period in which the data's timestamp falls. The data's timestamp represents the time when the data was most recently or last updated. The data scale information indicates the amount of data or the number of rows, reflecting the data scale for the corresponding time period.

[0061] In practical applications, attribute information can be represented in various ways, including histograms, tables, key-value pairs, etc. The following diagrams provide a more intuitive explanation of attribute information. Please refer to Figure 5, which is a schematic diagram of a histogram provided in an embodiment of this application.

[0062] As shown in Figure 5, the histogram can visually display the amount of data in each time period, reflecting the data scale of the data included in the logic block in each time period. For example, the timestamps of data with a volume of m1 in the logic block are located in the time period from t0 to t1, the timestamps of data with a volume of m2 are located in the time period from t1 to t2, the timestamps of data with a volume of m3 are located in the time period from t2 to t3, and the timestamps of data with a volume of m4 are located in the time period from t3 to t4.

[0063] It should be noted that the histogram shown in Figure 5 is an example of a histogram with equal width, meaning that the duration of each time period in Figure 5 is the same. In practical applications, the histogram can also be in the form of an equal-height histogram, a compressed histogram, etc., and the specific form is not limited here.

[0064] Optionally, attribute information can also be represented in tabular form. For example, Table 1 below shows an example of attribute information:

[0065] Table 1

[0066] Table 1 shows the data size of each logical block in data table t at different time periods. As shown in Table 1, the data size of logical block chunk_0 is M1 in time period T1, M2 in time period T2, M3 in time period T3, and M4 in time period T4.

[0067] Similarly, the duration of each time period in Table 1 can be the same or different; no specific restrictions are imposed here. Additionally, time periods can also be represented by a start time and an end time, such as 00:00—12:00.

[0068] It should be noted that Figure 5 and Table 1 above use data volume as an example. In practical applications, the data size can also be the number of data rows; this is not limited here. Furthermore, the attribute information of logical blocks can be stored in system tables, fork files, or other devices accessible to the server; this is also not limited here.

[0069] In this embodiment of the application, the attribute information includes time period information and the data scale corresponding to the time period information. Based on the attribute information, the relationship between the total data scale of the target time period and the first threshold can be determined, thereby determining whether the data of the corresponding logical block needs to be compressed. This provides technical support for the implementation of the technical solution of this application and improves the feasibility of the technical solution.

[0070] 302. The attribute information indicates whether the total data size of the data included in multiple data pages in the target time period is greater than or equal to the first threshold. If yes, proceed to step 303; otherwise, proceed to step 304.

[0071] The server obtains the attribute information of the logical block, analyzes the data scale of each time period indicated by the attribute information, and determines whether the total data scale of the cold data included in the logical block reaches a first threshold. If the total data scale of the cold data reaches the first threshold, that is, the total data scale of the cold data is greater than or equal to the first threshold, it indicates that the compression of the cold data is necessary. At this time, step 303 is executed, that is, the data included in the first logical block is compressed. Otherwise, step 304 is executed, that is, it is determined that the data included in the logical block will not be compressed.

[0072] Cold data refers to data whose timestamp falls within a target time period, where the time interval between the target time period and the current time is greater than or equal to a time threshold. The specific value of the time threshold is set based on the needs of the actual application and can be defined by the user or specified by system parameters; no specific limit is imposed here.

[0073] Furthermore, the target time period includes at least one of the multiple time periods indicated by the attribute information. If the target time period is one of multiple time periods, then the time interval between the target time period and the current time refers to the time interval between the end time of this time period and the current time. If the target time period includes multiple time periods, then the multiple time periods included in the target time period are consecutive. And the time interval between the target time period and the current time refers to the time interval between the end time of these multiple consecutive time periods and the current time.

[0074] For example, taking Figure 5 as an example, assuming the current time is t4, each of the histograms in the figure represents a period of 1 day. Here, a histogram refers to each bar in the figure; for example, the bar representing the data volume m1 corresponding to t0 to t1 is a histogram.

[0075] If the time threshold is 3 days, then the target period is the period from t0 to t1, and the total data size of the target period is m1.

[0076] If the time threshold is 1 day, then the target period is from t0 to t3, which includes the three periods of t0 to t1, t1 to t2, and t2 to t3. The total data size of the target period is m1 + m2 + m3.

[0077] In some optional implementations, if the time period indicated by the attribute information is a time period of equal length, the time threshold can be an integer multiple of the time period indicated by the time period information. For example, taking Figure 5 as an example, assuming the time threshold is 4 days, the duration of each time period in the figure can be 0.5 days, 1 day, 2 days, etc. Setting the time threshold to an integer multiple of the time period information directly determines whether all the data in each histogram bucket is cold data or not, without needing to further determine which data in each histogram bucket is cold data and which is not. This simplifies the determination of cold data.

[0078] For example, assuming a time threshold of 2 days and a duration of 1 day for each bucket in Figure 5, the server can directly determine whether all the data in a bucket is cold data. If the time threshold is 3 days and the duration of each bucket is 2 days, and if a bucket corresponds to a time period 2-4 days ago, the server needs to further analyze which data in the bucket has a timestamp greater than or equal to 2 days from the current time to determine which data is included in the bucket as cold data.

[0079] Furthermore, step 301 mentioned above introduced that the data scale includes the data volume or the number of data rows. Correspondingly, the first threshold includes the data volume threshold or the data row scale. The specific value of the first threshold is also set based on the needs of actual application, and can be defined by the user or specified by system parameters. No specific limitation is made here.

[0080] For example, suppose the compression scheduling strategy is set for 2 days, that is, the time threshold is 2 days, and the duration of each time period defined by the attribute information is 1 day. Taking Figure 5 as an example, suppose the times t1 to t4 in Figure 5 are 22:00 on November 9, 22:00 on November 10, 22:00 on November 11, 22:00 on November 12, and 22:00 on November 13, respectively.

[0081] If the current time is t4, then the time periods corresponding to t0 to t1 and t1 to t2 are the target time periods, and the total amount of data corresponding to these two time periods is m1 + m2. The server compares the total amount of data m1 + m2 with the data volume threshold to determine whether the scale of cold data has reached the first threshold.

[0082] 303. Compress the data contained in the logic block and store the compressed result.

[0083] The server only compresses the data within a logical block if the total size of the cold data in that block is greater than or equal to a first threshold. In other words, in this embodiment, compression is not performed immediately upon the appearance of cold data; rather, the relationship between the total size of the cold data and the first threshold is considered. Therefore, by reasonably setting the value of the first threshold, not only can resource waste caused by frequent compression be avoided, but the benefits of compressing cold data can also be determined. In other words, the first threshold can be understood as a parameter used to balance computational resources and compression benefits.

[0084] The server compresses the data within a logical block by identifying the page containing the cold data from among multiple data pages within the logical block and then performing compression on that page. The timestamp of the cold data must be within the target time period. In other words, the data compressed by the server is data whose timestamp falls within the target time period.

[0085] To elaborate further, the server starts from the first data page of the multiple data pages included in the logical block, and sequentially retrieves the cold data included in each data page until the size of the cold data reaches the total data size of the multiple data pages in the target time period. If there is a compression benefit in compressing the cold data, then the compression operation is performed on the data page containing the cold data. In other words, the data page compressed by the server includes cold data and has a compression benefit. Therefore, during the compression operation, the server needs to determine the starting data page of the logical block and determine whether there is a compression benefit. This process will be explained in detail below. When compressing the data included in the logical block, the server knows the identifier of the logical block. Based on the identifier of the logical block, the server can determine the starting data page among the multiple data pages included in the logical block. There are several possible ways for the server to determine the starting data page, which will be explained below.

[0086] In some optional implementations, the server can obtain a mapping relationship between identifiers of logical blocks and data page numbers, and determine the starting data page included in the logical block based on this mapping relationship. Specifically, the server obtains a second mapping set, which includes a mapping relationship between identifiers of logical blocks and data page numbers, where one identifier of a logical block corresponds to multiple data page numbers, and one data page number uniquely corresponds to one identifier of a logical block. The server determines the starting data page included in the logical block based on this second mapping set and the identifiers of the logical blocks.

[0087] For example, the second set of correspondences can be shown in Table 2 below:

[0088] Table 2

[0089] As shown in Table 2, the data pages included in logical block chunk_0 are numbered page_0, page_1, ..., page_n-1. In the database, data page numbers are consecutive. This means that the starting data page included in logical block chunk_0 is data page_0. Based on the identifier of the logical block, the server can determine the numbers of the multiple data pages matching the identifier of the logical block from the second correspondence, thereby determining the starting data page.

[0090] It should be noted that Table 2 is merely an example of the second correspondence set. In practical applications, the second correspondence set is not limited to a table format; it can also be key-value pairs or other formats that reflect the correspondence between logical block identifiers and data page numbers. Specific limitations are not specified here. Furthermore, the second correspondence set can be stored locally on the server, in remote storage, or on other devices accessible to the server. Specific limitations are not specified here.

[0091] In some alternative implementations, the server can obtain the correspondence between a logical block and its included starting data page. Based on this correspondence and the identifier of the logical block, the server can determine the starting data page included in the logical block.

[0092] For example, assume that the relationship between the identifier of a logical block and the starting data page satisfies the following formula: chunk_id = start - page_number × page_size ... Formula 1

[0093] Here, `chunk_id` represents the logical block identifier, `start-page_number` represents the starting data page number, and `page_size` represents the amount of data in the data page. In the database, the data page number is fixed and cannot be manually modified. The amount of data in each data page is the same, and the server can obtain this information from system parameters. Therefore, based on the logical block identifier and the data page size, combined with Formula 1, the server can determine the starting data page number of the logical block.

[0094] For example, assume that the relationship between the identifier of a logical block and the starting data page satisfies the following formula 2: chunk_id = start - page_number × chunk_size ... Formula 2

[0095] Here, `chunk_size` represents the amount of data in a data page. This information is defined by the user or specified by system parameters, and the server can obtain this information. Combining this with the logical block identifier and Formula 2, the starting data page number of the logical block can be determined.

[0096] In this application embodiment, the server can determine the starting data page included in the logical block in multiple ways, which enriches the implementation methods and application scenarios of the technical solution of this application. It can be selected based on the needs of actual application, thereby improving the flexibility of the technical solution.

[0097] Cold data retrieved by the server from a data page refers to the timestamp of the data read from the data page, and the time interval between that timestamp and the current time. If this time interval is greater than or equal to a time threshold, the data is determined to be cold data.

[0098] Furthermore, the server may not read all the data pages included in a logical block. This is because the server has already obtained the total size of the cold data within the logical block before reading it. Therefore, during the sequential reading of the data pages within the logical block, when the server has read enough cold data to reach the total size indicated by the attribute information, it means that the cold data within the logical block has been completely read. The data yet to be read is not cold data and does not require compression. The server does not need to read the remaining data, thus saving I / O overhead.

[0099] After acquiring cold data, the server pre-compresses it to determine if compression is beneficial. Pre-compression refers to compression at the memory level, without changing the physical form of data storage. The compression benefit is determined by comparing the storage space occupied by the cold data before and after compression. It's understandable that after compression, in addition to storing the compressed data itself, parameters used for decompression must also be stored. Therefore, the compressed data includes the compressed data and related parameters. If the storage space occupied by the compressed data is less than that occupied by the uncompressed data, then compression is considered beneficial and can be performed. Otherwise, there is no compression benefit, and the data is not compressed.

[0100] In this embodiment of the application, in the scheme for compressing the data included in the logic block, the operation of obtaining cold data stops at the scale of cold data indicated by the first attribute information, and may not traverse all data pages included in the logic block, thus saving I / O overhead. In addition, the server will only compress the cold data if it determines that the cold data has a compression benefit, which also reduces the occupation of storage space.

[0101] 304. Determine the data included in the uncompressed logical block.

[0102] In scenarios where the total size of the cold data indicated by the attribute information is less than the first threshold, it means that the cold data included in the logical block has not yet met the compression conditions, and the server will not compress the data included in the logical block. This can also be understood as keeping the data in the logical block unchanged during the current compression task.

[0103] In this embodiment, multiple data pages are mapped to logical blocks, and the decision to compress the data contained within a logical block is determined based on the block's attribute information. Specifically, the attribute information indicates the data size of the multiple data pages within the logical block at different time periods. The data within the logical block is compressed only if the total data size of the cold data in these multiple data pages is greater than or equal to a first threshold. Otherwise, the data within the logical block is not compressed. The timestamps of the cold data are located within the target time period. In other words, for logical blocks where the total data size of the cold data is less than the first threshold, no compression operation is performed, reducing I / O overhead and saving system resources.

[0104] In step 301 above, the server obtains the attribute information of the logical block. Before step 301, the server also obtains a first correspondence set and the identifier of the logical block. The first correspondence set indicates a one-to-one correspondence between the identifiers of multiple logical blocks and multiple attribute information, and the identifier of the logical block uniquely identifies the logical block. Therefore, specifically, the server obtains the attribute information of the logical block by retrieving the attribute information from the first correspondence set based on the identifier of the logical block.

[0105] Furthermore, the first correspondence set includes the correspondence between the identifiers of multiple logical blocks and multiple attribute information. Each logical block identifier uniquely corresponds to one attribute information, and each attribute information uniquely corresponds to one logical block identifier. Alternatively, it can be understood that the server maintains one attribute information for each logical block, and this attribute information can be in the form of the aforementioned histogram, system table, etc.

[0106] Optionally, the first set of correspondences can be stored locally on the server, such as in a system table or a fork file, or in the cloud, or on other devices accessible to the server.

[0107] The server also needs to obtain the identifier of the logical block. The identifier of the logical block is actually the identifier of the logical block containing the currently read data page when the server is executing the compression scheduling task. In this embodiment, there are several possible ways for the server to obtain the identifier of the logical block, which will be described below.

[0108] In some optional implementations, the server may also obtain a second mapping set, which includes a mapping between logical block identifiers and data page numbers, wherein one logical block identifier corresponds to multiple data page numbers, and one data page number uniquely corresponds to one logical block identifier. The server then obtains the number of the currently read data page. Based on the number of the currently read data page, the server determines the logical block identifier from the second mapping set.

[0109] Specifically, the server obtains the number of the currently read data page, queries the second correspondence set, and then obtains the identifier of the logical block. The specific implementation and storage location of the second correspondence set have already been described in the previous explanation of Table 2, and will not be repeated here.

[0110] In this embodiment of the application, the server can also directly determine the identifier of the logical block where the currently read data page is located based on the second correspondence set, which is simple to operate and saves computing resources.

[0111] In some optional implementations, the server obtains the number of the currently read data page, the data size of the data page, and the data size of the logical block. Based on the number of the currently read data page, the data size of the data page, and the data size of the logical block, the server determines the number of the target data page within the logical block. The target data page can be either the starting or ending data page of the logical block. Based on the number of the target data page and the target data size, the server determines the identifier of the logical block. The target data size can be either the data size of the logical block or the data size of any data page within the logical block.

[0112] Specifically, dividing a data page into multiple logical blocks involves mapping consecutive data pages to a single logical block, starting from the first data page in the database. The server can determine the number of the first data page based on system parameters. First, based on the data volume of the data page and the data volume of the logical block, the server can determine the number of data pages included in each logical block. Then, based on the number of the currently read data page, the number of data pages in each logical block, and the number of the first data page in the database, the server can determine the starting or ending data page number of the logical block containing the currently read data page. The system configuration also defines the relationship between the logical block identifier, the target data page number, and the target data volume. Using this relationship, the server can determine the identifier of the first logical block.

[0113] Optionally, the target data page is the starting data page of the logical block, and the target data volume is the data volume of the data page. That is, the relationship between the logical block identifier and the starting data page satisfies Formula 1 mentioned above. For example, based on the data volume of the logical block and the data volume of the data page, each logical block is determined to include 5 data pages. The first data page in the database is numbered 0. If the server is currently reading data page number 12, the server determines that the currently read data page is a data page in the third logical block, and the data pages included in the third logical block are numbered 9 to 14. The third logical block is the logical block containing the currently read data page. Therefore, the starting data page number of the third logical block is 9. If the data volume of each data page is 30MB, then the identifier of the logical block containing the currently read data page is 9 × 30 = 270.

[0114] Optionally, the target data page is the starting data page of the logical block, and the target data volume is the data volume of the logical block. That is, the relationship between the logical block identifier and the starting data page satisfies Formula 2 mentioned above. For example, based on the data volume of the logical block and the data volume of the data pages, each logical block is determined to contain 5 data pages. The first data page in the database is numbered 0. If the server is currently reading data page number 12, the server determines that the currently read data page is a data page in the third logical block, and the data pages included in the third logical block are numbered 9 to 14. The third logical block is the logical block containing the currently read data page. Therefore, the starting data page number of the third logical block is 9. If the data volume of the logical block is 90MB, then the identifier of the logical block containing the currently read data page is 9 × 90 = 810.

[0115] Optionally, the target data page is the last data page of the logical block, and the target data size is the data size of the data page. In other words, the relationship between the logical block identifier and the last data page satisfies Formula 3: chunk_id = end - page_number × page_size ... Formula 3

[0116] Here, `end-page_number` represents the number of the last data page. For example, based on the data size of the logical block and the data size of the data pages, each logical block is determined to contain 5 data pages. The first data page in the database is numbered 0. If the server is currently reading data page number 12, the server determines that the currently read data page is a data page in the third logical block, and the data pages in the third logical block are numbered 9 to 14. The third logical block is the logical block containing the currently read data page. Therefore, the last data page of the third logical block is numbered 14. If each data page contains 30MB of data, then the identifier of the logical block containing the currently read data page is 14 × 30 = 420.

[0117] Optionally, the target data page is the end data page of the logical block, and the target data size is the data size of the logical block. In other words, the relationship between the logical block identifier and the end data page satisfies Formula 4: chunk_id = end - page_number × chunk_size ... Formula 4

[0118] For example, based on the data size of the logical block and the data size of the data page, each logical block is determined to contain 5 data pages. The first data page in the database is numbered 0. If the server is currently reading data page number 12, the server determines that the currently read data page is a data page in the third logical block, and the data pages in the third logical block are numbered 9 to 14. The third logical block is the logical block containing the currently read data page. Therefore, the last data page in the third logical block is numbered 14. If each data page contains 90MB of data, then the identifier of the logical block containing the currently read data page is 14 × 90 = 1260.

[0119] In this embodiment, the target data page within the logical block containing the currently read data page is determined by the page number. This target data volume is then combined with the target data volume to determine the identifier of the logical block containing the currently read data page. The target data page can be either the starting or ending data page of the logical block; the target data volume can be either the data volume of a data page or the data volume of a logical block. This provides multiple possibilities for the implementation of the technical solution in this application, enriching the application scenarios and implementation methods.

[0120] In some optional implementations, the server obtains the number of the currently read data page and the target data volume, where the target data volume is the data volume of a logical block or the data volume of any one of multiple data pages. Based on the number of the currently read data page and the target data volume, a target identifier is determined. Then, based on the identifier corresponding to the currently read logical page and a first correspondence set, the identifier of the logical block containing the currently read data page is determined. The target identifier is the same as the identifier of the logical block containing the currently read data page, or the target identifier is less than or greater than the identifier of the logical block containing the currently read data page, and the identifier of the logical block containing the currently read data page in the first correspondence set is closest to the target identifier.

[0121] Specifically, the system configuration defines the relationship between logical block identifiers and target data volumes, which can be any of the relationships shown in Formulas 1 to 4 above. Furthermore, the first correspondence set includes identifiers for multiple logical blocks. If the target identifier determined by the server based on the number of the currently read data page and the target data volume is included in the first correspondence set, then that target identifier is the identifier of the logical block containing the currently read data page. If the target identifier is not in the first correspondence set, the server can determine the identifier of the logical block containing the currently read data page based on the target identifier and the first correspondence set. A detailed explanation follows with examples.

[0122] For example, assume the target data volume is the data volume of a data page, and the identifier of a logical block and the data volume of a data page satisfy the relationship defined in Formula 1 above. For instance, the first data page in the database is numbered 1, each logical block includes 3 data pages, and the identifiers of the logical blocks included in the first correspondence set are 10, 40, and 60. The server is currently reading data page number 5, and the data volume of the data page is 10. The server determines the target identifier to be 50. Since the identifier of a logical block and the data volume of a data page satisfy Formula 1 above, that is, the system configuration defines the identifier of a logical block based on the number of the starting data page, then the server determines from the first correspondence set that the identifier of the logical block that is smaller than the target identifier and closest to the target identifier is 40, which is the identifier of the logical block containing the currently read data page.

[0123] For example, suppose the target data volume is the data volume of a data page, and the identifier of a logical block and the data volume of a data page satisfy the relationship defined in Formula 3 above. For instance, the first data page in the database is numbered 1, each logical block includes 3 data pages, and the identifiers of the logical blocks included in the first correspondence set are 10, 40, and 60. The server is currently reading data page number 5, and the data volume of the data page is 10. The server determines the target identifier to be 50. Since the identifier of a logical block and the data volume of a data page satisfy Formula 3 above, that is, the system configuration defines the identifier of a logical block based on the number of the last data page, then the server determines from the first correspondence set that the identifier of the logical block that is larger than the target identifier and closest to the target identifier is 60, which is the identifier of the logical block containing the currently read data page.

[0124] Similarly, the target data volume is also the data volume of logical blocks, and the identifier of the logical block and the number of logical blocks satisfy the relationship defined in Formula 2 or Formula 4 above. Similar to the principles of the previous two examples, the server determines the identifier of the logical block where the currently read data page resides; this will not be elaborated upon here.

[0125] In this embodiment, the server determines a target identifier based on the number of the currently read data page and the target data volume. Then, it compares the target identifier with the identifiers of the logical blocks included in the first correspondence set to determine the identifier of the logical block containing the currently read data page. Since the relationship between the identifier of the logical block defined by the system configuration and the target data volume can be varied, there are also multiple ways for the server to determine the identifier of the logical block containing the currently read data page, enriching the application scenarios of this application's technical solution and improving its flexibility. Furthermore, this embodiment provides multiple methods for determining the identifier of the logical block containing the currently read data page, allowing for flexible selection based on actual application needs, thus enriching the implementation methods and application scenarios of this application's technical solution.

[0126] Furthermore, in this embodiment, an attribute information is maintained for each logical block, and a one-to-one correspondence between the identifiers of multiple logical blocks and the attribute information is stored in a first correspondence set. This allows the server to determine the attribute information corresponding to the logical block from the first correspondence set based on the identifier of the logical block containing the currently read data page. This provides technical support for the implementation of the technical solution of this application and improves the feasibility of the technical solution.

[0127] The preceding explanation used the compression of a single logical block as an example. In practical applications, data pages in a database may be mapped to multiple logical blocks. The following diagram illustrates this scenario.

[0128] In some optional implementations, the server performs the compression scheduling task serially, that is, it determines one by one whether the data included in each logical block needs to be compressed. Please refer to Figure 6, which is a flowchart illustrating the data compression method provided in an embodiment of this application.

[0129] As shown in Figure 6, the compression scheduling task begins. The server obtains the attribute information of the logical block containing the currently read data page and determines whether the cold data size of that logical block, as indicated by the attribute information, has reached a first threshold. If yes, the data included in that logical block is compressed. If not, it determines not to compress the data included in that logical block and obtains the attribute information of the next logical block to determine whether to compress the data included in the next logical block. This process continues until every logical block in the database has been traversed, completing the compression of the database.

[0130] In some optional implementations, the server can also perform compression scheduling tasks in parallel. That is, the server simultaneously judges the attribute information of multiple logical blocks corresponding to the database to determine whether to compress the data contained in multiple logical blocks. In other words, the server synchronously performs the data compression scheduling task for each logical block.

[0131] It is understandable that, regardless of the method, the principle of server compression of data in a certain logical block is similar to that described in the relevant embodiment in Figure 3 above, and will not be repeated here.

[0132] The following describes the relevant equipment provided in the embodiments of this application.

[0133] Please refer to Figure 7, which is a schematic diagram of a data compression apparatus provided in an embodiment of this application. As shown in Figure 7, the data compression apparatus 700 includes an acquisition unit 701 and a processing unit 702.

[0134] In some optional implementations, the acquisition unit 701 is used to acquire attribute information of a logic block, which includes multiple data pages, and the attribute information indicates the data scale of the data included in the multiple data pages in multiple time periods.

[0135] Processing unit 702 is configured to compress the data included in the logic block and store the compressed result if the attribute information indicates that the total data size of the data included in multiple data pages in the target time period is greater than or equal to a first threshold. The target time period includes at least one of multiple time periods, and the time interval between the target time period and the current time is greater than or equal to a time threshold.

[0136] The processing unit 702 is further configured to determine that the data included in the logic block is not compressed if the attribute information indicates that the total data size of the data included in multiple data pages in the target time period is less than a first threshold.

[0137] In some optional implementations, the attribute information includes time period information and the corresponding data size information. The time period information indicates the time period in which the data's timestamp falls.

[0138] Data size information indicates the amount of data, and the first threshold includes a data size threshold. Alternatively, data size information indicates the number of data rows, and the first threshold includes a data row count threshold.

[0139] In some optional implementations, the acquisition unit 701 is further configured to: acquire a first correspondence set, wherein the first correspondence set indicates a one-to-one correspondence between the identifiers of multiple logical blocks and multiple attribute information; acquire the identifiers of the logical blocks, wherein the identifiers of the logical blocks indicate the logical blocks; and specifically, the acquisition unit 701 is configured to acquire the attribute information corresponding to the logical blocks from the first correspondence set based on the identifiers of the logical blocks.

[0140] In some optional implementations, the acquisition unit 701 is specifically used for: acquiring a second correspondence set, which includes a correspondence between logical block identifiers and data page numbers, wherein one logical block identifier corresponds to multiple data page numbers, and one data page number uniquely corresponds to one logical block identifier; acquiring the number of the currently read data page; and determining the logical block identifier from the second correspondence set based on the number of the currently read data page.

[0141] In some optional implementations, the acquisition unit 701 is specifically configured to: acquire the number of the currently read data page, the data volume of the data page, and the data volume of the logical block, wherein the currently read data page is contained within a first logical block; determine the number of a target data page in the first logical block based on the number of the currently read data page, the data volume of the data page, and the data volume of the logical block, wherein the target data page is either the starting data page or the ending data page of the first logical block; and determine the identifier of the first logical block based on the number of the target data page and the target data volume, wherein the target data volume is either the data volume of the first logical block or the data volume of any data page within the first logical block.

[0142] In some optional implementations, the acquisition unit 701 is specifically used to: acquire the number of the currently read data page and the target data volume, wherein the target data volume is the data volume of the first logical block, or the data volume of any one of multiple data pages; determine a target identifier based on the number of the currently read data page and the target data volume; and determine the identifier of the first logical block based on the identifier corresponding to the currently read logical page and a first correspondence set, wherein the target identifier is the same as the identifier of the first logical block, or the target identifier is less than or greater than the identifier of the first logical block, and the identifier of the first logical block in the first correspondence set is closest to the target identifier.

[0143] In some optional implementations, processing unit 702 is specifically configured to: obtain the data page containing cold data from multiple data pages, wherein the timestamp of the cold data is located in the target time period; and perform a compression operation on the data page containing the cold data.

[0144] Both the acquisition unit 701 and the processing unit 702 can be implemented in software or in hardware. For example, the implementation of the processing unit 702 will be described below. Similarly, the implementation of the acquisition unit 701 can be referenced to the implementation of the processing unit 702.

[0145] As an example of a software functional unit, processing unit 702 may include code running on a computing instance. The computing instance may include at least one of a physical host (computing device), a virtual machine, and a container. Further, the aforementioned computing instance may be one or more. For example, processing unit 702 may include code running on multiple hosts / virtual machines / containers. It should be noted that the multiple hosts / virtual machines / containers used to run the code may be distributed in the same region or in different regions. Further, the multiple hosts / virtual machines / containers used to run the code may be distributed in the same availability zone (AZ) or in different AZs, each AZ including one or more geographically proximate data centers. Typically, a region may include multiple AZs.

[0146] Similarly, multiple hosts / virtual machines / containers used to run this code can be distributed within the same Virtual Private Cloud (VPC) or across multiple VPCs. Typically, a VPC is set up within a region. Communication between two VPCs within the same region, as well as between VPCs in different regions, requires a communication gateway to be set up within each VPC to enable interconnection between VPCs.

[0147] As an example of a hardware functional unit, the processing unit 702 may include at least one computing device, such as a server. Alternatively, the processing unit 702 may also be a device implemented using an application-specific integrated circuit (ASIC) or a programmable logic device (PLD). The PLD may be implemented using a complex programmable logical device (CPLD), a field-programmable gate array (FPGA), generic array logic (GAL), or any combination thereof.

[0148] The processing unit 702 includes multiple computing devices that can be distributed in the same region or in different regions. Similarly, the processing unit 702 includes multiple computing devices that can be distributed in the same Availability Zone (AZ) or in different AZs. Likewise, the processing unit 702 includes multiple computing devices that can be distributed in the same Virtual Private Cloud (VPC) or in multiple VPCs. These multiple computing devices can be any combination of computing devices such as servers, ASICs, PLDs, CPLDs, FPGAs, and GALs.

[0149] It should be noted that the data compression device 700 achieves all its functions by implementing different steps in the data compression method through the acquisition unit 701 and the processing unit 702. The data compression device 700 is used to implement the data compression method provided in the embodiments of this application, and will not be described in detail here.

[0150] Please refer to Figure 8, which is a schematic diagram of a computing device provided in an embodiment of this application. The computing device 800 includes a processor 801, a communication interface 802, a bus 803, and a memory 804. The processor 801, the communication interface 802, and the memory 804 communicate with each other via the bus 803. In practical applications, communication can also be achieved through other means such as wireless transmission, which is not limited here.

[0151] It should be understood that this application does not limit the number of processors and memories in the computing device 800.

[0152] Processor 801 may include any one or more processors such as a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor (MP), or a digital signal processor (DSP).

[0153] The communication interface 802 uses transceiver modules, such as, but not limited to, network interface cards and transceivers, to enable communication between the computing device 800 and other devices or communication networks.

[0154] Bus 803 can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc. For ease of illustration, only one line is used in Figure 8, but this does not indicate that there is only one bus or one type of bus. Bus 803 can include pathways for transmitting information between various components of computing device 800 (e.g., memory 804, processor 801, communication interface 802).

[0155] Memory 804 may include volatile memory, such as random access memory (RAM). Memory 804 may also include non-volatile memory, such as read-only memory (ROM), flash memory, hard disk drive (HDD), or solid state drive (SSD).

[0156] The memory 804 stores executable program code, and the processor 801 executes the executable program code to implement the functions of the aforementioned acquisition unit 701 and processing unit 702, thereby realizing the data compression method. That is, the memory 804 stores instructions for executing the data compression method.

[0157] This application also provides a computing device cluster, which includes at least one computing device. The computing device can be a server, such as a central server, an edge server, or a local server in a local data center. In some optional embodiments, the computing device can also be a desktop computer, a laptop computer, or other terminal device.

[0158] Please refer to Figures 9 and 10, which are schematic diagrams of the structure of the computing device cluster provided in the embodiments of this application.

[0159] As shown in Figure 9, the computing device cluster includes at least one computing device 800. The memory 804 of one or more computing devices 800 in the computing device cluster may store the same instructions for executing the data compression method provided in the embodiments of this application.

[0160] In some possible implementations, the memory 804 of one or more computing devices 800 in the computing device cluster may also store partial instructions for executing the data compression method. In other words, a combination of one or more computing devices 804 can jointly execute the instructions for executing the data compression method.

[0161] It should be noted that the memory 804 in different computing devices 800 within the computing device cluster can store different instructions, each used to execute a portion of the functions of the data compression device. That is, the instructions stored in the memory 804 of different computing devices 800 can implement the functions of one or more units among the acquisition unit 701 and the processing unit 702.

[0162] In some possible implementations, one or more computing devices in a computing device cluster can be connected via a network. This network can be a wide area network (WAN) or a local area network (LAN), etc. Figure 10 illustrates one possible implementation. As shown in Figure 10, two computing devices 800A and 800B are connected via a network. Specifically, they are connected to the network through communication interfaces in each computing device. In this type of possible implementation, the memory 804 in computing device 800A stores instructions for executing the functions of the acquisition unit 701. Simultaneously, the memory 804 in computing device 800B stores instructions for executing the functions of the processing unit 702.

[0163] The connection method between the computing device clusters shown in Figure 10 can be based on the data compression method provided in this application, which separates the processing operation from the operation outside the processing operation. That is, it is considered that the function of the acquisition unit 701 is executed by the computing device 800A, and the function of the processing unit 702 is executed by the computing device 800B.

[0164] It should be understood that the functions of computing device 800A shown in Figure 10 can also be performed by multiple computing devices 800. Similarly, the functions of computing device 800B can also be performed by multiple computing devices 800.

[0165] This application also provides another computing device cluster. The connection relationship between the computing devices in this computing device cluster can be similarly referred to the connection method of the computing device cluster described in Figures 9 and 10, and will not be repeated here.

[0166] This application also provides a computer program product containing instructions. The computer program product may be a software or program product containing instructions, capable of running on a computing device or stored on any usable medium. When the computer program product is run on at least one computer device, it causes the at least one computer device to perform the above-described data compression method.

[0167] This application also provides a computer-readable storage medium. The computer-readable storage medium can be any available medium capable of being stored by a computing device, or a data storage device such as a data center containing one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid-state drive). The computer-readable storage medium includes instructions that instruct the computing device to perform the aforementioned data compression method.

[0168] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0169] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the protection scope of the technical solutions of the embodiments of this application.

Claims

1. A data compression method, characterized in that, include: Obtain the attribute information of a logical block, wherein the logical block comprises multiple data pages, and the attribute information indicates the data scale of the data included in the multiple data pages in multiple time periods; If the attribute information indicates that the total data size of the data included in the plurality of data pages in the target time period is greater than or equal to a first threshold, then the data included in the logic block is compressed and the compressed result is stored; wherein, the target time period includes at least one of the plurality of time periods, and the time interval between the target time period and the current time is greater than or equal to a time threshold; If the first attribute information indicates that the total data size of the data included in the plurality of data pages in the target time period is less than the first threshold, then it is determined that the data included in the logical block will not be compressed.

2. The method according to claim 1, characterized in that, The attribute information includes time period information and the data scale information corresponding to the time period information; The time period information indicates the time period in which the timestamp of the data is located; The data scale information indicates the data volume, and the first threshold includes a data volume threshold; or... The data scale information indicates the number of data rows, and the first threshold includes a data row count threshold.

3. The method according to claim 1 or 2, characterized in that, Before obtaining the attribute information of the logical block, the method further includes: Obtain the first correspondence set, which indicates a one-to-one correspondence between the identifiers and attribute information of multiple logical blocks; Obtain the identifier of the logic block, wherein the identifier of the logic block indicates the logic block; The acquisition of the attribute information of the logic block includes: Based on the identifier of the logical block, the attribute information corresponding to the logical block is obtained from the first correspondence set.

4. The method according to claim 3, characterized in that, The step of obtaining the identifier of the logical block includes: Obtain a second set of correspondences, which includes the correspondence between the identifiers of logical blocks and the numbers of data pages. One identifier of a logical block corresponds to multiple numbers of data pages, and one number of a data page uniquely corresponds to the identifier of a logical block. Get the number of the currently read data page; The identifier of the logical block is determined from the second correspondence set based on the number of the currently read data page.

5. The method according to any one of claims 1 to 4, characterized in that, The data included in the compressed logical block includes: Obtain the data page containing the cold data from the plurality of data pages, wherein the timestamp of the cold data is located in the target time period; Perform a compression operation on the data page containing the cold data.

6. A data compression device, characterized in that, include: An acquisition unit is used to acquire attribute information of a logical block, wherein the logical block includes multiple data pages, and the attribute information indicates the data scale of the data included in the multiple data pages in multiple time periods; A processing unit is configured to compress the data included in the logic block and store the compressed result if the attribute information indicates that the total data size of the data included in the plurality of data pages in the target time period is greater than or equal to a first threshold; wherein the target time period includes at least one of the plurality of time periods, and the time interval between the target time period and the current time is greater than or equal to a time threshold. The processing unit is further configured to determine not to compress the data included in the logical block if the attribute information indicates that the total data size of the data included in the plurality of data pages in the target time period is less than the first threshold.

7. The apparatus according to claim 6, characterized in that, The attribute information includes time period information and the data scale information corresponding to the time period information; The time period information indicates the time period in which the timestamp of the data is located; The data scale information indicates the data volume, and the first threshold includes a data volume threshold; or... The data scale information indicates the number of data rows, and the first threshold includes a data row count threshold.

8. The apparatus according to claim 6 or 7, characterized in that, The acquisition unit is further configured to: Obtain the first correspondence set, which indicates a one-to-one correspondence between the identifiers and attribute information of multiple logical blocks; Obtain the identifier of the logic block, wherein the identifier of the logic block indicates the logic block; The acquisition unit is specifically used to acquire the attribute information corresponding to the logical block from the first correspondence set according to the identifier of the logical block.

9. The apparatus according to claim 8, characterized in that, The acquisition unit is specifically used for: Obtain a second set of correspondences, which includes the correspondence between the identifiers of logical blocks and the numbers of data pages. One identifier of a logical block corresponds to multiple numbers of data pages, and one number of a data page uniquely corresponds to the identifier of a logical block. Get the number of the currently read data page; The identifier of the logical block is determined from the second correspondence set based on the number of the currently read data page.

10. The apparatus according to any one of claims 6 to 9, characterized in that, The processing unit is specifically used for: Obtain the data page containing the cold data from the plurality of data pages, wherein the timestamp of the cold data is located in the target time period; Perform a compression operation on the data page containing the cold data.

11. A computing device cluster, characterized in that, It includes at least one computing device, each computing device including a processor and memory; The processor of the at least one computing device is used to execute instructions stored in the memory of the at least one computing device to implement the method as described in any one of claims 1 to 5.

12. A computer program product containing instructions, characterized in that, When the instructions are run by the computing device cluster, the method as described in any one of claims 1 to 5 is implemented.

13. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes computer program instructions that, when executed by a cluster of computing devices, implement the method as described in any one of claims 1 to 5.