Time sequence data compression method and device, computer equipment and storage medium

By determining the target compression rate in the time series compression method and utilizing specific transformation and extraction methods, the problem of inability to adapt to the storage space in the prior art is solved, and efficient data compression and storage utilization are achieved.

CN119865186APending Publication Date: 2025-04-22CHINA TELECOM CLOUD TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411629289.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-14
Publication Date
2025-04-22

AI Technical Summary

Technical Problem

Existing time series compression methods cannot adapt to storage space, resulting in unnecessary data loss.

Method used

By obtaining the initial time sequence data to be compressed and its related information, the target compression rate is determined, and the rounding transformation and state change key point extraction methods are used to perform adaptive compression processing to generate a reasonable compression rate.

Benefits of technology

Under the limitations of a given storage space or data size, adaptive compression of data is achieved, reducing data loss and maximizing the use of storage space.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119865186A_ABST
    Figure CN119865186A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of data processing, and discloses a time sequence data compression method and device, computer equipment and a storage medium, the target compression rate is determined by obtaining information such as the storage size of a storage space used for storing compressed data and the database type, data loss caused by compression is reduced as much as possible, and the compression efficiency is improved. And the limited storage space is utilized to the greatest extent. Furthermore, the initial to-be-compressed time sequence data is subjected to rounding transformation, so that state division can be performed on the time sequence data more quickly. Furthermore, target to-be-compressed time sequence data after rounding transformation is processed by using a state change key point extraction method, an interval state set capable of focusing on key state change points in the data and extracting key feature information of the data can be obtained, and finally, on the basis of the interval state set, the compression time sequence data is compressed on the basis of the interval state set. The target compression rate can be utilized to realize self-adaptive compression processing of the initial to-be-compressed time sequence data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data processing technology, and in particular to a time series data compression method, device, computer equipment and storage medium. Background Art

[0002] In the field of cloud computing, as the scale of cloud services increases, the system becomes more and more complex, and the number of monitored indicators increases, resulting in a massive amount of monitoring data every day. Since the system is in normal operation most of the time, abnormal fluctuations are rare. In application scenarios such as data-driven anomaly detection and root cause diagnosis, abnormal sample data is crucial for machine learning or deep learning model training. Since abnormal samples account for a low proportion of the overall sampling, it is costly and inefficient to store the full amount of raw data persistently. In order to extract and retain valuable data for as long as possible, improve storage efficiency, and save storage costs, it is necessary to compress the data and reduce redundant and low-value data.

[0003] At present, time series compression methods can be divided into two categories: lossless compression and lossy compression. Most time series compression methods belong to the lossy compression type. Existing lossy data compression technology mainly focuses on how to improve the compression rate and compression performance. When the storage space is limited and the size of the compressed data file is limited, the existing technology is used to compress the time series. The compression rate may be small and the compressed file may be large, which cannot be saved in the given storage space; or the compression rate is too large and the compressed file is small, resulting in over-compression. In the case of more redundancy in the storage space, unnecessary data loss will occur. Summary of the invention

[0004] In view of this, the present invention provides a time series data compression method, apparatus, computer equipment and storage medium to solve the problem that the existing time series compression method cannot adapt to the storage space, thereby causing unnecessary data loss.

[0005] In a first aspect, the present invention provides a time series data compression method, the method comprising:

[0006] The initial time series data to be compressed, the data type of the initial time series data to be compressed, the storage size of the storage space for storing the compressed data, and the database type are obtained; based on the initial time series data to be compressed, the data type, the storage size, and the database type, a target compression ratio is determined, the target compression ratio represents the minimum compression degree in the time series data compression process, and is used to determine the minimum amount of data to be reduced; the initial time series data to be compressed is rounded and transformed to obtain the target time series data to be compressed; based on the target time series data to be compressed, a state change key point extraction method is used to extract an interval state set; based on the target compression ratio and the interval state set, the initial time series data to be compressed is compressed to obtain the compressed target time series data.

[0007] The time series data compression method provided by the present invention determines the target compression rate by obtaining the storage size of the storage space used to store the compressed data and the database type and other information, thereby minimizing the data loss caused by compression and making the most of the limited storage space. Furthermore, by performing rounding transformation on the initial time series data to be compressed, the time series data can be more quickly divided into states. Furthermore, by using the state change key point extraction method to process the target time series data to be compressed after the rounding transformation, an interval state set that can focus on the key state change points in the data and extract the key feature information of the data can be obtained. Finally, based on the interval state set, the target compression rate can be used to implement adaptive compression processing of the initial time series data to be compressed. Therefore, by implementing the present invention, a reasonable target compression rate can be generated under the constraints of the storage size of the storage space of the given compressed data or the size of the time series data to be compressed, and the data can be adaptively compressed.

[0008] In an optional implementation, determining a target compression ratio based on the initial time series data to be compressed, the data type, the storage size, and the database type includes:

[0009] Obtain the first data sequence length of the initial time series data to be compressed; based on the storage size, data type and database type, obtain the estimated second data sequence length of the initial time series data to be compressed after compression through processing by a preset estimation function; calculate the target compression rate based on the first data sequence length and the second data sequence length.

[0010] The time series data compression method provided by the present invention can estimate the length of the second data sequence after the initial time series data to be compressed is compressed by a preset estimation function, and further, the target compression rate can be calculated in combination with the length of the first data sequence of the initial time series data to be compressed. By considering the storage size, data type and database type, it can ensure that the compressed data can be well adapted to the given storage environment, which provides support for avoiding the waste of storage space or excessive information loss due to excessive data compression caused by unreasonable compression rate setting.

[0011] In an optional implementation, based on the storage size, data type and database type, after being processed by a preset estimation function, an estimated second data sequence length of the compressed initial time series data to be compressed is obtained, including:

[0012] Based on the data type and database type, determine the initialization data table of the storage space; insert multiple time series data in the initial time series data to be compressed into the initialization data table in turn to obtain multiple data row numbers and multiple occupied space sizes; based on the multiple data row numbers and multiple occupied space sizes, obtain a preset estimation function through a preset fitting method; based on the preset estimation function and the storage size, calculate the length of the second data sequence.

