Time series data aggregation analysis method, device and equipment and readable storage medium

By using pre-aggregation format and index information in time series data files to find aggregate values, the problem of low efficiency of time series data aggregation analysis in IoT time series scenarios is solved, and efficient query and aggregation analysis are achieved.

CN118733897APending Publication Date: 2024-10-01HANGZHOU HIKVISION DIGITAL TECHNOLOGY CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202310342616.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-03-31
Publication Date
2024-10-01

AI Technical Summary

Technical Problem

The existing technology has low efficiency in the aggregation analysis of time series data in IoT time series scenarios. It needs to load historical time series data from disk to memory for aggregation analysis, resulting in low query efficiency.

Method used

Propose a time series data file format that contains pre-aggregation, and perform aggregation analysis on the basis of this format. Find the target aggregation value through index information to avoid loading the original time series data, and use the index information to indicate the location of the time series data block to obtain the required The data is aggregated for analysis.

Benefits of technology

It improves the query efficiency of time series data aggregation analysis, ensures the accuracy of queries, reduces the loading requirements for original time series data, and supports rapid aggregation analysis of various devices, metrics, and aggregation items.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118733897A_ABST
    Figure CN118733897A_ABST
Patent Text Reader

Abstract

The invention discloses a time series data aggregation analysis method, device and equipment and a readable storage medium, and the method comprises the steps: searching a target aggregation value in index information of a time series data file under the condition of receiving an aggregation analysis request; if the target aggregation value is not found in the index information of the time sequence data file and the time sequence data file is determined to contain a measurement value of a target measurement of the target object in the target time range according to the index information, determining the target aggregation value according to the position of a time sequence data block corresponding to the target object indicated by the index information in the time sequence data file; and acquiring data in the time sequence data block corresponding to the target object, and searching the target aggregation value according to the acquired data. According to the method, the time sequence data aggregation analysis efficiency is improved.
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 aggregation analysis method, device, equipment and computer-readable storage medium. Background Art

[0002] Time series data records the measurement values ​​that change over time, for example, the temperature value of a device over a period of time. In IoT time series scenarios, users usually have aggregation analysis services for historical time series data, such as querying the maximum temperature of a device over a period of time. Currently, the aggregation analysis of time series data requires loading the stored historical time series data from the disk into the memory, and then performing aggregation analysis to obtain the aggregate value, resulting in low query efficiency. Summary of the invention

[0003] The main purpose of the present invention is to provide a method, device, equipment and computer-readable storage medium for time series data aggregation analysis, aiming to propose a time series data file format containing pre-aggregated aggregation values, and perform aggregation analysis based on files in this format, so as to avoid performing aggregation analysis by loading the original time series data as much as possible, thereby improving query efficiency.

[0004] To achieve the above object, the present invention provides a time series data aggregation analysis method, the method comprising the following steps:

[0005] In case of receiving an aggregation analysis request, searching for a target aggregation value in the index information of a time series data file, wherein the time series data file includes the index information and at least one time series data block, each of the time series data blocks includes time series data of an object within at least one time range, the time series data includes a time list and a metric value list corresponding to at least one metric, the index information is used to indicate the object corresponding to each of the time series data blocks in the time series data file, the time range and metric aggregation information of the time series data in each of the time series data blocks, and the position of each of the time series data blocks in the time series data file, the metric aggregation information includes the aggregation value of at least one aggregation item corresponding to each of the metrics; the target aggregation value is the aggregation value of the target aggregation item of the target object with respect to the target metric within the target time range, and the target object, the target time range, the target metric, and the target aggregation item are indicated by the aggregation analysis request;

[0006] If the target aggregate value is not found in the index information of the time series data file, and it is determined based on the index information that the time series data file contains the metric value of the target metric of the target object within the target time range, then according to the position of the time series data block corresponding to the target object indicated by the index information in the time series data file, the data in the time series data block corresponding to the target object is obtained, and the target aggregate value is searched for based on the obtained data.

[0007] Optionally, the index information includes data block index information corresponding to each of the time series data blocks in the time series data file, and the data block index information includes the time range and metric aggregation information of the time series data in the time series data block and the position information of the time series data block in the time series data file;

[0008] The step of searching the target aggregate value in the index information of the time series data file includes:

[0009] Obtaining index information of each target data block corresponding to the target object;

[0010] For each target data block index information, if the time range included in the target data block index information falls within the target time range or is completely consistent with the target time range, then find out the aggregation value of the target aggregation item of the target metric from the metric aggregation information included in the target data block index information, and use the found aggregation value as a candidate aggregation value to determine the target aggregation value according to all the candidate aggregation values ​​found;

[0011] If the time range included in the target data block index information is outside the target time range, it is determined that the target aggregate value is not found in the target data block index information, and it is determined that the time series data block corresponding to the target data block index information does not contain the metric value of the target metric of the target object within the target time range;

[0012] If the time range included in the target data block index information overlaps with the target time range, it is determined that the target aggregate value is not found in the target data block index information, and it is determined that the time series data block corresponding to the target data block index information contains the metric value of the target metric of the target object within the target time range.

[0013] Optionally, the index information further includes object index information corresponding to each object contained in the time series data file, the object index information includes position information of each data block index information corresponding to the same object in the time series data file, and time range and metric aggregation information of the time series data in all the time series data blocks corresponding to the same object;

[0014] Before the step of obtaining index information of each target data block corresponding to the target object, the method includes:

[0015] Obtaining target object index information corresponding to the target object;

[0016] If the time range included in the target object index information falls within the target time range or is completely consistent with the target time range, then find out the aggregation value of the target aggregation item of the target metric from the metric aggregation information included in the target object index information, and use the found aggregation value as a candidate aggregation value to determine the target aggregation value based on all the candidate aggregation values ​​found;

[0017] If the time range included in the target object index information falls outside the target time range, determining that the target aggregate value cannot be found in the time series data file;

[0018] If the time range included in the target object index information overlaps with the target time range, the step of obtaining the target data block index information corresponding to the target object is performed according to the position information of the data block index information corresponding to the target object included in the target object index information in the timing data file.

[0019] Optionally, the index information further includes file index information corresponding to the time series data file, the file index information including serial numbers of all objects included in the time series data file, and position information of the object index information corresponding to all objects in the time series data file;

[0020] Before the step of obtaining the target object index information corresponding to the target object, the method further includes:

[0021] Obtaining the file index information;

[0022] If the file index information does not include the serial number of the target object, it is determined that the target aggregate value cannot be found in the time series data file;

[0023] If the file index information includes the serial number of the target object, the step of obtaining the target object index information corresponding to the target object is performed according to the position information of the target object index information included in the file index information in the time series data file.

[0024] Optionally, the index information further includes a Bloom filter constructed according to each object included in the time series data file, and the time series data file further includes file tail area information;

[0025] Before the step of obtaining the file index information, the method further includes:

[0026] Acquire the file tail area information, and acquire the Bloom filter according to the position information of the Bloom filter in the time series data file included in the file tail area information;

[0027] If the Bloom filter indicates that the time series data file does not contain the target object, determining that the target aggregate value cannot be found in the time series data file;

[0028] If the Bloom filter indicates that the target object is included in the time series data file, the step of obtaining the file index information is performed according to the position information of the file index information included in the file tail area information in the time series data file.

[0029] Optionally, before the step of obtaining the file tail area information, the step further includes:

[0030] Searching for the Bloom filter and the file index information in memory;

[0031] If the Bloom filter and the file index information are not found, the step of obtaining the file tail area information is performed.

[0032] Optionally, each of the time series data blocks includes at least one time series data page and a page header corresponding to each of the time series data pages, the time series data page includes time series data of an object within a time range, the page header includes the time range and metric aggregation information of the time series data in the corresponding time series data page, and the page header also includes position information of the corresponding time series data page in the time series data file;

[0033] The step of acquiring data in the time series data block corresponding to the target object according to the position of the time series data block corresponding to the target object indicated by the index information in the time series data file, and searching for the target aggregate value according to the acquired data comprises:

[0034] Acquire each target page header in the time series data block corresponding to the target object according to the position of the time series data block corresponding to the target object indicated by the index information in the time series data file;

[0035] For each of the target page headers, if the time range included in the target page header falls within the target time range or is completely consistent with the target time range, then find out the aggregation value of the target aggregation item of the target metric from the metric aggregation information included in the target page header, and use the found aggregation value as a candidate aggregation value, so as to determine the target aggregation value according to all the candidate aggregation values ​​found;