[0013] The time series data compression method provided by the present invention can construct an initial framework that is most suitable for storing the time series data to be compressed according to the specific data characteristics and the requirements of the database used by determining the initialization data table of the storage space based on the data type and the database type. Furthermore, by sequentially inserting multiple time series data in the initial time series data to be compressed into the initialization data table, the specific storage situation of the data to be compressed in the currently set initialization data table can be accurately grasped. Finally, a corresponding preset estimation function can be generated by a preset fitting method, and then the preset estimation function can be used to estimate the length of the second data sequence after the initial time series data to be compressed is compressed, which provides support for the subsequent calculation of the target compression rate.

[0014] In an optional implementation, based on the target time series data to be compressed, a state change key point extraction method is used to obtain an interval state set, including:

[0015] Each data value in the target time series data to be compressed is traversed in turn, and whether two adjacent data values ​​are equal is determined in turn; multiple state change key points and multiple state mark values ​​are determined in the target time series data to be compressed according to each judgment result; based on the multiple state change key points and multiple state mark values, an interval state set is determined.

[0016] The time series data compression method provided by the present invention can more accurately find the key point where the state change actually occurs in the data sequence by successively judging whether two adjacent data values ​​are equal. Further, the corresponding interval state set can be determined by combining multiple state mark values.

[0017] In an optional implementation, based on the target compression rate and the interval state set, the initial time series data to be compressed is compressed to obtain the compressed target time series data, including:

[0018] The interval state set is traversed in chronological order to obtain multiple target state intervals and multiple target state mark values; based on the multiple target state intervals and multiple target state mark values, the initial time series data to be compressed is compressed to obtain compressed initial time series data; when the compression rate of the initial time series data is greater than the target compression rate, the initial time series data is determined to be the target time series data; when the compression rate of the initial time series data is less than the target compression rate, the step of performing rounding transformation on the initial time series data to be compressed is returned, and it is iterated repeatedly to obtain compressed target time series data.

[0019] The time series data compression method provided by the present invention performs segment-by-segment and round-by-round compression based on the state interval, giving priority to reducing data that is old and has not changed much. Furthermore, by comparing the compression rate of the initial time series data with the target compression rate, it is possible to accurately control whether the compressed data finally obtained meets the pre-set compression degree requirement, effectively avoiding the problem of storage space waste due to insufficient compression, and also preventing the loss of data information due to excessive compression.

[0020] In an optional implementation, based on multiple target state intervals and multiple target state mark values, the initial time series data to be compressed is compressed to obtain compressed initial time series data, including:

[0021] Obtain an initialization storage sequence; determine a plurality of compressed first target sampling values ​​and a plurality of second target sampling values ​​based on a plurality of target state intervals and a plurality of target state mark values; determine compressed initial timing data based on the plurality of first target sampling values, the plurality of second target sampling values ​​and the initialization storage sequence.

[0022] In a second aspect, the present invention provides a time series data compression device, the device comprising:

[0023] An acquisition module is used to acquire the initial time series data to be compressed, the data type of the initial time series data to be compressed, the storage size of the storage space for storing the compressed data, and the database type; a determination module is used to determine the target compression rate based on the initial time series data to be compressed, the data type, the storage size, and the database type. The target compression rate represents the minimum compression degree in the time series data compression process and is used to determine the minimum amount of data to be reduced; a transformation module is used to perform integer transformation on the initial time series data to be compressed to obtain the target time series data to be compressed; a processing module is used to obtain an interval state set based on the target time series data to be compressed through a state change key point extraction method; a compression module is used to compress the initial time series data to be compressed based on the target compression rate and the interval state set to obtain the compressed target time series data.

[0024] In a third aspect, the present invention provides a computer device, comprising: a memory and a processor, the memory and the processor are communicatively connected to each other, computer instructions are stored in the memory, and the processor executes the time series data compression method of the first aspect or any corresponding embodiment thereof by executing the computer instructions.

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

[0026] In a fifth aspect, the present invention provides a computer program product, comprising computer instructions, wherein the computer instructions are used to enable a computer to execute the time series data compression method of the first aspect or any corresponding embodiment thereof. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0028] Figure 1 is a flow chart of a time series data compression method according to an embodiment of the present invention;

[0029] Figure 2 is a flow chart of another time series data compression method according to an embodiment of the present invention;

[0030] Figure 3 is a flow chart of another time series data compression method according to an embodiment of the present invention;

[0031] Figure 4 is a schematic flow chart of a storage space adaptive time series data fast compression method according to an embodiment of the present invention;

[0032] Figure 5 is a time series line graph according to an embodiment of the present invention;

[0033] Fig. 6A is a schematic diagram of the result of performing rounding-up transformation on a time series according to an embodiment of the present invention;

[0034] Figure 6B is a schematic diagram of the result of dividing the transformation sequence into interval states according to an embodiment of the present invention;

[0035] Figure 7is a schematic diagram of a process of performing data reduction with a minimum compression rate of 0.25 according to an embodiment of the present invention;

[0036] Figure 8 is a schematic diagram of a process of performing data reduction with a minimum compression rate of 0.6 according to an embodiment of the present invention;

[0037] Fig. 9 is a structural block diagram of a time series data compression device according to an embodiment of the present invention;

[0038] Fig.10 It is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION

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

[0040] An embodiment of the present invention provides a time series data compression method, which generates a reasonable target compression rate under the constraints of the storage size of the storage space of the given compressed data or the size of the time series data to be compressed to achieve the effect of adaptively compressing the data.

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

[0042] In this embodiment, a time series data compression method is provided, which can be used in electronic devices such as computers, mobile phones, tablet computers, etc. Figure 1 is a flowchart of a time series data compression method according to an embodiment of the present invention. Figure 1 As shown, the process includes the following steps:

[0043] Step S101 , obtaining initial time series data to be compressed, data type of the initial time series data to be compressed, storage size of storage space for storing compressed data, and database type.

[0044] Specifically, the original time series data to be compressed, that is, the initial time series data to be compressed, is obtained. i ,…,x n}, the corresponding sampling timestamp is {t1,…,t i ,…,t n}, where x i Represents the variable at time t i The sampling value of .

[0045] Furthermore, the disk space occupied by the initial time series data X to be compressed is S0, and the data type is data type .

[0046] Furthermore, the storage size of the storage space used to store compressed data is S, and the database type is database type .

[0047] Furthermore, when the provided storage space size S is greater than or equal to the disk space S0 occupied by the original time series data, the compression rate is 0, and all the original data is retained.

[0048] Step S102, determining a target compression ratio based on the initial time series data to be compressed, the data type, the storage size, and the database type.

[0049] The target compression ratio represents the minimum compression degree in the time series data compression process and is used to determine the minimum amount of data to be reduced.

[0050] Specifically, based on the target compression ratio, the compressed data can fully utilize the provided storage space. When the compression ratio performed is greater than the target compression ratio, not only can the provided storage space not be fully utilized, but more original data will also be lost.

[0051] Therefore, determining the corresponding target compression rate based on the initial time series data to be compressed, data type, storage size, and database type can ensure that the compressed data can be well adapted to the given storage environment.

[0052] Step S103, performing rounding transformation on the initial time series data to be compressed to obtain target time series data to be compressed.

[0053] Among them, the rounding transformation can be rounded up or rounded down:

[0054] (1) Each value in the sequence X can be transformed by rounding up to an integer, as shown in the following equation (1):

[0055] y i =C(x i )=Ceil(x i / C)*C (1)

[0056] Where: Ceil means rounding up.

[0057] (2) Each value in the sequence X can be rounded down by F(·), as shown in the following equation (2):

[0058] y i =F(x i )=Floor(x i / C)*C (2)

[0059] Where: Floor means rounding down.

[0060] Specifically, by traversing each value in the sequence X and performing integer transformation using the above method, the transformed sequence, i.e., the target time series data to be compressed, Y={y1,…,y i ,…,y n}.

[0061] Step S104, based on the target time series data to be compressed, the state change key point extraction method is used to process and obtain an interval state set.

[0062] Specifically, the key points of state change can be extracted from the transformed sequence, ie, the target time series data Y to be compressed, and the interval states can be divided to obtain an interval state set containing key points.

[0063] Step S105 , based on the target compression rate and the interval state set, compress the initial time series data to be compressed to obtain compressed target time series data.

[0064] Specifically, different compression methods can be adopted according to the type of each state interval in the interval state set. Furthermore, by compressing the state intervals segment by segment and round by round, data that is old and has not changed much can be reduced first. When the expected compression amount is met, the compression is terminated in time to retain as much important data as possible and reduce information loss.

[0065] The time series data compression method provided in this embodiment determines the target compression rate by obtaining the storage size of the storage space used to store the compressed data and the database type and other information, thereby minimizing the data loss caused by compression and making the most of the limited storage space. Furthermore, by performing rounding transformation on the initial time series data to be compressed, the time series data can be more quickly divided into states. Furthermore, by using the state change key point extraction method to process the target time series data to be compressed after the rounding transformation, an interval state set that can focus on the key state change points in the data and extract the key feature information of the data can be obtained. Finally, based on the interval state set, the target compression rate can be used to implement adaptive compression processing of the initial time series data to be compressed. Therefore, by implementing the present invention, a reasonable target compression rate can be generated under the constraints of the storage size of the storage space of the given compressed data or the size of the time series data to be compressed, and the data can be adaptively compressed.

[0066] In this embodiment, a time series data compression method is provided, which can be used in electronic devices such as computers, mobile phones, tablet computers, etc. Figure 2 is a flowchart of a time series data compression method according to an embodiment of the present invention. Figure 2 As shown, the process includes the following steps:

[0067] Step S201, obtain the initial time series data to be compressed, the data type of the initial time series data to be compressed, the storage size of the storage space used to store the compressed data, and the database type. Figure 1 Step S101 of the illustrated embodiment will not be described in detail here.

[0068] Step S202, determining a target compression ratio based on the initial time series data to be compressed, the data type, the storage size, and the database type.

[0069] Specifically, the above step S202 includes:

[0070] Step S2021, obtaining the first data sequence length of the initial time series data to be compressed.

[0071] Specifically, the initial time series data to be compressed X={x1,…,x i ,…,x n}The length of the first data sequence is n.

[0072] Step S2022, based on the storage size, data type and database type, after being processed by a preset estimation function, an estimated second data sequence length of the initial time series data to be compressed is obtained.

[0073] Specifically, the length m of the second data sequence after the initial time series data to be compressed is estimated by a preset estimation function f, as shown in the following relational expression (3):

[0074] m=f(S,data type ,database type ) (3)

[0075] In some optional implementations, the above step S2022 includes:

[0076] Step a1: Determine the initialization data table of the storage space based on the data type and database type.

[0077] Step a2: insert multiple time series data in the initial time series data to be compressed into the initialization data table in sequence to obtain multiple data row numbers and multiple occupied space sizes.

[0078] Step a3, based on multiple numbers of data rows and multiple occupied space sizes, a preset estimation function is obtained through processing using a preset fitting method.

[0079] Step a4, calculating the length of the second data sequence based on a preset estimation function and storage size.

[0080] Specifically, the preset estimation function f is used to calculate the maximum amount of data that can be stored, that is, the maximum number of rows of data in the database table, from the size of the storage space according to the data type of the data to be stored and the type of the database.

[0081] Furthermore, the method for generating the preset estimation function f may specifically include:

[0082] 1) According to the data type and database type of the original data, initialize the database and data table for storing compressed data in the storage space used to store compressed data compress , record the space size z0 occupied by the data file at this time;

[0083] 2) Select p data from the original data and insert them into the data table compress In the example, the number of data rows p and the size of the occupied space z1 are recorded;

[0084] 3) Add the following to the data table again compress Insert p data into the , record the number of inserted data rows 2p and the storage space occupied z2;