[0036] If the time range included in the target page header is outside the target time range, determining that the time series data page corresponding to the target page header does not include the metric value of the target metric of the target object within the target time range;

[0037] If the time range included in the target page header overlaps with the target time range, the time series data page corresponding to the target page header is obtained according to the location information included in the target page header, and the aggregation value of the target aggregation item of the target metric of the target object within the overlapping time range is obtained according to the metric value sequence corresponding to the target metric in the time series data page, and the statistically obtained aggregation value is used as a candidate aggregation value to determine the target aggregation value based on all the candidate aggregation values ​​found, wherein the overlapping time range is the overlapping part of the time range included in the target page header and the target time range.

[0038] To achieve the above object, the present invention further provides a time series data aggregation analysis device, the device comprising:

[0039] A first search module is configured to search for a target aggregate value in the index information of a time series data file when an aggregate analysis request is received, wherein the time series data file includes the index information and at least one time series data block, each of the time series data blocks includes time series data of an object within at least one time range, the time series data includes a time list and a metric value list corresponding to at least one metric, the index information is configured to indicate the object corresponding to each of the time series data blocks in the time series data file, the time range and metric aggregation information of the time series data in each of the time series data blocks, and the position of each of the time series data blocks in the time series data file, the metric aggregation information includes the aggregate value of at least one aggregation item corresponding to each of the metrics; the target aggregate value is the aggregate value of the target aggregation item of the target object with respect to the target metric within the target time range, and the target object, the target time range, the target metric, and the target aggregation item are indicated by the aggregate analysis request;

[0040] A second search module is used for obtaining data in the time series data block corresponding to the target object according to the position of the time series data block corresponding to the target object indicated by the index information in the time series data file, and searching for the target aggregate value based on the acquired data, if the target aggregate value is not found in the index information of the time series data file, and it is determined based on the index information that the time series data file contains the metric value of the target metric of the target object within the target time range.

[0041] To achieve the above-mentioned purpose, the present invention also provides a time series data aggregation and analysis device, which includes: a memory, a processor, and a time series data aggregation and analysis program stored in the memory and executable on the processor, and the time series data aggregation and analysis program, when executed by the processor, implements the steps of the time series data aggregation and analysis method as described above.

[0042] In addition, to achieve the above objectives, the present invention also proposes a computer-readable storage medium, on which a time series data aggregation analysis program is stored, and when the time series data aggregation analysis program is executed by a processor, the steps of the time series data aggregation analysis method as described above are implemented.

[0043] In an embodiment of the present invention, when an aggregation analysis request is received, the target aggregation value is searched in the index information of the time series data file. Since the index information includes information indicating the object corresponding to each time series data block in the time series data file, it can be determined whether the time series data file includes the time series data of the target object. When it is determined that the time series data file includes the time series data of the target object, since the index information includes the time range of the time series data in each time series data block, it can be determined whether the various aggregation values ​​of the target object within the target time range can be found from the index information. When it is determined that the various aggregation values ​​of the target object within the target time range can be found from the index information, since the index information includes the metric aggregation information of the time series data in each time series data block, it can be determined whether the target aggregation item of the target object within the target time range can be found from the index information, that is, it can be determined whether the target aggregation value can be found from the index information. Thus, when the target aggregation value is found in the index information, it is possible to avoid obtaining the original time series data for aggregation analysis. Since the index information indicates the position of the time series data blocks corresponding to each object in the time series data file, even if the target aggregate value cannot be directly found from the index information, the data in the time series data block corresponding to the target object can be obtained from the disk through the position of the time series data block corresponding to the target object indicated by the index information in the time series data file, and then the target aggregate value can be found based on the obtained data to ensure the query accuracy. That is, the embodiment of the present invention proposes a time series data file format containing pre-aggregated aggregate values, and provides a scheme for performing aggregate analysis based on files in this format. By including the pre-aggregated aggregate value in the index information of the time series data file, when the desired aggregate value can be found in the index information, it is possible to avoid obtaining the original time series data for aggregate analysis, and on the basis of ensuring the query accuracy, it is possible to improve the query efficiency to a certain extent. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] Figure 1 It is a flow chart of an embodiment of a method for aggregate analysis of time series data of the present invention;

[0045] Figure 2 A schematic diagram of a file format of a time series data file involved in an embodiment of the present invention;

[0046] Figure 3 A schematic diagram of the structure of a time series data block involved in an embodiment of the present invention;

[0047] Figure 4 A schematic diagram of the structure of an index area involved in an embodiment of the present invention;

[0048] Figure 5It is a schematic diagram of the structure of the hardware operating environment involved in the embodiment of the present invention.

[0049] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0050] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.

[0051] Reference Figure 1 , Figure 1 Schematic diagram of the process of the first embodiment of the time series data aggregation analysis method of the present invention.

[0052] The embodiment of the present invention provides an embodiment of the time series data aggregation analysis method. It should be noted that although the logical order is shown in the flowchart, in some cases, the steps shown or described can be performed in a different order than here. In this embodiment, the execution subject of the time series data aggregation analysis method can be a smart phone, a personal computer, a server and other devices, which is not limited in this embodiment. In this embodiment, for the convenience of expression, the execution subject is omitted for explanation. In this embodiment, the time series data aggregation analysis method includes the following steps:

[0053] Step S10, when an aggregate analysis request is received, searching for a target aggregate value in the index information of the time series data file;

[0054] The time series data file includes index information and at least one time series data block, each of which includes time series data of an object within at least one time range. The object may be, but is not limited to, an IoT device. Different devices are different objects. A time series data file may contain at least one object, that is, may include at least one time series data block corresponding to at least one object.

[0055] Time series data includes a time list and a metric value list corresponding to at least one metric (for example, temperature, speed, etc. are different metrics). A time list refers to a sequence consisting of multiple time points within a time range, but a time list does not necessarily directly include each time point, and may be data encoded using a certain encoding method for each time point. Similarly, a metric value list refers to a sequence consisting of metric values ​​corresponding to each time point within a time range (for example, temperature values ​​at different time points), but a metric value list does not necessarily directly include each metric value, and may be data encoded using a certain encoding method for each metric value. In this embodiment, there is no restriction on the encoding method of the time list and the metric value list.

[0056] The index information is used to indicate the object corresponding to each time series data block in the time series data file, as well as the time range and metric aggregation information of the time series data in each time series data block, and the position of each time series data block in the time series data file. In a specific implementation, the time range and metric aggregation information of the time series data in the time series data block may refer to the time range and metric aggregation information of all time series data in the time series data block, or may refer to the time range and metric aggregation information corresponding to different time series data in the time series data block. The time range of the time series data is the time range composed of the maximum time point and the minimum time point in the time series data. The metric aggregation information of the time series data includes the aggregate value of at least one aggregation item corresponding to each metric contained in the time series data. Among them, the aggregation item can be a maximum value, a minimum value, an average value, etc., which is not limited in this embodiment. In a feasible implementation, the aggregation items included in the metric aggregation information can be customized by the user. There are many kinds of information that can be used to indicate the position of a timing data block in a timing data file, which is not limited in this embodiment. For example, the position of a timing data block in a timing data file can be indicated by the offset of the starting address of the timing data block relative to the first address of the timing data file and the size of the timing data block.

[0057] It should be noted that, in this embodiment, the index information includes information for indicating the above-mentioned items of content, but does not limit how the index information specifically indicates the above-mentioned items of information, that is, does not limit the specific content included in the index information for indicating the above-mentioned items of information. For example, in a specific implementation, the index information may include only one level of index information, or may include multiple levels of index information.

[0058] The aggregate analysis request may be triggered by a user, received from another device, or automatically triggered according to a preset trigger condition, which is not limited in this embodiment. The aggregate analysis request may indicate a target object, a target time range, a target metric, and a target aggregate item, that is, the aggregate analysis request expects to analyze and obtain the aggregate value of the target aggregate item of the target metric of the target object within the target time range. For the convenience of expression, the aggregate value is referred to as the target aggregate value below.

[0059] The time series data file can be stored in the disk. When an aggregate analysis request is received, the index information cached in the memory can be searched first to see if the target aggregate value can be found. In a specific implementation, the index information can be loaded from the disk into the memory when an aggregate analysis request is received, or it can be preloaded into the memory before the aggregate analysis request. If the index information has multiple levels, it can also be loaded hierarchically.

[0060] The storage method of the time series data file is not limited in this embodiment. For example, in a feasible implementation, the measurement values ​​of different measurements generated by the object at different time points can be cached in the memory first, and then written to the disk as a time series data block in the time series data file after the data volume reaches a certain amount, and each time series data block is continuous in the disk; the index information is recorded in the memory, and after the number of time series data blocks reaches a certain amount, the index information is written to the disk, thereby completing the storage of the time series data file.