[0085] 4) Repeat step 3) multiple times to obtain multiple sets of data [(0,z0), (p,z1),…, (kp,z k)], then linear or nonlinear fitting methods or machine learning algorithms, such as SVM, can be used to fit and train the data to obtain the corresponding relationship between the number of data rows and the occupied storage space, that is, the preset estimation function f;

[0086] 5) Based on the preset estimation function f and the storage space S, the maximum amount of data that can be stored in this space, i.e., the length m of the second data sequence, is calculated;

[0087] Further, delete the table compress Test data.

[0088] In an optional implementation, a redundancy coefficient α may be added in the above step 5), that is, (1-α)*S is used as the available storage space, and a portion of safety space is reserved to prevent compression failure caused by estimation errors.

[0089] Furthermore, the generation of the above-mentioned preset estimation function f, that is, step a1 to step a4, can also be performed separately outside the process of the time series data compression method provided in this example, that is, the corresponding relationship f can be obtained in advance.

[0090] Step S2023, calculating the target compression rate based on the first data sequence length and the second data sequence length.

[0091] Specifically, the target compression ratio can be calculated using the following equation (4):

[0092]

[0093] Where: Min_CR represents the target compression ratio.

[0094] Step S203: perform rounding transformation on the initial time series data to be compressed to obtain the target time series data to be compressed. Figure 1 Step S103 of the illustrated embodiment will not be described in detail here.

[0095] Step S204: Based on the target time series data to be compressed, the state change key point extraction method is used to process the data to obtain an interval state set.

[0096] Specifically, the above step S204 includes:

[0097] Step S2041, traverse each data value in the target time series data to be compressed in turn, and determine whether two adjacent data values ​​are equal in turn.

[0098] Specifically, the target time series data to be compressed Y={y1,…,y i ,…,y n} and determine whether two adjacent data values ​​are equal.

[0099] In an optional implementation, first traverse the first value y1 and the second value y2 in Y, and then determine whether y1 is equal to y2.

[0100] Step S2042 , determining a plurality of state change key points and a plurality of state mark values ​​in the target time series data to be compressed according to each judgment result.

[0101] Specifically, the corresponding status flag value flag can be determined according to the obtained judgment result. j and multiple state change key points.

[0102] In an optional implementation, the left marker position of the first interval is initialized to t 1L = t1, and set the current interval status flag j =0.

[0103] Further, if y2≠y1, set flag j =1, then continue to traverse the third value y3 in Y and determine whether y3 is equal to y2. If y3 = y2, then determine the right mark point position of the first interval is t 1R = t2; if y3≠y2, continue to traverse the next value in Y and repeat the judgment until the right mark point position t of the first interval is obtained. 1R .

[0104] Furthermore, if y2=y1, keep the current interval status flag j = 0, then continue to traverse the third value y3 in Y and determine whether y3 is equal to y2. If y3≠y2, then determine the right mark point position of the first interval as t 1R = t2; if y3 = y2, continue to traverse the next value in Y, and judge repeatedly until the right mark point position t of the first interval is obtained. 1R .

[0105] Repeat the above operation until multiple state change key points (multiple left mark point positions t jL , multiple right marker positions t jR ) and multiple interval status flags j .

[0106] Further, when traversing to the last value y in Y n When the right marker position t mL If the value of is not empty, then t mR =t n , end the key point extraction process; if t mL If the value of is empty, then t mL =t mR=t n , flag m =0, and then the key point extraction process ends.

[0107] Step S2043: determining an interval state set based on a plurality of state change key points and a plurality of state mark values.

[0108] Specifically, the corresponding interval state set G={(t 1L ,t 1R ,flag1),…,(t jL ,t jR ,flag j ),…,(t mL ,t mR ,flag m )}. Among them, (t jL ,t jR ,flag j ) represents the jth state interval, t jL is the starting point of the interval, t jR is the end point of the interval, flag j =0 means this interval is a stable interval, flag j =1 means this interval is a fluctuation interval.

[0109] In one example, the method for extracting key points of state change from the transformed sequence may specifically include:

[0110] 1) Initialize variables j=1, i=1;

[0111] 2) Set the left marker position of the jth interval to t jL =t i , set the current interval status flag j =0;

[0112] 3) Determine y i+1 and i Are they equal? ​​If y i+1 ≠y i , then set the flag j =1; otherwise, execute step 4);

[0113] 4) Set i=i+1;

[0114] 5) If (y i+1 = =y i andflag j = =1)or(y i+1 ≠y i andflag j= = 0), then set t jR =t i , get the jth state interval (t jL ,t jR ,flag j ), set j=j+1, i=i+1, and repeat the above steps 2) to 5); otherwise, execute step 6);

[0115] 6) Repeat steps 4) to 5) until all values ​​of Y are traversed and a set G containing m state intervals is obtained. 1L ,t 1R ,flag1),…,(t jL ,t jR ,flag j ),…,(t mL ,t mR ,flag m )}.

[0116] Among them, (t jL ,t jR ,flag j ) represents the jth state interval, t jL is the starting point of the interval, t jR is the end point of the interval, flag j =0 means this interval is a stable interval, flag j =1 means this interval is a fluctuation interval.

[0117] Further, when the value of i=i+1 in step 4) or step 5) is n, if t mL If the value of is not empty, then t mR =t n , end the key point extraction process; if t mL If the value of is empty, then t mL =t mR =t n , flag m =0, and then the key point extraction process ends.

[0118] Step S205: Based on the target compression rate and the interval state set, the initial time series data to be compressed is compressed to obtain the compressed target time series data. Figure 1 Step S105 of the illustrated embodiment will not be described in detail here.

[0119] The time series data compression method provided in this embodiment can estimate the length of the second data sequence after the initial time series data to be compressed is compressed through a preset estimation function. Furthermore, the target compression rate can be calculated in combination with the length of the first data sequence of the initial time series data to be compressed. By considering the storage size, data type and database type, it can be ensured that the compressed data can be well adapted to the given storage environment. Furthermore, by successively determining whether two adjacent data values ​​are equal, the key points where the state changes actually occur in the data sequence can be more accurately found. Furthermore, the corresponding interval state set can be determined in combination with multiple state mark values.