[0061] It can be understood that, since the index information includes information for indicating the objects corresponding to each time series data block in the time series data file, it can be determined whether the time series data of the target object is included in the time series data file according to the index information. In the case of determining that the time series data of the target object is included in the time series data file, since the index information includes the time range of the time series data in each time series data block, it can be determined whether the various aggregate values ​​of the target object in the target time range can be found from the index information by comparing the target time range with the time range indicated in the index information. In the case of determining that the various aggregate values ​​of the target object in the target time range can be found from the index information, since the index information includes the metric aggregation information of the time series data in each time series data block, it can be determined whether the aggregate value of the target aggregate item of the target metric of the target object in the target time range can be found from the index information, that is, it can be determined whether the target aggregate value can be found from the index information.

[0062] In a feasible implementation, when it is determined that the target aggregate value can be found from the index information, the target aggregate value can be output after the target aggregate value is found. The method of outputting the target aggregate value is not limited in this embodiment, for example, outputting it to a user interaction interface, or returning it to the device that sent the aggregate analysis request.

[0063] Step S20: If the target aggregate value is not found in the index information, and it is determined based on the index information that the time series data file contains the metric value of the target metric of the target object within the target time range, then according to the position of the time series data block corresponding to the target object indicated by the index information in the time series data file, obtain the data in the time series data block corresponding to the target object, and search for the target aggregate value based on the obtained data.

[0064] It is understandable that the time range indicated in the index information may be a larger time range, and the target time range may be a smaller time range that falls within the larger time range. At this time, the target aggregate value cannot be directly found from the index information, but it can be determined that the time series data file contains the metric value of the target object in the target time range about the target metric. At this time, the position of the time series data block corresponding to the target object indicated by the index information in the time series data file can be used to obtain the data in the time series data block corresponding to the target object from the disk, and then the target aggregate value can be found based on the obtained data. In a specific implementation, the data obtained from the time series data block corresponding to the target object can be time series data, or it can be data used to indicate the time range and metric aggregation information of part of the time series data in the time series data block.

[0065] Furthermore, in a feasible implementation, the time range indicated in the index information may fall outside the target time range, which means that the time series data file does not contain the measurement value of the target object within the target time range. In this case, it can be determined that the target aggregate value cannot be found in the time series data file.

[0066] It should be noted that there may be multiple time series data files, and the target aggregate value may need to be found from the index information of multiple time series data files. When the target aggregate value cannot be found from the index information of multiple time series data files, and it can be determined that at least one time series data file contains the metric value of the target metric of the target object within the target time range, the target aggregate value is searched by obtaining the data in the time series data block.

[0067] Further, in a feasible implementation, the index information may include data block index information corresponding to each time series data block in the time series data file, and the data block index information includes the time range and metric aggregation information of the time series data in the time series data block corresponding to the data block index information, and includes the position information of the time series data block in the time series data file. The time range of the time series data in the time series data block can be represented by the maximum time point and the minimum time point of each time point of all the time series data in the time series data block. Accordingly, the step S10 includes:

[0068] Step S101, obtaining index information of each target data block corresponding to the target object;

[0069] The data block index information corresponding to the target object is referred to as target data block index information for distinction.

[0070] The target data block index information can be obtained by first obtaining the position information of the target data block index information in the time series data file, and then obtaining the target data block index information from the disk according to the position information. The method for obtaining the position information of the target data block index information is not limited in this embodiment. For example, in a feasible implementation, the information can be obtained from the file tail area information of the time series data file, and the tail area information is in the tail area of ​​the time series data file.

[0071] Step S102: for each target data block index information, if the time range included in the target data block index information falls within the target time range or is completely consistent with the target time range, then find out the aggregation value of the target aggregation item of the target metric from the metric aggregation information included in the target data block index information, and use the found aggregation value as a candidate aggregation value to determine the target aggregation value according to all the candidate aggregation values ​​found;

[0072] Since there may be multiple time series data blocks corresponding to the target object, there may also be multiple target data block index information. For each target data block index information, the time range included in the target data block index information may be compared with the target time range.

[0073] If the time range in the target data block index information falls within the target time range, for example, the time range in the target data block index information is 100-200, and the target time range is 0-300, then it means that the target aggregation value to be found may come from the target data block index information. At this time, the aggregation value of the target aggregation item of the target metric can be found from the metric aggregation information included in the target data block index information. For example, if the target metric is temperature and the aggregation item is the maximum value, then the maximum temperature value is found from the target data block index information. The maximum temperature value found is the maximum temperature value of the target object within the time range of 100-200. The found aggregation value, such as the maximum temperature value, is used as a candidate aggregation value. ; Since the time range in the target data block index information falls within the target time range, the candidate aggregation value is not necessarily the target aggregation value. For example, there may be a larger temperature value in the time range of 0-100 or 200-300; and multiple candidate aggregation values ​​may be generated during the search process, which may include the maximum temperature value in the time range of 0-100 or 200-300, for example, it may be generated when searching for other target data block index information, or it may be generated when searching for time series data blocks, or it may be generated when searching for other time series data files. Finally, the target aggregation value can be determined based on each candidate aggregation value, for example, the maximum temperature value is determined from each temperature value as the target aggregation value. It can be understood that if the time range in the target data block index information is exactly the same as the target time range, then there is only one candidate aggregation value generated during the search process, that is, the candidate aggregation value generated when searching for the target data block index information. Finally, the candidate aggregation value is the target aggregation value found.

[0074] Step S103, if the time range included in the target data block index information is outside the target time range, it is determined that the target aggregate value is not found in the target data block index information, and it is determined that the time series data block corresponding to the target data block index information does not contain the metric value of the target metric of the target object within the target time range;

[0075] If the time range included in the target data block index information is outside the target time range, for example, the time range in the target data block index information is 400-500, and the target time range is 0-300, then it means that the target aggregation value to be found cannot come from the target data block index information. At this time, it can be determined that the target aggregation value is not found in the target data block index information, and it can also be determined that the time series data block corresponding to the target data block index information does not contain the measurement value of the target measurement of the target object within the target time range.

[0076] It is understandable that if the target aggregate value is not found in the index information of each target data block, it can be explained that the target aggregate value is not found in the index information of the time series data file. If the time series data blocks corresponding to the index information of each target data block do not contain the measurement value of the target metric of the target object within the target time range, it can be explained that the time series data file does not contain the measurement value of the target metric of the target object within the target time range.

[0077] Step S104, if the time range included in the target data block index information overlaps with the target time range, it is determined that the target aggregation value is not found in the target data block index information, and it is determined that the time series data block corresponding to the target data block index information contains the measurement value of the target measurement of the target object within the target time range.

[0078] If the time range included in the target data block index information overlaps with the target time range, for example, the time range in the target data block index information is 200-400, and the target time range is 0-300, then it means that it is impossible to determine whether the aggregate value of the target aggregate item of the target metric of the target object contained in the target data block index information is the target aggregate value. At this time, it can be determined that the target aggregate value is not found in the target data block index information, but it can be determined that the time series data block corresponding to the target data block index information contains the metric value of the target metric of the target object within the target time range. It can be understood that when any time series data block corresponding to the target data block index information contains the metric value of the target metric of the target object within the target time range, it can be explained that the time series data file contains the metric value of the target metric of the target object within the target time range.

[0079] In this case, the data in the target time series data block corresponding to the target object can be obtained according to the position information of the time series data block in the time series data file included in the target data block index information, and the target aggregation value can be determined according to the obtained data.