[0120] In this embodiment, a time series data compression method is provided, which can be used in electronic devices such as computers, mobile phones, tablet computers, etc. Figure 3 is a flowchart of a time series data compression method according to an embodiment of the present invention. Figure 3 As shown, the process includes the following steps:

[0121] Step S301, obtain the initial time series data to be compressed, the data type of the initial time series data to be compressed, the storage size of the storage space used to store the compressed data, and the database type. Figure 1 Step S101 of the illustrated embodiment will not be described in detail here.

[0122] Step S302: Determine the target compression rate based on the initial time series data to be compressed, data type, storage size, and database type. Figure 2 Step S202 of the illustrated embodiment will not be described in detail here.

[0123] Step S303: perform rounding transformation on the initial time series data to be compressed to obtain the target time series data to be compressed. Figure 1 Step S103 of the illustrated embodiment will not be described in detail here.

[0124] Step S304: Based on the target time series data to be compressed, the state change key point extraction method is used to obtain an interval state set. Figure 2 Step S204 of the illustrated embodiment will not be described in detail here.

[0125] Step S305 , based on the target compression rate and the interval state set, compress the initial time series data to be compressed to obtain compressed target time series data.

[0126] Specifically, the above step S305 includes:

[0127] Step S3051, traverse the interval state set in chronological order to obtain multiple target state intervals and multiple target state mark values.

[0128] Specifically, the data that is far away from the current time can be compressed first according to the time sequence. Therefore, each interval in the interval state set G and the corresponding target state flag value flag in each interval can be traversed in time sequence. j .

[0129] The traversal process can be counted using a counter Counter. Furthermore, the counter Counter=0 is initialized before the traversal starts.

[0130] Step S3052: based on multiple target state intervals and multiple target state mark values, compress the initial time series data to be compressed to obtain compressed initial time series data.

[0131] Specifically, the obtained multiple target state areas and multiple target state mark values ​​can be combined to sequentially compress the initial time series data to be compressed, and obtain compressed initial time series data.

[0132] In some optional implementations, the above step S3052 includes:

[0133] Step b1, obtaining an initialization storage sequence.

[0134] Step b2: based on the multiple target state intervals and the multiple target state mark values, respectively determine the compressed multiple first target sampling values ​​and the multiple second target sampling values.

[0135] Step b3, determining compressed initial time series data based on multiple first target sampling values, multiple second target sampling values ​​and an initialization storage sequence.

[0136] Specifically, the initialization storage sequence Z=[].

[0137] Further, obtain the target state interval (t jL ,t jR ,flag j ). At this time, if flag j If the value is 0, the initial time series data X to be compressed is calculated in the time interval [t jL ,t jR ] as the compressed sampling value, and set the timestamp to t jR , Counter=Counter+K j -1, where K j Indicates the length of the data sequence in the jth state interval, which is a reduction of K j -1 data.

[0138] Furthermore, if flag jThe value of is 1, then the initial time series data X to be compressed is jL ,t jR The original value of each data value in ] As the compressed sampling value, the timestamp of the original value is retained, and the compressed value is saved in the initialization storage sequence Z.

[0139] Further, repeat the above steps until Counter≥nm, terminate the compression, and obtain the corresponding compressed initial time series data. Otherwise, continue to traverse the interval state set G until all state intervals in the traversal have been completed.

[0140] Step S3053: when the compression ratio of the initial time series data is greater than the target compression ratio, the initial time series data is determined to be the target time series data.

[0141] Specifically, if the compression ratio of the initial time series data obtained after compression is greater than the target compression ratio Min_CR, the initial time series data is used as the final target time series data after compression.

[0142] Step S3054: when the compression rate of the initial time series data is less than the target compression rate, return to the step of performing integer transformation on the initial time series data to be compressed, and iterate repeatedly to obtain the compressed target time series data.

[0143] Specifically, after all flags are compressed j = 0, when the compression rate is still less than the target compression rate Min_CR, based on the compressed initial time series data, step S303 is repeated, the parameter C is increased, the integer transformation is performed again, and then steps S304 and S305 are repeated to perform a new round of compression.

[0144] Furthermore, when a new round of compression is performed, it is necessary to base it on the sequence after the previous round of compression, that is, the initial time series data, and accumulate the amount of data compressed in the previous round, Counter, until Stop compression when Counter p It represents the amount of data reduced in the pth round, and finally obtains the compressed sequence of the initial time series data X to be compressed, that is, the compressed target time series data Z.

[0145] Furthermore, the obtained compressed target time series data may be saved in a database with a preset storage space size.

[0146] The time series data compression method provided in this embodiment performs segment-by-segment and round-by-round compression based on the state interval, giving priority to reducing data that is old and has not changed much. Furthermore, by comparing the compression rate of the initial time series data with the target compression rate, it is possible to accurately control whether the compressed data finally obtained meets the pre-set compression degree requirement, effectively avoiding the problem of storage space waste due to insufficient compression, and also preventing the loss of data information due to excessive compression.

[0147] In one example, a storage space-adaptive time series data fast compression method is provided, which can adaptively generate a minimum compression rate under the constraints of a given disk storage space size or compressed data file size. By rounding the original time series, the key points of state change are extracted and divided into multiple stable or fluctuating state intervals, and then different compression methods are adopted according to the type of state interval. Through segment-by-segment compression and round-by-round compression based on the state interval, data that is old and has not changed much is reduced first. When the expected compression amount is met, the compression is terminated in time to retain as much important data as possible and reduce information loss. Figure 4 As shown: The specific steps include:

[0148] Step 1: Get the database type, the time series data to be compressed, the data type and the size of the disk space occupied, and the size of the storage space used to store the compressed data.

[0149] Assume that the original time series data to be compressed is X = {x1,…,x i ,…,x n}, the corresponding sampling timestamp is T = {t1,…,t i ,…,t n}, where x i Represents the variable at time t i The original data takes up a disk space of S0, and the data type is data. type , the storage space size for storing compressed data is S, and the database type for storing compressed data is database type .

[0150] In particular, when the provided storage space S is greater than or equal to the disk space S0 occupied by the original time series data, the compression rate is 0, and all the original data is retained.

[0151] Step 2: Calculate the minimum compression ratio based on the length of the original time series, data type, size of the compressed available storage space, and database type.

[0152] The minimum compression ratio determines the minimum amount of data to be reduced. In this scenario, the compressed data can fully utilize the provided storage space. When the compression ratio performed is greater than this minimum compression ratio, not only will the provided storage space not be fully utilized, but more original data will be lost.

[0153] The minimum compression ratio is calculated as:

[0154]

[0155] Among them, n is the length of the original data sequence before compression, and m is the estimated length of the data sequence after compression.

[0156] The calculation method of m is:

[0157] m=f(S,data type ,database type )

[0158] Among them, f is the estimation function of m, which is to infer the maximum amount of data that can be stored from the size of the storage space according to the data type of the data to be stored and the type of database, that is, the maximum number of rows of data in the database table. The method of generating f is as follows:

[0159] 1) According to the data type and database type of the original data, initialize the database and data table for storing compressed data in the storage space used to store compressed data compress , record the space size z0 occupied by the data file at this time;

[0160] 2) Select p data from the original data and insert them into the data table compress In the example, the number of data rows p and the size of the occupied space z1 are recorded;

[0161] 3) Add the following to the data table again compress Insert p data into the , record the number of inserted data rows 2p and the storage space occupied z2;

[0162] 4) Repeat step 3) multiple times to obtain multiple sets of data [(0,z0), (p,z1),…, (kp,z k )], then linear or nonlinear fitting methods or machine learning algorithms, such as SVM, can be used to fit and train the data to obtain the corresponding relationship between the number of data rows and the occupied storage space, that is, the preset estimation function f;

[0163] 5) Based on the preset estimation function f and the storage space S, the maximum amount of data that can be stored in this space, i.e., the length m of the second data sequence, is calculated;

[0164] 6) Delete table compress Test data.

[0165] Optionally, in the above step 5), a redundancy coefficient α may be increased, that is, (1-α)*S is used as the available storage space, and a portion of safety space is reserved to prevent compression failure caused by estimation errors.

[0166] Furthermore, the above-mentioned fitting estimation process can be performed separately outside the method execution process provided in this example to obtain the corresponding relationship f in advance, or it can be directly performed in the steps of this process.

[0167] Step 3: perform rounding transformation on the original time series data.

[0168] Specifically, traverse each value in the sequence X and perform integer transformation to obtain the transformed sequence Y = {y1,…,y i ,…,y n}.

[0169] The method of performing the rounding-up transformation C(·) on each data value in the sequence X is:

[0170] y i =C(x i )=Ceil(x i / C)*C

[0171] Among them, Ceil means rounding up.

[0172] Optionally, each data value in the sequence X may be subjected to an F(·) floor transformation, and the F(·) transformation method is:

[0173] y i =F(x i )=Floor(x i / C)*C

[0174] Among them, y i =F(x i )=Floor(x i / C)*C (2)

[0175] Where: Floor means rounding down.

[0176] Step 4: extract the key points of state change of the transformed sequence, divide the interval state, and obtain the interval state set containing the key points.

[0177] For the transformed sequence Y = {y1,…,y i ,…,y n The method for extracting key points of state change is:

[0178] Step 4.1: Initialize variables j=1, i=1;

[0179] Step 4.2: Set the left marker position of the jth interval to t jL =t i , set the current interval status flag j =0;

[0180] Step 4.3: Determine y i+1 and i Are they equal? ​​If y i+1 ≠y i , then set the flag j =1; otherwise, execute step 4);

[0181] Step 4.4: Set i=i+1;

[0182] Step 4.5: If (y i+1 = =y i and flag j = =1)or(y i+1 ≠y i and flag j = = 0), then set t jR =t i , get the jth state interval (t jL ,t jR ,flag j ), set j=j+1, i=i+1, and repeat the above steps 4.2 to 4.5; otherwise, execute step 4.6;

[0183] Step 4.6: Repeat steps 4.4 to 4.5 until all values ​​of Y are traversed and a set G containing m state intervals is obtained. 1L ,t 1R ,flag1),…,(t jL ,t jR ,flag j ),…,(t mL ,t mR ,flag m )}.

[0184] Among them, (t jL ,t jR ,flag j ) represents the jth state interval, t jL is the starting point of the interval, t jR is the end point of the interval, flag j =0 means this interval is a stable interval, flag j =1 means this interval is a fluctuation interval.

[0185] In particular, when the value of i=i+1 in step 4.4 or step 4.5 is n, if t mL If the value of is not empty, then t mR =t n , end the key point extraction process; if t mL If the value of is empty, then t mL =t mR =t n , flag m =0, and then the key point extraction process ends.

[0186] Step 5: Reduce the original data sequence according to the minimum compression rate of step 2 and the interval state set containing key points obtained in step 4.

[0187] The reduction method is:

[0188] Step 5.1: Initialize the counter Counter = 0, initialize the storage sequence Z = [];

[0189] Step 5.2: According to the time sequence, give priority to compressing data that is far away from the current time. Get a state interval (t jL ,t jR ,flag j );

[0190] Step 5.3: If flag j The value of is 0, then calculate X in the time interval [t jL ,t jR ] is taken as the compressed sampling value, and the timestamp is set to t jR , Counter=Counter+K j -1, where K j Indicates the length of the data sequence in the jth state interval, which is a reduction of K j -1 data; if flag j The value of is 1, then X is in the time interval [t jL ,t jR ] The original value of each data value in As the compressed sample value, the timestamp of the original value is retained; the compressed value is saved in the sequence Z;

[0191] Step 5.4: If Counter ≥ nm, terminate compression and execute step 6, otherwise execute step 5.5;