[0080] In this embodiment, when receiving an aggregation analysis request, the target aggregation value is searched in the index information of the time series data file. Since the index information includes information indicating the object corresponding to each time series data block in the time series data file, it can be determined whether the time series data file includes the time series data of the target object. When it is determined that the time series data file includes the time series data of the target object, since the index information includes the time range of the time series data in each time series data block, it can be determined whether the various aggregation values ​​of the target object within the target time range can be found from the index information. When it is determined that the various aggregation values ​​of the target object within the target time range can be found from the index information, since the index information includes the metric aggregation information of the time series data in each time series data block, it can be determined whether the target aggregation item of the target object within the target time range can be found from the index information, that is, it can be determined whether the target aggregation value can be found from the index information. Thus, when the target aggregation value is found in the index information, it is possible to avoid obtaining the original time series data for aggregation analysis. Since the index information indicates the position of the time series data block corresponding to each object in the time series data file, even if the target aggregate value cannot be directly found from the index information, the data in the time series data block corresponding to the target object can be obtained from the disk through the position of the time series data block corresponding to the target object indicated by the index information in the time series data file, and then the target aggregate value can be found according to the obtained data to ensure the query accuracy. That is, the embodiment of the present invention proposes a time series data file format containing pre-aggregated aggregate values, and provides a scheme for performing aggregate analysis according to the file in this format. By including the pre-aggregated aggregate value in the index information of the time series data file, when the aggregate value to be found can be found in the index information, it is possible to avoid obtaining the original time series data for aggregate analysis, and on the basis of ensuring the query accuracy, the query efficiency can be improved to a certain extent. And. Since the index information includes the metric aggregation information for indicating the time series data in the time series data block corresponding to each object, it can include the information of the aggregate values ​​of different devices, different metrics, and different aggregate items, and can support the rapid aggregate analysis of the aggregate values ​​of various devices, various metrics, and respective aggregate items.

[0081] Further, based on the above-mentioned first embodiment, a second embodiment of the time series data aggregation analysis method of the present invention is proposed. In this embodiment, the index information may also include object index information corresponding to each object contained in the time series data file, and the object index information includes the position information of each data block index information corresponding to the same object in the time series data file, and includes the time range and measurement aggregation information of the time series data in all time series data blocks corresponding to the same object. Among them, the time range of the time series data in all time series data blocks corresponding to the same object can be represented by the maximum time point and the minimum time point of each time point of all time series data in all time series data blocks corresponding to the object. Accordingly, before the step S101, it includes:

[0082] Step A10, obtaining target object index information corresponding to the target object;

[0083] The object index information corresponding to the target object is referred to as the target object index information for distinction. The target object index information can be obtained by first obtaining the position information of the target object index information in the time series data file, and then obtaining the target object index information from the disk according to the position information. The method for obtaining the position information of the target object index information is not limited in this embodiment. For example, in a feasible implementation, it can be obtained in the file tail area information of the time series data file, and the file tail area information is in the tail area of ​​the time series data file.

[0084] Before obtaining the target data block index information, you can first obtain the target object index information. If the target aggregation value can be found in the target object index information, there is no need to obtain the target data block index information. Since the amount of data in the target object index information is smaller than the amount of data in the target data block index information, the efficiency of the aggregation analysis can be improved to a certain extent.

[0085] Step A20: if the time range included in the target object index information falls within the target time range or is completely consistent with the target time range, then find out the aggregation value of the target aggregation item of the target metric from the metric aggregation information included in the target object index information, and use the found aggregation value as a candidate aggregation value to determine the target aggregation value based on all the candidate aggregation values ​​found;

[0086] If the time range in the target object index information falls within the target time range, for example, the target time range is 0-300, and the time range in the target object index information is 100-200, then it means that the target aggregate value to be found may come from the target object index information. At this time, the aggregate value of the target aggregate item of the target metric can be found from the metric aggregation information included in the target object index information. For example, if the target metric is temperature and the aggregation item is the maximum value, then the maximum temperature value is found from the target object index information. The maximum temperature value found is the target object in the range of 100-200. The maximum temperature value within the time range; the found aggregation value, such as the maximum temperature value, is used as a candidate aggregation value; since the time range in the target object index information falls within the target time range, the candidate aggregation value is not necessarily the target aggregation value, for example, there may be a larger temperature value in the time range of 0-100 or 200-300; candidate aggregation values ​​may also be generated when searching for other time series data files, for example, the maximum temperature value in the time range of 0-100 or 200-300, and the target aggregation value can be determined based on each candidate aggregation value. It can be understood that if the time range in the target object index information is exactly the same as the target time range, then there is only one candidate aggregation value generated during the search process, that is, the candidate aggregation value generated when searching the target object index information, and finally, the candidate aggregation value is the target aggregation value found.

[0087] Step A30: if the time range included in the target object index information falls outside the target time range, determining that the target aggregate value cannot be found in the time series data file;

[0088] If the time range included in the target object index information is outside the target time range, for example, the time range in the target object index information is 400-500 and the target time range is 0-300, then it means that the target aggregation value to be found cannot come from the target object index information. At this time, it can be determined that the target aggregation value cannot be found in the time series data file.

[0089] Step A40: If the time range included in the target object index information overlaps with the target time range, then execute step S101 according to the position information of each data block index information corresponding to the target object included in the target object index information in the time series data file.

[0090] If the time range included in the target object index information overlaps with the target time range, for example, the time range in the target object index information is 200-400, and the target time range is 0-300, it means that it is impossible to determine whether the aggregate value of the target aggregate item of the target metric of the target object contained in the target object index information is the target aggregate value. At this time, it can be determined that the target aggregate value is not found in the target object index information, but it can be determined that the time series data block corresponding to the target object contains the metric value of the target metric of the target object within the target time range. Therefore, according to the position information of the index information of each data block corresponding to the target object included in the target object index information in the time series data file, the index information of each target data block corresponding to the target object can be obtained in the disk, and then searched in the target data block index information.

[0091] Furthermore, in a feasible implementation manner, the index information further includes file index information corresponding to the time series data file, the file index information including serial numbers of all objects included in the time series data file, and position information of the object index information corresponding to all objects in the time series data file;

[0092] Before step A10, the method further includes:

[0093] Step B10, obtaining the file index information;

[0094] The file index information can be obtained by first obtaining the position information of the file index information in the time series data file, and then obtaining the file index information from the disk according to the position information. The method for obtaining the position information of the file index information is not limited in this embodiment. For example, in a feasible implementation, the file index information can be obtained from the file tail area information of the time series data file, and the file tail area information is in the tail area of ​​the time series data file.

[0095] Before obtaining the target object index information, the file index information may be obtained first. If it can be determined that the target aggregation value cannot be found in the time series data file based on the file index information, there is no need to obtain the target object index information in vain, thereby further improving the efficiency of obtaining the aggregation analysis results.

[0096] Step B20: if the file index information does not include the serial number of the target object, determining that the target aggregate value cannot be found in the time series data file;

[0097] The file index information may be searched to see whether the target object number is included. If not, it indicates that the target aggregate value cannot be found in the time series data file. Further, in a feasible implementation, a result indicating that the target aggregate value cannot be found in the time series data file may be output.

[0098] Step B30: If the file index information includes the serial number of the target object, then execute step A10 according to the position information of the target object index information included in the file index information in the time series data file.

[0099] If the file index information includes the serial number of the target object, the target object index information can be obtained according to the position information of the target object index information included in the file index information in the time series data file, and then searched in the target data block index information.

[0100] Furthermore, in a feasible implementation, the index information also includes a Bloom filter constructed according to each object contained in the time series data file. The method for constructing the Bloom filter is not described in detail herein. The Bloom filter constructed according to each object can be used to indicate whether each object is contained in the time series data file, that is, whether the time series data of each object is contained. According to the characteristics of the Bloom filter, when the Bloom filter indicates that a certain object is not contained in the time series data file, it can be confirmed that the object must not be contained in the time series data file. Therefore, when the Bloom filter indicates that the target object is not contained in the time series data file, it can be quickly determined that the target aggregation value cannot be found in the time series data file, so that there is no need to load the search file index information in vain, thereby further improving the efficiency of obtaining the aggregation analysis results.

[0101] The time series data file also includes file tail area information, which has a fixed length and is stored at the end of the time series data file, so that the location of the file tail area information in the disk can be quickly located. The file tail area information includes the location information of the Bloom filter in the time series data file and the location information of the file index information in the time series data file.

[0102] Before step B10, the method further includes:

[0103] Step C10, obtaining the file tail area information, and obtaining the Bloom filter according to the position information of the Bloom filter in the time series data file included in the file tail area information;

[0104] Step C20: if the Bloom filter indicates that the time series data file does not contain the target object, determining that the target aggregate value cannot be found in the time series data file;

[0105] Step C30: If the Bloom filter indicates that the time series data file contains the target object, then execute step B10 according to the position information of the file index information included in the file tail area information in the time series data file.

[0106] Furthermore, in a feasible implementation manner, before step C10, the following steps are further included:

[0107] Step D10, searching the Bloom filter and the file index information in the memory;

[0108] Since the space occupied by Bloom filter and file index information is very small, Bloom filter and file index information can be cached in memory in advance, that is, they are not necessarily loaded from disk to memory after receiving the aggregation analysis request. In a specific implementation, the user can customize whether to preload Bloom filter and file index information in memory.