[0192] Step 5.5: If all state intervals in G have been traversed, execute step 5.6, otherwise repeat steps 5.2 to 5.4;

[0193] Step 5.6: After compressing all flags j = 0, if the compression rate is still less than Min_CR, repeat step 3 for the sequence Z after this round of compression, increase parameter C, perform integer transformation again, and then repeat steps 4 and 5 to perform a new round of compression.

[0194] In particular, in step 5.6 above, when a new round of compression is performed, it is necessary to base it on the sequence after the previous round of compression and accumulate the amount of data compressed in the previous round, Counter, until Stop compression when Counter p It represents the amount of data reduced in the pth round, and finally obtains the compressed sequence Z of X.

[0195] Step 6: output the data reduced in step 5 and save it in a database with a preset storage space size.

[0196] In an optional implementation, a partial data example is used. Figure 5 As shown in the figure, the changing trend of 200 raw data is shown, and the data type of each data point is float. For the convenience of display, the timestamp of the horizontal axis is replaced by the index.

[0197] Furthermore, according to different storage space requirements, the minimum compression ratios in this embodiment are 0.3 and 0.6 respectively. Execute step 3 to perform rounding transformation on the original time series. Configure the transformation base C = 5, perform rounding up transformation, and obtain a new sequence, such as Fig. 6A shown.

[0198] Further, Fig. 6A The transformation sequence in the above example performs the key point extraction operation described in step 4, and we can get Figure 6B The state interval division shown (divided by short black lines).

[0199] Further, taking the minimum compression rate of 0.3 as an example, the original sequence length is 200, and the amount of data to be reduced is 60. Using the method in step 5, when the 70th data is compressed, the number of reductions is 60, which meets the requirement, and the compression is stopped. Figure 7 Figure 2 shows the data points that are retained after the first 70 data reductions, marked with black circles.

[0200] Further, taking the minimum compression rate of 0.6 as an example, the original sequence length is 200, and the amount of data to be reduced is 120. Using the method in step 5, Figure 6B The state intervals in are compressed one by one. When the 185th data is compressed, the number of reductions is 122, which meets the requirement, and the compression is stopped. Figure 8 As shown, the data points retained after data reduction in the compression interval are shown, marked with black circles.

[0201] In particular, when the compression rate of the first round cannot meet the requirements, a new round of compression can be performed on the basis of the reduced data as described in step 5.6 above until the data reduction amount requirements are met, thereby obtaining the final compression sequence and saving it in a database with a preset storage space size.

[0202] The storage space adaptive time series data fast compression method provided in this example has the following beneficial effects:

[0203] 1) According to the length of the original time series, data type, size of the compressed available storage space and database type, by inserting test data, obtaining sample data of the number of data rows and the storage space occupied, fitting and estimating, inferring the maximum amount of data that can be stored, and thus obtaining the minimum compression rate. At this compression rate, the data loss caused by compression can be minimized as much as possible, and the limited storage space can be utilized to the maximum extent. By setting up a redundant system, a part of the safety space can be reserved to prevent compression failure caused by compression rate estimation errors.

[0204] 2) The state division method based on rounding transformation can divide the state of the time series more quickly, and the time complexity of the algorithm is only related to the length of the time series. By taking the average of the data in the stable state and taking the original value of the data with large fluctuations, the key change characteristics of the time series can be better preserved. The overall data reduction technology is adopted, and the compressed timestamps and values ​​do not need to be decompressed and can be directly read and used.

[0205] 3) In the time series, the newer the data and the more volatile the data, the more valuable the information it contains. Based on the different state intervals divided, in chronological order, the interval data that is far away from the current time and has a stable state is compressed first. When it is detected that the compression rate is met, the compression is terminated in time. By compressing the state intervals segment by segment and round by round, new data and volatile data can be retained first, so that the compressed data can retain valuable information to the maximum extent.

[0206] Furthermore, the storage space adaptive time series data fast compression method provided in this example has the following application values:

[0207] 1) Data storage area: When the storage space size or the compressed data file size is limited, valuable data can be retained as much as possible while meeting the limited conditions.

[0208] 2) Data transmission: For example, in cloud-edge collaboration scenarios, the most important data is transmitted under the constraints of specified bandwidth and transmission volume.

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

[0210] This embodiment provides a time series data compression device, such as Fig. 9 As shown, the device comprises:

[0211] The acquisition module 901 is used to acquire the initial time series data to be compressed, the data type of the initial time series data to be compressed, the storage size of the storage space for storing the compressed data, and the database type.

[0212] Determination module 902 is used to determine the target compression rate based on the initial time series data to be compressed, data type, storage size and database type. The target compression rate represents the minimum compression degree in the time series data compression process and is used to determine the minimum amount of data to be reduced.

[0213] The transformation module 903 is used to perform integer transformation on the initial time series data to be compressed to obtain the target time series data to be compressed.

[0214] The processing module 904 is used to obtain an interval state set based on the target time series data to be compressed by processing the target time series data using a state change key point extraction method.

[0215] The compression module 905 is used to compress the initial time series data to be compressed based on the target compression rate and the interval state set to obtain compressed target time series data.

[0216] In some optional implementations, the determining module 902 includes:

[0217] The acquisition submodule is used to obtain the first data sequence length of the initial time series data to be compressed.

[0218] The processing submodule is used to obtain the estimated second data sequence length after the initial time series data to be compressed is compressed based on the storage size, data type and database type through processing by a preset estimation function.

[0219] The calculation submodule is used to calculate the target compression rate based on the first data sequence length and the second data sequence length.

[0220] In some optional implementations, the processing submodule includes:

[0221] The first determining unit is used to determine an initialization data table of the storage space based on the data type and the database type.

[0222] The inserting unit is used to insert multiple time series data in the initial time series data to be compressed into the initialization data table in sequence to obtain multiple data row numbers and multiple occupied space sizes.

[0223] The processing unit is used to obtain a preset estimation function based on multiple data row numbers and multiple occupied space sizes through a preset fitting method.