[0109] Then, when receiving the aggregate analysis request, the Bloom filter and file index information can be searched in the memory first. If the Bloom filter is found in the memory, it can be determined whether the time series data file contains the target object according to the Bloom filter. If the Bloom filter indicates that the time series data file includes the target object, and the file index information is found in the memory, it can be found whether the file index information contains the target object number.

[0110] Step D20: If the Bloom filter and the file index information are not found, execute step C10.

[0111] If the Bloom filter and file index information are not found in the memory, the file tail area information can be obtained.

[0112] Furthermore, based on the above-mentioned first and / or second embodiments, a third embodiment of the time series data aggregation analysis method of the present invention is proposed. In this embodiment, each time series data block includes at least one time series data page and a page header corresponding to each time series data page. The time series data page may include the time series data of an object within a time range. The page header may include the time range and metric aggregation information of the time series data in the corresponding time series data page, and the page header may also include the location information of the corresponding time series data page in the time series data file.

[0113] In step S30, according to the position of the time series data block corresponding to the target object indicated by the index information in the time series data file, the step of acquiring the data in the time series data block corresponding to the target object, and searching for the target aggregate value according to the acquired data includes:

[0114] Step S301, acquiring each target page header in the time series data block corresponding to the target object according to the position of the time series data block corresponding to the target object indicated by the index information in the time series data file;

[0115] The page header in the timing data block corresponding to the target object is called the target page header for distinction. In a specific implementation, the index information may directly include the position information of each page header in the timing data block corresponding to the target object in the timing data file, or the index information may include the offset of the starting address of the timing data block corresponding to the target object relative to the starting address of the timing data file, find the data block header in the timing data block according to the offset, and obtain each target page header according to the position of each page header indicated in the data block header in the timing data file.

[0116] Step S302: for each of the target page headers, if the time range included in the target page header falls within the target time range or is completely consistent with the target time range, then find out the aggregation value of the target aggregation item of the target metric from the metric aggregation information included in the target page header, and use the found aggregation value as a candidate aggregation value, so as to determine the target aggregation value according to all the candidate aggregation values ​​found;

[0117] For each target page header, the time range included in the target page header may be compared with the target time range.

[0118] If the time range in the target page header falls within the target time range, for example, the time range in the target page header is 100-200 and the target time range is 0-300, then it means that the target aggregate value to be found may come from the target page header. At this time, the aggregate value of the target aggregate item of the target metric can be found from the metric aggregation information included in the target page header. For example, if the target metric is temperature and the aggregation item is the maximum value, then the maximum temperature value is found from the target page header. The maximum temperature value found is the maximum temperature value of the target object within the time range of 100-200. The found aggregate value, such as the maximum temperature value, is used as a candidate aggregate value. Since the target page header The time range in falls within the target time range, so the candidate aggregation value is not necessarily the target aggregation value. For example, there may be a larger temperature value in the time range of 0-100 or 200-300. Multiple candidate aggregation values ​​may be generated during the search process, which may include the maximum temperature value in the time range of 0-100 or 200-300, for example, it may be generated when searching for other target page headers, or it may be generated when searching for other target data block index information, or it may be generated when searching for time series data blocks, or it may be generated when searching for other time series data files. Finally, the target aggregation value can be determined based on each candidate aggregation value. It can be understood that if the time range in the target page header is exactly the same as the target time range, then there is only one candidate aggregation value generated during the search process, that is, the candidate aggregation value generated when searching for the target page header. Finally, the candidate aggregation value is the target aggregation value found.

[0119] Step S303: if the time range included in the target page header is outside the target time range, determining that the time series data page corresponding to the target page header does not include the metric value of the target metric of the target object within the target time range;

[0120] If the time range included in the target page header is outside the target time range, for example, the time range in the target page header is 400-500 and the target time range is 0-300, then it means that the target aggregate value to be found cannot come from the target page header. At this time, it can be determined that the time series data page corresponding to the target page header does not contain the metric value of the target metric of the target object within the target time range.

[0121] Step S304: if the time range included in the target page header overlaps with the target time range, then the time series data page corresponding to the target page header is obtained according to the position information included in the target page header, and the aggregation value of the target aggregation item of the target metric of the target object within the overlapping time range is obtained according to the metric value sequence corresponding to the target metric in the time series data page, and the aggregation value obtained by statistics is used as a candidate aggregation value to determine the target aggregation value according to all the candidate aggregation values ​​found, wherein the overlapping time range is the overlapping part of the time range included in the target page header and the target time range.

[0122] If the time range included in the target page header overlaps with the target time range, for example, the time range in the target page header is 200-400 and the target time range is 0-300, it means that it is impossible to determine whether the aggregate value of the target aggregation item of the target metric of the target object contained in the target page header is the target aggregation value. In this case, the time series data page corresponding to the target page header can be obtained according to the position information of the time series data page corresponding to the target page header included in the target page header in the time series data file, and the aggregate value of the target aggregation item of the target metric of the target object in the overlapping time range can be obtained according to the metric value sequence corresponding to the target metric in the time series data page. The overlapping time range is the time range included in the target page header and the target time range. Overlapping part, for example, statistically obtain the aggregate value of the target aggregate item of the target metric of the target object within the time range of 200-300; use the statistically obtained aggregate value as a candidate aggregate value; and multiple candidate aggregate values ​​may be generated during the search process, which may include the aggregate value of the target aggregate item of the target metric within the time range of 0-100, for example, it may be generated when searching for other target page headers, or it may be generated when searching for other time series data pages, or it may be generated when searching for time series data blocks, or it may be generated when searching for other time series data files. Finally, the target aggregate value can be determined according to each candidate aggregate value, for example, the maximum temperature value is determined from each temperature value as the target aggregate value.

[0123] In one feasible implementation, if the target aggregation item is the maximum value, then when the time range included in the target page header overlaps with the target time range, and the maximum value of the target metric included in the target page header is less than or equal to the maximum value of all currently found candidate aggregation values, it means that the maximum value of the target metric included in the target page header is definitely not the target aggregation value. At this time, it can be determined that the target aggregation value cannot be found in the time series data page corresponding to the target page header, that is, the time series data page corresponding to the target page header is no longer loaded. It is understandable that when the target aggregation item is the minimum value, a similar method can be used for searching.

[0124] In this embodiment, since the time series data in each time series data block is divided into multiple time series data pages for storage, and the time range and metric aggregation information of the time series data in the time series data page are recorded in the page header of the time series data page, it is possible to avoid loading the time series data as much as possible when the target aggregation value is not found in the index information, and the size of the time series data to be loaded can be further reduced, thereby further improving the efficiency of aggregation analysis.

[0125] In one feasible implementation, the file format of the time series data file can be as follows: Figure 2 As shown below.

[0126] Table 1 describes the various parts of the file format.

[0127]

[0128] Table 1

[0129] The header area can be composed of a 6-byte "Magic String" (TsFile) and a 3-byte version number. For example, the version V1.2.3 has 3 version values, each of which is represented by Byte.

[0130] like Figure 3 A feasible structure diagram of the time series data block is shown in Table 2. Figure 3 The data block header (ChunkHeader) of the time series data block is described as follows:

[0131]

[0132]

[0133] Table 2

[0134] As shown in the following table 3 Figure 3 The PageHead of the time series data block is explained as follows:

[0135]

[0136] Table 3

[0137] As shown in the following table 4 Figure 3 The PageData of the time series data block is described as follows:

[0138] member type explain TimeStamps Bytes Stores timestamp list encoded values FieldValues List <bytes> < / bytes> Stores each FieldValue (measurement value) encoding value

[0139] Table 4

[0140] PageData stores a time list and a list of measurement values ​​for an ID over a period of time, such as

[0141] List <timestamp>=[10,20,30...100]

[0142] Field1Value=[116.389550,116.389550,116.389550…116.389550]

[0143] Field2Value=[39.928167,39.928167,39.928167…39.928167]

[0144] Usually, for the same ID, the time points and metric values ​​within a period of time have the characteristic that the adjacent values ​​do not change much. For example, the time can be encoded every 10 seconds using the RLE cursor algorithm, such as (startTime, delta, num), and the data example is (10, 10, 9). For metric values, they can be encoded using the XOR-based Gorilla to save storage space and improve read and write performance due to IO savings.

[0145] List <statistics>Record the statistical values ​​of a certain ID metric list and time list, such as the maximum and minimum values ​​of the time list (that is, the time range), the average, maximum, minimum, etc. of the metric (that is, metric aggregation information).

[0146] Table 5 below explains the structure of Statistics.

[0147]

[0148] Table 5