[0224] The calculation unit is used to calculate the length of the second data sequence based on a preset estimation function and a storage size.

[0225] In some optional implementations, the processing module 904 includes:

[0226] The traversal and judgment submodule is used to traverse each data value in the target time series data to be compressed in sequence, and to judge whether two adjacent data values ​​are equal in sequence.

[0227] The first determination submodule is used to determine a plurality of state change key points and a plurality of state mark values ​​in the target time series data to be compressed according to each judgment result.

[0228] The second determination submodule is used to determine the interval state set based on multiple state change key points and multiple state mark values.

[0229] In some optional implementations, the compression module 905 includes:

[0230] The traversal submodule is used to traverse the interval state set in chronological order to obtain multiple target state intervals and multiple target state mark values.

[0231] The compression submodule is used to compress the initial time series data to be compressed based on multiple target state intervals and multiple target state mark values ​​to obtain compressed initial time series data.

[0232] The third determination submodule is used to determine that the initial time series data is the target time series data when the compression rate of the initial time series data is greater than the target compression rate.

[0233] The iterative submodule is used to return to the step of performing rounding transformation on the initial time series data to be compressed when the compression rate of the initial time series data is less than the target compression rate, and repeatedly iterate to obtain the compressed target time series data.

[0234] In some optional embodiments, the compression submodule includes:

[0235] The acquisition unit is used to acquire the initialization storage sequence.

[0236] The second determining unit is used to determine the compressed multiple first target sampling values ​​and the multiple second target sampling values ​​respectively based on the multiple target state areas and the multiple target state mark values.

[0237] The third determining unit is used to determine the compressed initial time series data based on the multiple first target sampling values, the multiple second target sampling values ​​and the initialization storage sequence.

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

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

[0240] The embodiment of the present invention also provides a computer device having the above Fig. 9 The timing data compression device shown.

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

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

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

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

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

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

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

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

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

Claims

1. A time series data compression method, characterized in that: The method comprises: Acquire initial time series data to be compressed, data type of the initial time series data to be compressed, storage size of storage space for storing compressed data, and database type; Determine a target compression ratio based on the initial time series data to be compressed, the data type, the storage size, and the database type, wherein the target compression ratio represents a minimum compression degree in the time series data compression process and is used to determine a minimum amount of data to be reduced; Performing integer transformation on the initial time series data to be compressed to obtain target time series data to be compressed; Based on the target time series data to be compressed, a state change key point extraction method is used to obtain an interval state set; Based on the target compression rate and the interval state set, the initial time series data to be compressed is compressed to obtain compressed target time series data.

2. The method according to claim 1, characterized in that Determining a target compression rate based on the initial time series data to be compressed, the data type, the storage size, and the database type includes: Acquire a first data sequence length of the initial time series data to be compressed; Based on the storage size, the data type and the database type, an estimated second data sequence length of the initial time series data to be compressed after being compressed is obtained through processing by a preset estimation function; The target compression ratio is calculated based on the first data sequence length and the second data sequence length.

3. The method according to claim 2, characterized in that Based on the storage size, the data type and the database type, the estimated second data sequence length of the initial time series data to be compressed after being processed by a preset estimation function is obtained, including: Based on the data type and the database type, determining an initialization data table of the storage space; Inserting multiple time series data in the initial time series data to be compressed into the initialization data table in sequence to obtain multiple data row numbers and multiple occupied space sizes; Based on the multiple numbers of data rows and the multiple occupied space sizes, the preset estimation function is obtained by processing with a preset fitting method; Based on the preset estimation function and the storage size, the second data sequence length is calculated.

4. The method according to claim 1, characterized in that: Based on the target time series data to be compressed, the interval state set is obtained by processing the state change key point extraction method, including: Traversing each data value in the target time series data to be compressed in sequence, and determining in sequence whether two adjacent data values ​​are equal; Determine a plurality of state change key points and a plurality of state mark values ​​in the target time series data to be compressed according to each judgment result; The interval state set is determined based on the multiple state change key points and the multiple state mark values.

5. The method according to claim 1, characterized in that Based on the target compression rate and the interval state set, compressing the initial time series data to be compressed to obtain compressed target time series data, including: Traversing the interval state set in chronological order to obtain a plurality of target state intervals and a plurality of target state tag values; Based on the multiple target state intervals and the multiple target state mark values, compressing the initial time series data to be compressed to obtain compressed initial time series data; When the compression rate of the initial time series data is greater than the target compression rate, determining the initial time series data as the target time series data; When the compression rate of the initial time series data is less than the target compression rate, return to the step of performing integer transformation on the initial time series data to be compressed, and iterate repeatedly to obtain the compressed target time series data.

6. The method according to claim 5, characterized in that Based on the multiple target state intervals and the multiple target state mark values, compressing the initial time series data to be compressed to obtain compressed initial time series data, including: Get the initialization storage sequence; Based on the multiple target state areas and the multiple target state mark values, respectively determine a plurality of compressed first target sampling values ​​and a plurality of second target sampling values; The compressed initial time series data is determined based on the multiple first target sampling values, the multiple second target sampling values ​​and the initialization storage sequence.

7. A time series data compression device, characterized in that: The device comprises: An acquisition module, used to acquire initial time series data to be compressed, a data type of the initial time series data to be compressed, a storage size of a storage space for storing compressed data, and a database type; A determination module, configured to determine a target compression ratio based on the initial time series data to be compressed, the data type, the storage size, and the database type, wherein the target compression ratio represents a minimum compression degree in the time series data compression process and is configured to determine a minimum amount of data to be reduced; A transformation module, used for performing rounding transformation on the initial time series data to be compressed to obtain target time series data to be compressed; A processing module, used for obtaining an interval state set based on the target time series data to be compressed by processing the target time series data through a state change key point extraction method; A compression module is used to compress the initial time series data to be compressed based on the target compression rate and the interval state set to obtain compressed target time series data.

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

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

10. A computer program product, characterized in that The method comprises computer instructions, wherein the computer instructions are used to cause a computer to execute the time series data compression method according to any one of claims 1 to 6.