[0149] like Figure 4 A feasible structure diagram of the index area is shown in Table 6 below. Figure 4 The various parts of the index area are described in the .

[0150]

[0151]

[0152] Table 6 is as follows Table 7 Figure 4 The ChunkIndex in is explained.

[0153]

[0154] Table 7 is as follows Table 8 Figure 4 TimeseriesIndex in .

[0155]

[0156]

[0157] Table 8

[0158] As shown in the following table 9 Figure 4 See IndexOfTimeSeriesIndex in .

[0159]

[0160] Table 9

[0161] The tail area is described in Table 10 below.

[0162]

[0163] Table 10

[0164] To illustrate how pre-aggregated time series data files can help improve the efficiency of aggregate analysis queries, the following SQL is used as an example:

[0165] Select Max(tempture)where ID=1And timestamp>1And timestamp<10 for example, which means obtaining the maximum temperature value of device 1 within the time range 1 to 10.

[0166] Before querying, a set of candidate time series data files can be obtained based on the time range and ID set. The next step is to find the maximum temperature within the query range for this set of time series data files. The main steps are:

[0167] 1. Exclude time series data files that absolutely do not contain ID=1 according to the Bloom filter.

[0168] 2. Deserialize IndexOfTimeSeriesIndex, perform a binary search for the TimeSeriesIndex position with ID = 1, and deserialize the TimeSeriesIndex.

[0169] 3. Get the minimum and maximum time values ​​in the statistics according to TimeSeriesIndex, which can be divided into three cases:

[0170] i: If the time interval formed by the minimum time value and the maximum time value is within the query range or is completely consistent with the query range, the maximum temperature is returned.

[0171] ii: If the time interval formed by the minimum time value and the time range is outside the query range, it will be skipped.

[0172] iii: The time interval formed by the minimum time value and the maximum time value overlaps with the query range. Find the corresponding ChunkIndex, and then filter the time interval in the statistical information in ChunkIndex. There are still three time interval situations. For the third situation, the statistical information in pageHeader is used. Finally, for the minimum unit pageData that still has time overlap, if the maximum value generated here is smaller than the maximum value that has been generated, skip it. Otherwise, load the original data of the pageData in these overlapping areas and calculate the maximum value in the query range.

[0173] From the query process, we can see that when doing aggregation analysis, because there are pre-aggregation values ​​in the time series model, the statistical values ​​can be used directly in whole or in part, avoiding the reading and statistics of data blocks during query.

[0174] In addition, an embodiment of the present invention further provides a time series data aggregation analysis device, the device comprising:

[0175] A first search module is used to search for a target aggregate value in the index information of the time series data file when an aggregate analysis request is received;

[0176] Wherein, the time series data file includes the index information and at least one time series data block, each of the time series data blocks includes time series data of an object within at least one time range, the time series data includes a time list and a metric value list corresponding to at least one metric, the index information is used to indicate the object corresponding to each of the time series data blocks in the time series data file, as well as the time range and metric aggregation information of the time series data in each of the time series data blocks, and the position of each of the time series data blocks in the time series data file, the metric aggregation information includes the aggregation value of at least one aggregation item corresponding to each of the metrics; the target aggregation value is the aggregation value of the target aggregation item of the target object with respect to the target metric within the target time range, and the target object, the target time range, the target metric and the target aggregation item are indicated by the aggregation analysis request;

[0177] A second search module is used for obtaining data in the time series data block corresponding to the target object according to the position of the time series data block corresponding to the target object indicated by the index information in the time series data file, and searching for the target aggregate value based on the acquired data, if the target aggregate value is not found in the index information of the time series data file, and it is determined based on the index information that the time series data file contains the metric value of the target metric of the target object within the target time range.

[0178] Further, the index information includes data block index information corresponding to each of the time series data blocks in the time series data file, and the data block index information includes the time range and metric aggregation information of the time series data in the time series data block and the position information of the time series data block in the time series data file;

[0179] The first search module is also used for:

[0180] Obtaining index information of each target data block corresponding to the target object;

[0181] For each target data block index information, if the time range included in the target data block index information falls within the target time range or is completely consistent with the target time range, then find out the aggregation value of the target aggregation item of the target metric from the metric aggregation information included in the target data block index information, and use the found aggregation value as a candidate aggregation value to determine the target aggregation value according to all the candidate aggregation values ​​found;

[0182] If the time range included in the target data block index information is outside the target time range, it is determined that the target aggregate value is not found in the target data block index information, and it is determined that the time series data block corresponding to the target data block index information does not contain the metric value of the target metric of the target object within the target time range;

[0183] If the time range included in the target data block index information overlaps with the target time range, it is determined that the target aggregate value is not found in the target data block index information, and it is determined that the time series data block corresponding to the target data block index information contains the metric value of the target metric of the target object within the target time range.

[0184] Furthermore, the index information also includes object index information corresponding to each object contained in the time series data file, the object index information includes position information of each data block index information corresponding to the same object in the time series data file, and time range and metric aggregation information of the time series data in all the time series data blocks corresponding to the same object;

[0185] The first search module is also used for:

[0186] Obtaining target object index information corresponding to the target object;

[0187] If the time range included in the target object index information falls within the target time range or is completely consistent with the target time range, then find out the aggregation value of the target aggregation item of the target metric from the metric aggregation information included in the target object index information, and use the found aggregation value as a candidate aggregation value to determine the target aggregation value based on all the candidate aggregation values ​​found;

[0188] If the time range included in the target object index information falls outside the target time range, determining that the target aggregate value cannot be found in the time series data file;

[0189] If the time range included in the target object index information overlaps with the target time range, the operation of obtaining the target data block index information corresponding to the target object is performed based on the position information of the data block index information corresponding to the target object included in the target object index information in the timing data file.

[0190] Furthermore, the index information further includes file index information corresponding to the time series data file, the file index information including serial numbers of all objects included in the time series data file, and position information of the object index information corresponding to all objects in the time series data file;

[0191] The first search module is also used for:

[0192] Obtaining the file index information;

[0193] If the file index information does not include the serial number of the target object, it is determined that the target aggregate value cannot be found in the time series data file;

[0194] If the file index information includes the serial number of the target object, the operation of obtaining the target object index information corresponding to the target object is performed according to the position information of the target object index information included in the file index information in the time series data file.

[0195] Furthermore, the index information further includes a Bloom filter constructed according to each object included in the time series data file, and the time series data file further includes file tail area information;

[0196] The first search module is also used for:

[0197] Acquire the file tail area information, and acquire the Bloom filter according to the position information of the Bloom filter in the time series data file included in the file tail area information;

[0198] If the Bloom filter indicates that the time series data file does not contain the target object, determining that the target aggregate value cannot be found in the time series data file;

[0199] If the Bloom filter indicates that the target object is included in the time series data file, the operation of obtaining the file index information is performed according to the position information of the file index information included in the file tail area information in the time series data file.

[0200] Furthermore, the first search module is also used for:

[0201] Searching for the Bloom filter and the file index information in memory;

[0202] If the Bloom filter and the file index information are not found, the operation of obtaining the file tail area information is performed.

[0203] Further, each of the time series data blocks includes at least one time series data page and a page header corresponding to each of the time series data pages, the time series data page includes time series data of an object within a time range, the page header includes the time range and metric aggregation information of the time series data in the corresponding time series data page, and the page header also includes the position information of the corresponding time series data page in the time series data file;

[0204] The second search module is also used for:

[0205] Acquire each target page header in the time series data block corresponding to the target object according to the position of the time series data block corresponding to the target object indicated by the index information in the time series data file;

[0206] For each of the target page headers, if the time range included in the target page header falls within the target time range or is completely consistent with the target time range, then find out the aggregation value of the target aggregation item of the target metric from the metric aggregation information included in the target page header, and use the found aggregation value as a candidate aggregation value, so as to determine the target aggregation value according to all the candidate aggregation values ​​found;

[0207] If the time range included in the target page header is outside the target time range, determining that the time series data page corresponding to the target page header does not include the metric value of the target metric of the target object within the target time range;

[0208] If the time range included in the target page header overlaps with the target time range, the time series data page corresponding to the target page header is obtained according to the location information included in the target page header, and the aggregation value of the target aggregation item of the target metric of the target object within the overlapping time range is obtained according to the metric value sequence corresponding to the target metric in the time series data page, and the statistically obtained aggregation value is used as a candidate aggregation value to determine the target aggregation value based on all the candidate aggregation values ​​found, wherein the overlapping time range is the overlapping part of the time range included in the target page header and the target time range.

[0209] In addition, the embodiment of the present invention also provides a time series data aggregation analysis device, such as Figure 5 As shown, Figure 5 It is a schematic diagram of the device structure of the hardware operating environment involved in the embodiment of the present invention. It should be noted that the time series data aggregation and analysis device in the embodiment of the present invention can be a smart phone, a personal computer, a server and other devices, and no specific limitation is made here.

[0210] like Figure 5 As shown, the time series data aggregation and analysis device may include: a processor 1001, such as a CPU, a network interface 1004, a user interface 1003, a memory 1005, and a communication bus 1002. Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), an input unit such as a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 1005 may be a high-speed RAM memory, or a stable memory (non-volatile memory), such as a disk memory. The memory 1005 may also be a storage device independent of the aforementioned processor 1001.

[0211] Those skilled in the art will understand that Figure 5 The device structure shown in the figure does not constitute a limitation on the time series data aggregation and analysis device, and may include more or fewer components than shown in the figure, or a combination of certain components, or a different arrangement of components.

[0212] like Figure 5 As shown, the memory 1005 as a computer storage medium may include an operating system, a network communication module, a user interface module, and a time series data aggregation analysis program. The operating system is a program that manages and controls the hardware and software resources of the device and supports the operation of the time series data aggregation analysis program and other software or programs. Figure 5 In the device shown, the user interface 1003 is mainly used to communicate data with the client; the network interface 1004 is mainly used to establish a communication connection with the server; and the processor 1001 can be used to call the time series data aggregation analysis program stored in the memory 1005 and perform the following operations:

[0213] When an aggregation analysis request is received, a target aggregation value is searched in the index information of the time series data file;

[0214] Wherein, the time series data file includes the index information and at least one time series data block, each of the time series data blocks includes time series data of an object within at least one time range, the time series data includes a time list and a metric value list corresponding to at least one metric, the index information is used to indicate the object corresponding to each of the time series data blocks in the time series data file, as well as the time range and metric aggregation information of the time series data in each of the time series data blocks, and the position of each of the time series data blocks in the time series data file, the metric aggregation information includes the aggregation value of at least one aggregation item corresponding to each of the metrics; the target aggregation value is the aggregation value of the target aggregation item of the target object with respect to the target metric within the target time range, and the target object, the target time range, the target metric and the target aggregation item are indicated by the aggregation analysis request;

[0215] If the target aggregate value is not found in the index information of the time series data file, and it is determined based on the index information that the time series data file contains the metric value of the target metric of the target object within the target time range, then according to the position of the time series data block corresponding to the target object indicated by the index information in the time series data file, the data in the time series data block corresponding to the target object is obtained, and the target aggregate value is searched for based on the obtained data.

[0216] Further, the index information includes data block index information corresponding to each of the time series data blocks in the time series data file, and the data block index information includes the time range and metric aggregation information of the time series data in the time series data block and the position information of the time series data block in the time series data file;

[0217] The operation of searching the target aggregate value in the index information of the time series data file includes:

[0218] Obtaining index information of each target data block corresponding to the target object;

[0219] For each target data block index information, if the time range included in the target data block index information falls within the target time range or is completely consistent with the target time range, then find out the aggregation value of the target aggregation item of the target metric from the metric aggregation information included in the target data block index information, and use the found aggregation value as a candidate aggregation value to determine the target aggregation value according to all the candidate aggregation values ​​found;

[0220] If the time range included in the target data block index information is outside the target time range, it is determined that the target aggregate value is not found in the target data block index information, and it is determined that the time series data block corresponding to the target data block index information does not contain the metric value of the target metric of the target object within the target time range;

[0221] If the time range included in the target data block index information overlaps with the target time range, it is determined that the target aggregate value is not found in the target data block index information, and it is determined that the time series data block corresponding to the target data block index information contains the metric value of the target metric of the target object within the target time range.

[0222] Furthermore, the index information also includes object index information corresponding to each object contained in the time series data file, the object index information includes position information of each data block index information corresponding to the same object in the time series data file, and time range and metric aggregation information of the time series data in all the time series data blocks corresponding to the same object;

[0223] Before the operation of obtaining the index information of each target data block corresponding to the target object, the processor 1001 may also be used to call the time series data aggregation analysis program stored in the memory 1005 to perform the following operations:

[0224] Obtaining target object index information corresponding to the target object;

[0225] If the time range included in the target object index information falls within the target time range or is completely consistent with the target time range, then find out the aggregation value of the target aggregation item of the target metric from the metric aggregation information included in the target object index information, and use the found aggregation value as a candidate aggregation value to determine the target aggregation value based on all the candidate aggregation values ​​found;

[0226] If the time range included in the target object index information falls outside the target time range, determining that the target aggregate value cannot be found in the time series data file;

[0227] If the time range included in the target object index information overlaps with the target time range, the operation of obtaining the target data block index information corresponding to the target object is performed based on the position information of the data block index information corresponding to the target object included in the target object index information in the timing data file.

[0228] Furthermore, the index information further includes file index information corresponding to the time series data file, the file index information including serial numbers of all objects included in the time series data file, and position information of the object index information corresponding to all objects in the time series data file;

[0229] Before the operation of obtaining the target object index information corresponding to the target object, the processor 1001 may also be used to call the time series data aggregation analysis program stored in the memory 1005 to perform the following operations:

[0230] Obtaining the file index information;

[0231] If the file index information does not include the serial number of the target object, it is determined that the target aggregate value cannot be found in the time series data file;

[0232] If the file index information includes the serial number of the target object, the operation of obtaining the target object index information corresponding to the target object is performed according to the position information of the target object index information included in the file index information in the time series data file.

[0233] Furthermore, the index information further includes a Bloom filter constructed according to each object included in the time series data file, and the time series data file further includes file tail area information;

[0234] Before the operation of obtaining the file index information, the processor 1001 may also be used to call the time series data aggregation analysis program stored in the memory 1005 to perform the following operations:

[0235] Acquire the file tail area information, and acquire the Bloom filter according to the position information of the Bloom filter in the time series data file included in the file tail area information;

[0236] If the Bloom filter indicates that the time series data file does not contain the target object, determining that the target aggregate value cannot be found in the time series data file;

[0237] If the Bloom filter indicates that the target object is included in the time series data file, the operation of obtaining the file index information is performed according to the position information of the file index information included in the file tail area information in the time series data file.

[0238] Furthermore, before the operation of obtaining the file tail area information, the processor 1001 may also be used to call the time series data aggregation analysis program stored in the memory 1005 to perform the following operations:

[0239] Searching for the Bloom filter and the file index information in memory;

[0240] If the Bloom filter and the file index information are not found, the operation of obtaining the file tail area information is performed.

[0241] Further, each of the time series data blocks includes at least one time series data page and a page header corresponding to each of the time series data pages, the time series data page includes time series data of an object within a time range, the page header includes the time range and metric aggregation information of the time series data in the corresponding time series data page, and the page header also includes the position information of the corresponding time series data page in the time series data file;

[0242] The operations of acquiring data in the time series data block corresponding to the target object according to the position of the time series data block corresponding to the target object indicated by the index information in the time series data file, and searching for the target aggregate value according to the acquired data include:

[0243] Acquire each target page header in the time series data block corresponding to the target object according to the position of the time series data block corresponding to the target object indicated by the index information in the time series data file;

[0244] For each of the target page headers, if the time range included in the target page header falls within the target time range or is completely consistent with the target time range, then find out the aggregation value of the target aggregation item of the target metric from the metric aggregation information included in the target page header, and use the found aggregation value as a candidate aggregation value, so as to determine the target aggregation value according to all the candidate aggregation values ​​found;

[0245] If the time range included in the target page header is outside the target time range, determining that the time series data page corresponding to the target page header does not include the metric value of the target metric of the target object within the target time range;

[0246] If the time range included in the target page header overlaps with the target time range, the time series data page corresponding to the target page header is obtained according to the location information included in the target page header, and the aggregation value of the target aggregation item of the target metric of the target object within the overlapping time range is obtained according to the metric value sequence corresponding to the target metric in the time series data page, and the statistically obtained aggregation value is used as a candidate aggregation value to determine the target aggregation value based on all the candidate aggregation values ​​found, wherein the overlapping time range is the overlapping part of the time range included in the target page header and the target time range.

[0247] In addition, an embodiment of the present invention further proposes a computer-readable storage medium, on which a time series data aggregation analysis program is stored. When the time series data aggregation analysis program is executed by a processor, the steps of the time series data aggregation analysis method described below are implemented.

[0248] The various embodiments of the time series data aggregation and analysis device and the computer-readable storage medium of the present invention can all refer to the various embodiments of the time series data aggregation and analysis method of the present invention, and will not be repeated here.

[0249] It should be noted that, in this article, the term "includes", "comprising" or any other variation thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprising a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.

[0250] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.

[0251] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in each embodiment of the present invention.

[0252] The above are only preferred embodiments of the present invention, and the protection scope of the present invention is not limited thereto. Any equivalent structure or equivalent process transformation made by using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the protection scope of the present invention.< / statistics> < / timestamp>

Claims

1. A time series data aggregation analysis method, characterized in that: The method comprises the following steps: In case of receiving an aggregation analysis request, searching for a target aggregation value in the index information of a time series data file, wherein the time series data file includes the index information and at least one time series data block, each of the time series data blocks includes time series data of an object within at least one time range, the time series data includes a time list and a metric value list corresponding to at least one metric, the index information is used to indicate the object corresponding to each of the time series data blocks in the time series data file, the time range and metric aggregation information of the time series data in each of the time series data blocks, and the position of each of the time series data blocks in the time series data file, the metric aggregation information includes the aggregation value of at least one aggregation item corresponding to each of the metrics; the target aggregation value is the aggregation value of the target aggregation item of the target object with respect to the target metric within the target time range, and the target object, the target time range, the target metric, and the target aggregation item are indicated by the aggregation analysis request; If the target aggregate value is not found in the index information of the time series data file, and it is determined based on the index information that the time series data file contains the metric value of the target metric of the target object within the target time range, then according to the position of the time series data block corresponding to the target object indicated by the index information in the time series data file, the data in the time series data block corresponding to the target object is obtained, and the target aggregate value is searched for based on the obtained data.

2. The time series data aggregation analysis method according to claim 1, characterized in that: The index information includes data block index information corresponding to each of the time series data blocks in the time series data file, and the data block index information includes the time range and metric aggregation information of the time series data in the time series data block and the position information of the time series data block in the time series data file; The step of searching the target aggregate value in the index information of the time series data file includes: Obtaining index information of each target data block corresponding to the target object; For each target data block index information, if the time range included in the target data block index information falls within the target time range or is completely consistent with the target time range, then find out the aggregation value of the target aggregation item of the target metric from the metric aggregation information included in the target data block index information, and use the found aggregation value as a candidate aggregation value to determine the target aggregation value according to all the candidate aggregation values ​​found; If the time range included in the target data block index information is outside the target time range, it is determined that the target aggregate value is not found in the target data block index information, and it is determined that the time series data block corresponding to the target data block index information does not contain the metric value of the target metric of the target object within the target time range; If the time range included in the target data block index information overlaps with the target time range, it is determined that the target aggregate value is not found in the target data block index information, and it is determined that the time series data block corresponding to the target data block index information contains the metric value of the target metric of the target object within the target time range.

3. The time series data aggregation analysis method according to claim 2, characterized in that: The index information also includes object index information corresponding to each object contained in the time series data file, the object index information includes position information of each data block index information corresponding to the same object in the time series data file, and time range and metric aggregation information of the time series data in all the time series data blocks corresponding to the same object; Before the step of obtaining index information of each target data block corresponding to the target object, the method includes: Obtaining target object index information corresponding to the target object; If the time range included in the target object index information falls within the target time range or is completely consistent with the target time range, then find out the aggregation value of the target aggregation item of the target metric from the metric aggregation information included in the target object index information, and use the found aggregation value as a candidate aggregation value to determine the target aggregation value based on all the candidate aggregation values ​​found; If the time range included in the target object index information falls outside the target time range, determining that the target aggregate value cannot be found in the time series data file; If the time range included in the target object index information overlaps with the target time range, the step of obtaining the target data block index information corresponding to the target object is performed according to the position information of the data block index information corresponding to the target object included in the target object index information in the timing data file.

4. The time series data aggregation analysis method according to claim 3, characterized in that: The index information also includes file index information corresponding to the time series data file, the file index information includes serial numbers of all objects included in the time series data file, and position information of the object index information corresponding to all objects in the time series data file; Before the step of obtaining the target object index information corresponding to the target object, the method further includes: Obtaining the file index information; If the file index information does not include the serial number of the target object, it is determined that the target aggregate value cannot be found in the time series data file; If the file index information includes the serial number of the target object, the step of obtaining the target object index information corresponding to the target object is performed according to the position information of the target object index information included in the file index information in the time series data file.

5. The time series data aggregation analysis method according to claim 4, characterized in that: The index information further includes a Bloom filter constructed according to each object included in the time series data file, and the time series data file further includes file tail area information; Before the step of obtaining the file index information, the method further includes: Acquire the file tail area information, and acquire the Bloom filter according to the position information of the Bloom filter in the time series data file included in the file tail area information; If the Bloom filter indicates that the time series data file does not contain the target object, determining that the target aggregate value cannot be found in the time series data file; If the Bloom filter indicates that the target object is included in the time series data file, the step of obtaining the file index information is performed according to the position information of the file index information included in the file tail area information in the time series data file.

6. The time series data aggregation analysis method according to claim 5, characterized in that: Before the step of obtaining the file tail area information, the method further includes: Searching for the Bloom filter and the file index information in memory; If the Bloom filter and the file index information are not found, the step of obtaining the file tail area information is performed.

7. The time series data aggregation analysis method according to any one of claims 1 to 6, characterized in that: Each of the time series data blocks includes at least one time series data page and a page header corresponding to each of the time series data pages, wherein the time series data page includes time series data of an object within a time range, the page header includes the time range and metric aggregation information of the time series data in the corresponding time series data page, and the page header also includes the position information of the corresponding time series data page in the time series data file; The step of acquiring data in the time series data block corresponding to the target object according to the position of the time series data block corresponding to the target object indicated by the index information in the time series data file, and searching for the target aggregate value according to the acquired data comprises: Acquire each target page header in the time series data block corresponding to the target object according to the position of the time series data block corresponding to the target object indicated by the index information in the time series data file; For each of the target page headers, if the time range included in the target page header falls within the target time range or is completely consistent with the target time range, then find out the aggregation value of the target aggregation item of the target metric from the metric aggregation information included in the target page header, and use the found aggregation value as a candidate aggregation value, so as to determine the target aggregation value according to all the candidate aggregation values ​​found; If the time range included in the target page header is outside the target time range, determining that the time series data page corresponding to the target page header does not include the metric value of the target metric of the target object within the target time range; If the time range included in the target page header overlaps with the target time range, the time series data page corresponding to the target page header is obtained according to the location information included in the target page header, and the aggregation value of the target aggregation item of the target metric of the target object within the overlapping time range is obtained according to the metric value sequence corresponding to the target metric in the time series data page, and the statistically obtained aggregation value is used as a candidate aggregation value to determine the target aggregation value based on all the candidate aggregation values ​​found, wherein the overlapping time range is the overlapping part of the time range included in the target page header and the target time range.

8. A time series data aggregation analysis device, characterized in that: The device comprises: A first search module is configured to search for a target aggregate value in the index information of a time series data file when an aggregate analysis request is received, wherein the time series data file includes the index information and at least one time series data block, each of the time series data blocks includes time series data of an object within at least one time range, the time series data includes a time list and a metric value list corresponding to at least one metric, the index information is configured to indicate the object corresponding to each of the time series data blocks in the time series data file, the time range and metric aggregation information of the time series data in each of the time series data blocks, and the position of each of the time series data blocks in the time series data file, the metric aggregation information includes the aggregate value of at least one aggregation item corresponding to each of the metrics; the target aggregate value is the aggregate value of the target aggregation item of the target object with respect to the target metric within the target time range, and the target object, the target time range, the target metric, and the target aggregation item are indicated by the aggregate analysis request; A second search module is used for obtaining data in the time series data block corresponding to the target object according to the position of the time series data block corresponding to the target object indicated by the index information in the time series data file, and searching for the target aggregate value based on the acquired data, if the target aggregate value is not found in the index information of the time series data file, and it is determined based on the index information that the time series data file contains the metric value of the target metric of the target object within the target time range.

9. A time series data aggregation analysis device, characterized in that: The time series data aggregation analysis device includes: a memory, a processor, and a time series data aggregation analysis program stored in the memory and executable on the processor. When the time series data aggregation analysis program is executed by the processor, the steps of the time series data aggregation analysis method according to any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a time series data aggregation analysis program, which, when executed by a processor, implements the steps of the time series data aggregation analysis method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Column-type storage method of time-sequence data, query method and systems

    CN107871022A