Database native time series decomposition method and system
By transforming the original time series decomposition problem of the database into a linear equation solving problem, and by utilizing the sparsity and repetition of the parameter matrix to perform forward substitution calculation and recalculation, the problem of high query overhead in the existing technology is solved, and fast response and efficient decomposition result query are achieved.
Patent Information
- Application Number
- CN202411802221.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-09
- Publication Date
- 2025-12-16
- Estimated Expiration
- 2044-12-09
AI Technical Summary
Existing periodic trend decomposition methods result in huge query overhead and redundant calculations when querying time series data in databases, failing to fully consider the storage characteristics of databases.
The problem of decomposing the original time series data in the database is transformed into a problem of solving linear equations. By using a pre-set single-cycle trend decomposition algorithm, a decomposition pre-calculation algorithm, a recalculation algorithm, and a query decomposition algorithm, and taking advantage of the sparsity and repetition of the parameter matrix, forward substitution calculation and recalculation are performed to generate the decomposition results of the original time series data in the database.
It significantly improves the query efficiency of time series decomposition results, can quickly respond to users' decomposition query requests, reduce redundant calculations, and adapt to missing values and out-of-order data.
Smart Images

Figure CN119862219B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of database technology, and in particular to a method and system for native time series decomposition in databases. Background Technology
[0002] With the rapid development of IoT technology, a large number of sensors and devices have generated massive amounts of time-series data. This data contains rich feature information, and periodic trend decomposition can extract trend features, periodic features, and residual features, providing crucial support for downstream applications such as prediction and anomaly detection. However, existing periodic trend decomposition methods fail to fully consider the storage characteristics of databases. When querying the decomposition results of time series data in a database, it is usually necessary to decompose the time series data from scratch. This not only leads to huge query overhead but also easily results in duplicate calculations on the same data portion due to the needs of different decomposition tasks. Summary of the Invention
[0003] This invention provides a native time series decomposition method and system for databases, addressing the shortcomings of existing technologies such as high query overhead and low query efficiency. This invention can quickly respond to user decomposition query requests, thereby significantly improving the query efficiency of decomposition results.
[0004] This invention provides a method for decomposing native time series data in a database, comprising: converting the native time series decomposition problem into a linear equation solving problem based on a preset single-cycle trend decomposition algorithm, and determining the parameter matrix of the linear equation; based on the parameter matrix, performing forward substitution calculation on the time series data of a single page in the database based on a preset decomposition pre-calculation algorithm to obtain a pre-calculation result; wherein the calculation parameters of the decomposition pre-calculation algorithm correspond to the timestamps of the time series data of the single page; based on a query range, recalculating the pre-calculation results of the first and last parts of the query range based on a preset recalculation algorithm to obtain a recalculated pre-calculation result; and performing backward substitution calculation on the recalculated pre-calculation result based on a preset query decomposition algorithm to obtain the decomposition result of the native time series data in the database.
[0005] According to the present invention, a method for decomposing native time series data in a database is provided, wherein the problem of decomposing native time series data in a database is:
[0006] ,
[0007] in, Time series x In time i The value, For time series in time i Trend items, For time series in time i Periodic terms, is a residual term of the time series at time i , N is a length of the time series, M is a length of the period, is a smoothing parameter, is a first-order difference operator, is a second-order difference operator, is a period difference operator, is a trend value of the time series at time i +1, is a trend value of the time series at time i -1, is a baseline period term, i is a time.
[0008] According to the database native time series decomposition method provided by the application, the database native time series decomposition problem is converted into a linear equation solving problem based on the preset single round period trend decomposition algorithm, and after the parameter matrix of the linear equation is determined, the parameter matrix is decomposed based on the preset pruning matrix decomposition algorithm to obtain a decomposed parameter matrix, so that the step of performing the forward substitution calculation is executed according to the decomposed parameter matrix.
[0009] According to the database native time series decomposition method provided by the application, the missing data in the page is supplemented according to the preset page missing data supplement algorithm.
[0010] According to the database native time series decomposition method provided by the application, the precalculation result of the connection data of adjacent pages is recalculated based on the preset recalculation algorithm, so as to merge the adjacent pages; the form of the adjacent pages includes abutting pages, separated pages and overlapping pages.
[0011] According to the database native time series decomposition method provided by the application, the decomposition precalculation algorithm satisfies the relationship:
[0012] ,
[0013] wherein, is the precalculation result, i is a time, is a start time stamp, L is a lower triangular parameter matrix, b is a constant term vector in the linear equation, is an intermediate vector in the forward substitution process, is an element in the vector b , i is an element in the vector , The k One portion, For matrix L The i - Okay, number k - The elements of the column.
[0014] According to the present invention, a database native time series decomposition method is provided, wherein the recalculation algorithm satisfies the following relation:
[0015] ,
[0016] in, This is the pre-calculation result after recalculation. Forward substitution operator, For the first m -1 page start timestamp m Page number L It is a lower triangular parameter matrix. b This is the vector of constant terms in the linear equation. This is the intermediate vector in the forward substitution process.
[0017] According to the present invention, a database native time series decomposition method is provided, wherein the query decomposition algorithm satisfies the following relation:
[0018] ,
[0019] in, For the database's native time series i One decomposition result, For backward substitution operator, The timestamp at the end of the query range. L It is a lower triangular parameter matrix. d For parameter matrix D elements, This is an intermediate vector in the forward substitution process. y The decomposition result of the original time series in the database. For the pre-calculated results, For parameter matrix D The i One element, N The length of the time series. l For parameter matrix L elements, y k for y The k Each component.
[0020] The application further provides a database native time series decomposition system, comprising: a conversion module, configured to convert a database native time series decomposition problem into a linear equation solving problem based on a preset single-wheel cycle trend decomposition algorithm, and determine a parameter matrix of the linear equation; a pre-calculation module, configured to perform forward substitution calculation on time series data of a single page in the database based on a preset decomposition pre-calculation algorithm according to the parameter matrix, and obtain a pre-calculation result; a calculation parameter of the decomposition pre-calculation algorithm corresponds to a timestamp of the time series data of the single page; a recalculation module, configured to perform recalculation on the pre-calculation result of the head and tail parts of a query range based on a preset recalculation algorithm according to the query range, and obtain a recalculation result; and a query module, configured to perform backward substitution calculation on the recalculation result based on a preset query decomposition algorithm, and obtain a decomposition result of the database native time series.
[0021] The application further provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and running on the processor, wherein the processor implements the database native time series decomposition method according to any one of the above when executing the computer program.
[0022] The application provides a database native time series decomposition method and system, which comprises the following steps: converting a database native time series decomposition problem into a linear equation solving problem based on a preset single-wheel cycle trend decomposition algorithm, and determining a parameter matrix of the linear equation; performing forward substitution calculation on time series data of a single page in the database based on a preset decomposition pre-calculation algorithm according to the parameter matrix, and obtaining a pre-calculation result; a calculation parameter of the decomposition pre-calculation algorithm corresponds to a timestamp of the time series data of the single page; performing recalculation on the pre-calculation result of the head and tail parts of a query range based on a preset recalculation algorithm according to the query range, and obtaining a recalculation result; and performing backward substitution calculation on the recalculation result based on a preset query decomposition algorithm, and obtaining a decomposition result of the database native time series. The application can quickly respond to decomposition query requests of users, thereby significantly improving the decomposition result query efficiency. BRIEF DESCRIPTION OF DRAWINGS
[0023] In order to more clearly illustrate the technical solutions of the present application or the prior art, the following will briefly introduce the drawings needed in the embodiments or prior art description. Obviously, the drawings in the following description are some embodiments of the present application, and other drawings can also be obtained by those skilled in the art without creative effort.
[0024] Figure 1 is a flowchart of the database native time series decomposition method provided by the application.
[0025] Figure 2It is the principle schematic diagram of the time series database page storage graph provided by the application.
[0026] Figure 3 It is the principle schematic diagram of the pruned matrix decomposition algorithm provided by the application.
[0027] Figure 4 It is the pruned matrix decomposition algorithm of the single-cycle trend decomposition method provided by the application. The flowchart of the decomposition algorithm.
[0028] Figure 5 It is the principle schematic diagram of the pre-computed intermediate result merging process provided by the application.
[0029] Figure 6 It is the principle schematic diagram of the native time series decomposition method deployed in the database provided by the application.
[0030] Figure 7 It is the structural schematic diagram of the database native time series decomposition system provided by the application.
[0031] Figure 8 It is the structural schematic diagram of the electronic device provided by the application. DETAILED DESCRIPTION
[0032] In order to make the objects, technical solutions and advantages of the present application clearer, the technical solutions in the present application will be described clearly and completely below with reference to the drawings in the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative labor fall within the scope of protection of the present application.
[0033] Please refer to Figure 1 , Figure 1 It is the flowchart of the database native time series decomposition method provided by the application.
[0034] Please refer to Figure 2 , Figure 2 It is the principle schematic diagram of the time series database page storage graph provided by the application.
[0035] In order to solve the problem that the existing time series cycle trend decomposition method cannot be directly applied to the database, and fully utilize the storage characteristics of the database to improve the decomposition efficiency, the present application provides a database native time series decomposition method, and deploys it in the open-source time series database Apache IoTDB.
[0036] The cycle trend decomposition method decomposes the time series Into three parts: trend item, cycle item and residual item.
[0037]
[0038] where, trend term describes long-term upward or downward trend; cycle term describes periodic characteristics with period M ; residual term describes short-term random fluctuations.
[0039] i.Time series databases often use LSM-Tree (Log-Structured Merge-Tree) structure, and time series data is stored as non-modifiable page files by batch.
[0040] The sequences in the same page are sorted in chronological order, and the sequences of different pages can be divided into three cases of adjacency, separation and overlap according to the timestamp range.
[0041] The present application provides a database native time series decomposition method, comprising:
[0042] 101: convert the database native time series decomposition problem into a linear equation solving problem based on a preset single-cycle trend decomposition algorithm, and determine the parameter matrix of the linear equation.
[0043] Please refer to Figure 3, Figure 3 which is a schematic diagram of the pruning matrix decomposition algorithm provided by the present application.
[0044] Please refer to Figure 4 , Figure 4 which is a flowchart of the pruning decomposition algorithm of the single-cycle trend decomposition method provided by the present application.
[0045] In this embodiment, the database native time series decomposition problem is defined so that it can be converted into a linear equation solving problem, so that the decomposition result can be quickly obtained through a single-cycle loop. In addition, the matrix representation of the decomposition problem is provided, and the sparsity and repetition of the parameter matrix are fully utilized to prune and optimize the solving process of the linear equation, thereby significantly improving the solving efficiency. Only one scan of the data is required to generate the decomposition result, which lays the foundation for its expansion into a pre-computation method.
[0046] Specifically, the preset single-cycle trend decomposition algorithm needs to meet: low noise, i.e. random fluctuations are minimized; periodicity, the difference between periodic components at the same phase is small; smoothness, the change of the trend is more smooth.
[0047] As a preferred embodiment, the database native time series decomposition problem is:
[0048] ,
[0049] where, is a time series x at time i , is a trend term of the time series at time i , is a periodic term of the time series at time i , is a residual term of the time series at time i , N is the length of the time series, M is the length of the period, is a smoothing parameter, is a first-order difference operator, is a second-order difference operator, is a periodic difference operator, is the trend value of the time series at time i + 1, is the trend value of the time series at time i - 1, is a baseline periodic term, i is time.
[0050] The database native time series decomposition problem is converted into a linear equation solving problem, the linear equation is , where each parameter matrix is:
[0051] ,
[0052] The parameter matrix A is expressed as:
[0053] ,
[0054] where, is the real set, is a periodic parameter vector, A 1, A 2 and A 3 are sub-matrices that constitute the matrix A .
[0055] Then the parameter matrix A exhibits two important properties:
[0056] Sparsity: A is a banded matrix with a bandwidth of 4, that is:
[0057] ,
[0058] in, For matrix A The i Line number j Column elements, i For row index, j For column indexes, N The length of the input time series.
[0059] Repetition: Except for the first and last four lines, the elements in the remaining lines exhibit an alternating repetition pattern, that is:
[0060] ,
[0061] in, , It is a second-order diagonal difference operator. For matrix A The i -2nd line j -2 columns of elements.
[0062] As a preferred embodiment, the original time series decomposition problem of the database is transformed into a linear equation solving problem based on a preset single-cycle trend decomposition algorithm. After determining the parameter matrix of the linear equation, the method further includes: decomposing the parameter matrix based on a preset pruning matrix decomposition algorithm to obtain the decomposed parameter matrix, and performing a forward substitution calculation based on the decomposed parameter matrix.
[0063] In this embodiment, in order to solve the linear equation , the parameter matrix A Decomposed into:
[0064] ,
[0065] Considering the parameter matrix A The sparsity and repetition of the parameter matrix can be used to derive the parameter matrix. L (The decomposed parameter matrix) has similar sparsity and convergence.
[0066] Sparsity: L It is a lower triangular matrix with a bandwidth of 4, that is:
[0067] ,
[0068] in, For parameter matrix L The i Line number j The elements of the column.
[0069] Convergence: and Convergence, that is, for any positive real number All exist This makes it possible for all Both exist:
[0070] .
[0071] in, For parameter matrix L The i +2 lines j +2 columns of elements, For parameter matrix D The i +2 lines j +2 columns of elements, For parameter matrix D The i Line number j Column elements, It is the set of natural numbers.
[0072] Based on the above two properties, a pruned version of the single-cycle trend decomposition method is presented. Decomposition Algorithm:
[0073] Input parameter matrix A Iterate through the matrix starting from the first row; initialize the decomposition matrix. L , D ; Calculate the matrix D Next row element; calculate matrix L Next row element; check matrix L , D Whether it converges;
[0074] When both matrices converge, the matrix L and D Assign the same value to every other row; if the two matrices do not converge, return to the step of calculating the matrix. D The steps for the next row of elements are repeated iteratively until both matrices converge.
[0075] Determine if the last four rows have been traversed; if the last four rows have been calculated, output the parameter matrix. L and D If the last four rows have not been calculated, return to the matrix. L and D Assign the same value to every other row and repeat iteratively until the last four rows are reached.
[0076] 102: Based on the parameter matrix, perform forward substitution calculation on the time series data of a single page in the database using a preset decomposition pre-calculation algorithm to obtain the pre-calculation result; the calculation parameters of the decomposition pre-calculation algorithm correspond to the timestamps of the time series data of a single page.
[0077] In this embodiment, the forward substitution process in the single-cycle trend decomposition method is calculated using a pre-computation algorithm, and the intermediate results are stored in a database. Based on this, the periodic and trend information contained in the historical time series decomposition results is combined with the features obtained from local decomposition to process missing values that appear during the pre-computation process, thereby enabling the decomposition method to adapt to actual application scenarios containing missing values.
[0078] Specifically, since the pages in the database are stored in different locations, it is necessary to pre-calculate the data on each page independently. Since the calculation involves only a single page, start and end timestamps are defined as follows: and Then, based on the parameter matrix, a forward substitution calculation is performed on the time-series data of a single page in the database using a preset decomposition and pre-calculation algorithm to obtain the pre-calculation result. The calculation parameters in the decomposition and pre-calculation algorithm are compared with the timestamps of the time-series data of a single page. correspond.
[0079] As a preferred embodiment, the decomposition pre-computation algorithm satisfies the following relation:
[0080] ,
[0081] in, For the preliminary calculation results, i For time, For the start timestamp, L It is a lower triangular parameter matrix. b This is the vector of constant terms in the linear equation. This is an intermediate vector in the forward substitution process. For vectors b The first in i One element, for The k One portion, For matrix L The i - Okay, number k - The elements of the column.
[0082] As a preferred embodiment, the method further includes: performing pre-calculation to supplement missing data in the page according to a preset page missing data supplementation algorithm.
[0083] In this embodiment, for non-header data, since there is sufficient valid historical information, a preset page missing data supplementation algorithm can be used to process the missing data in the page by utilizing historical decomposition features. The calculation method is as follows:
[0084] ,
[0085] wherein, is the 1th component of the vector , j is the 1th component of the vector , y is the 2th component of the vector j , is the 2th component of the vector , i is the 2th component of the vector , y is the 2th component of the vector i , is the 1th periodic component, i is the 2th component of the vector , is the 2th component of the vector i , is the element of the parameter matrix L in the 1th row and the 1th column. i j k j
[0086] By the above calculation process, the supplementary pre-computation result value is obtained.
[0087] 103: According to the query range, the pre-computation result of the head and tail part of the query range is re-computed based on the preset re-computation algorithm, and the re-computed pre-computation result is obtained.
[0088] As a preferred embodiment, the re-computation algorithm satisfies the relationship:
[0089] ,
[0090] wherein, is the re-computed pre-computation result, is the forward substitution operator, is the start timestamp of the 1th page, m is the page serial number, m is the lower triangular matrix, L is the constant term vector in the linear equation, b is the intermediate vector in the forward substitution process, i is the 1th element in the vector b , b is the 1th component of the vector i , is the 1th component of the vector , k is the 1th component of the vector is the 1th component of the vector L , i The row, the k - The column of elements.
[0091] As a preferred embodiment, further comprising: re-computing the pre-computed result of the connection data of the adjacent pages based on a preset re-computation algorithm to perform the merging of the adjacent pages; and the form of the adjacent pages comprises abutting pages, separated pages and overlapping pages.
[0092] Please refer to Figure 5 , Figure 5 The principle diagram of the pre-computed intermediate result merging process provided by the present application.
[0093] Considering the periodic trend decomposition requirements: time series are collected at equal time intervals, there are no missing values in the data, and the timestamps are arranged in chronological order. However, these assumptions are often difficult to meet in practical applications. Time series data is usually stored in a time series database based on LSM-Tree. Such databases store data in units of data pages, and the timestamps between different data pages may not be continuous, and even there may be out-of-order data arrival. In addition, due to sensor or network failure and other reasons, missing values often appear in time series data.
[0094] In the present embodiment, in combination with the storage characteristics of the database, an efficient merging method for decomposition intermediate results is proposed. For the three cases of timestamp range abutment, separation and overlap caused by out-of-order data arrival and other problems between different pages of the database, corresponding pre-computed intermediate result merging strategies are designed. Only part of the data at the page intersection is re-computed, without the need to re-compute all the data, which can effectively handle out-of-order data and significantly reduce the overhead of merging computation.
[0095] Specifically, in view of the page structure adopted by the database when storing data, and the disk page merging operation that may be triggered as the data size increases, in the present embodiment, in the storage organization structure adopted by the LSM-Tree, each page stores a segment of the time series x The larger the page number, the newer the data. Due to the existence of missing values and out-of-order arrival, different pages may present the following in the timestamp: the timestamps of abutting pages (page 1 and page 2) are continuous; there is a gap between the timestamps of separated pages (page 2 and page 3), such as the interval caused by missing values or delayed values; the delayed values of overlapping pages (page 3 and page 4) will supplement the incomplete data in the previous page with a smaller number. In order to reconstruct the pre-computed intermediate result of the time series x , these pages with different relationships need to be merged.
[0096] For abutting pages, the connection data is re-computed based on a preset re-computation algorithm until converges to , there exists , there exists , there exists , there exists , the merging of adjacent adjacent pages is performed.
[0097] For separate pages, the first m -1 page and the first m page are separate pages if and only if there is a missing value between the two pages. Since both x and z are missing between the two pages, for in , for in are missing, the missing data needs to be processed using the above page missing data supplement algorithm, and then the adjacent page convergence algorithm is used for convergence recalculation to merge adjacent separate pages.
[0098] For overlapping pages, for the overlapping case of , first extract all data within the overlapping timestamp, and if the same timestamp data exists in both pages, keep the data with the larger page code; then recalculate all intermediate results in the overlapping part; finally, using the precalculation results of the first m page, the merging of adjacent overlapping pages is performed.
[0099] Please refer to Figure 6 , Figure 6 for the principle diagram of the decomposition method of the original time series provided by the application deployed in the database.
[0100] In this embodiment, the beginning of the data in the query range is recalculated, and the starting point of the precalculation result is adjusted from the beginning of the page to the beginning of the query range; secondly, the end of the data in the query range is recalculated, and the termination point of the precalculation result is adjusted from the end of the page to the end of the query range.
[0101] The head recalculation process is: ;
[0102] The tail recalculation process is: ;
[0103] Among them, is the precalculation result after head recalculation, is the precalculation result after tail recalculation, is the timestamp at the beginning of the query range.
[0104] 104: Based on the preset query decomposition algorithm, the precalculation result after recalculation is backwardly replaced and calculated to obtain the decomposition result of the original time series of the database.
[0105] As a preferred embodiment, the query decomposition algorithm satisfies the following relation:
[0106] ,
[0107] in, For the database's native time series i There are several decomposition results, when i is an odd number. When i is even, ; For backward substitution operator, The timestamp at the end of the query range. L It is a lower triangular parameter matrix. d For parameter matrix D elements, This is an intermediate vector in the forward substitution process. y The decomposition results are the original time series data from the database. For the preliminary calculation results, For parameter matrix D The i One element, N The length of the time series. l For parameter matrix L elements, y k for y The k Each component.
[0108] In this embodiment, backward substitution calculation is performed based on a preset query decomposition algorithm, the head recalculation result, and the tail recalculation result to obtain the decomposition result of the original time series in the database. This can quickly respond to the user's decomposition query request and quickly generate the complete decomposition result of the queried time series, thereby significantly improving the query efficiency of the decomposition result.
[0109] The database native time series decomposition system provided by the present invention is described below. The database native time series decomposition system described below can be referred to in correspondence with the database native time series decomposition method described above.
[0110] Please refer to Figure 7 , Figure 7 This is a schematic diagram of the structure of the database native time series decomposition system provided by the present invention.
[0111] The application further provides a database native time series decomposition system, comprising: a conversion module 701, configured to convert a database native time series decomposition problem into a linear equation solving problem based on a preset single round period trend decomposition algorithm, and determine a parameter matrix of the linear equation; a pre-calculation module 702, configured to perform forward substitution calculation on time series data of a single page in the database based on a preset decomposition pre-calculation algorithm according to the parameter matrix, and obtain a pre-calculation result; a calculation parameter of the decomposition pre-calculation algorithm corresponds to a timestamp of the time series data of the single page; a recalculation module 703, configured to perform recalculation on pre-calculation results of head and tail parts of a query range based on a preset recalculation algorithm according to the query range, and obtain recalculation results of the pre-calculation; and a query module 704, configured to perform backward substitution calculation on the recalculation results of the pre-calculation based on a preset query decomposition algorithm, and obtain a decomposition result of the database native time series.
[0112] Figure 8 An example of a structural diagram of an electronic device is shown in Figure 8 The electronic device can include a processor 801, a communications interface 802, a memory 803, and a communications bus 804, wherein the processor 801, the communications interface 802, and the memory 803 can communicate with each other through the communications bus 804. The processor 801 can invoke a logical instruction in the memory 803 to execute a database native time series decomposition method, which comprises: converting a database native time series decomposition problem into a linear equation solving problem based on a preset single round period trend decomposition algorithm, and determining a parameter matrix of the linear equation; performing forward substitution calculation on time series data of a single page in the database based on a preset decomposition pre-calculation algorithm according to the parameter matrix, and obtaining a pre-calculation result; a calculation parameter of the decomposition pre-calculation algorithm corresponds to a timestamp of the time series data of the single page; performing recalculation on pre-calculation results of head and tail parts of a query range based on a preset recalculation algorithm according to the query range, and obtaining recalculation results of the pre-calculation; and performing backward substitution calculation on the recalculation results of the pre-calculation based on a preset query decomposition algorithm, and obtaining a decomposition result of the database native time series.
[0113] In addition, the logical instructions in the memory 803 described above can be implemented in the form of a software function unit and sold or used as an independent product, and can be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application essentially or the part that contributes to the prior art or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium, and includes several instructions for making a computer device (which can be a personal computer, a server, or a network device, etc.) execute all or part of the steps of the methods described in various embodiments of the present application. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk or an optical disk, and various media that can store program codes.
[0114] In another aspect, the present application also provides a computer program product, which comprises a computer program, the computer program can be stored on a non-transitory computer readable storage medium, and the computer program can be executed by a processor to enable a computer to execute the database native time series decomposition method provided by the above-mentioned method. The method comprises: converting the database native time series decomposition problem into a linear equation solving problem based on a preset single round cycle trend decomposition algorithm, and determining the parameter matrix of the linear equation; based on the parameter matrix, performing forward substitution calculation on the time series data of a single page in the database based on a preset decomposition pre-computation algorithm to obtain a pre-computation result; the calculation parameters of the decomposition pre-computation algorithm correspond to the timestamps of the time series data of the single page; based on a preset recalculation algorithm, the pre-computation results of the first and last parts of the query range are recalculated based on the query range to obtain the recalculated pre-computation results; based on a preset query decomposition algorithm, the recalculated pre-computation results are backward substitution calculated to obtain the decomposition results of the database native time series.
[0115] In yet another aspect, the present application also provides a non-transitory computer readable storage medium having stored thereon a computer program, which, when executed by a processor, implements the database native time series decomposition method provided by the above method, and the method comprises: converting the database native time series decomposition problem into a linear equation solving problem based on a preset single round period trend decomposition algorithm, and determining a parameter matrix of the linear equation; performing forward substitution calculation on the time series data of a single page in the database based on a preset decomposition precalculation algorithm according to the parameter matrix, to obtain a precalculation result; the calculation parameters of the decomposition precalculation algorithm correspond to the timestamps of the time series data of the single page; performing recalculation on the precalculation results of the first and last parts of the query range based on a preset recalculation algorithm according to the query range, to obtain the recalculation result; and performing backward substitution calculation on the recalculation result based on a preset query decomposition algorithm, to obtain the decomposition result of the database native time series.
[0116] The device embodiments described above are merely illustrative, wherein the units described as separate components can or can not be physically separated, and the components displayed as units can or can not be physical units, i.e., can be located in one place or distributed on multiple network units. Part or all of the modules can be selected to achieve the purpose of the embodiment scheme according to actual needs. Those skilled in the art can understand and implement without creative labor.
[0117] From the above description of the embodiments, those skilled in the art can clearly understand that the embodiments can be realized by means of software and necessary universal hardware platforms, and of course can also be realized by hardware. Based on such understanding, the above technical solutions can be embodied in the form of a software product, which can be stored in a computer readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes a plurality of instructions for causing a computer device (which can be a personal computer, server, or network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0118] Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, and not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: it can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacement for some technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A database native time series decomposition method, characterized in that, include: Based on a preset single-cycle trend decomposition algorithm, the original time series decomposition problem in the database is transformed into a linear equation solving problem, and the parameter matrix of the linear equation is determined. Based on the parameter matrix, a forward substitution calculation is performed on the time series data of a single page in the database using a preset decomposition and pre-calculation algorithm to obtain the pre-calculation result; The calculation parameters of the decomposition pre-computation algorithm correspond to the timestamps of the time series data of the individual pages; Based on the query range, the pre-calculated results of the first and last parts of the query range are recalculated using a preset recalculation algorithm to obtain the recalculated pre-calculation results. Based on the preset query decomposition algorithm, the recalculated pre-calculation result is subjected to backward substitution calculation to obtain the decomposition result of the original time series in the database; The problem of native time series decomposition in the database is as follows: , in, Time series x In time i The value, For time series in time i Trend items, For time series in time i Periodic terms, For time series in time i The residual term, N The length of the time series. M The length of the period, For smoothing parameters, It is a first-order difference operator. It is a second-order difference operator. For periodic difference operators, For time series in time i A trend value of +1, For time series in time i The trend value is -1. For the baseline periodic term, i For time; The decomposition pre-computation algorithm satisfies the following relation: , in, For the pre-calculated results, i For time, For the start timestamp, L It is a lower triangular parameter matrix. b This is the vector of constant terms in the linear equation. This is an intermediate vector in the forward substitution process. For vectors b The first in i One element, for The k One portion, For matrix L The i - Okay, number k - Column elements; The recalculation algorithm satisfies the following relation: , in, This is the pre-calculation result after recalculation. Forward substitution operator, For the first m -1 page start timestamp m Page number L It is a lower triangular parameter matrix. b This is the vector of constant terms in the linear equation. This is the intermediate vector in the forward substitution process; The query decomposition algorithm satisfies the following relation: , in, For the database's native time series i One decomposition result, For backward substitution operator, The timestamp at the end of the query range. L It is a lower triangular parameter matrix. d For parameter matrix D elements, This is an intermediate vector in the forward substitution process. y The decomposition result of the original time series in the database. For the pre-calculated results, For parameter matrix D The i One element, N The length of the time series. l For parameter matrix L elements, y k for y The k Each component.
2. The database native time series decomposition method according to claim 1, characterized in that, The process of transforming the original time series decomposition problem in the database into a linear equation solving problem based on a preset single-cycle trend decomposition algorithm, and determining the parameter matrix of the linear equation, further includes: The parameter matrix is decomposed based on a matrix factorization algorithm with preset pruning to obtain a decomposed parameter matrix, and the forward substitution calculation step is performed based on the decomposed parameter matrix.
3. The database native time series decomposition method according to claim 1, characterized in that, Also includes: The missing data on the page is pre-calculated and supplemented according to the preset missing data supplementation algorithm.
4. The database native time series decomposition method according to claim 1, characterized in that, Also includes: The pre-calculated results of the data at the connection points of adjacent pages are recalculated based on the preset recalculation algorithm in order to merge adjacent pages. The adjacent pages can take the form of adjacent pages, separate pages, and overlapping pages.
5. A database native time series decomposition system, characterized in that, The system employs the database native time series decomposition method according to any one of claims 1 to 4, and the system comprises: The conversion module is used to convert the original time series decomposition problem in the database into a linear equation solving problem based on a preset single-cycle trend decomposition algorithm, and to determine the parameter matrix of the linear equation. The pre-calculation module is used to perform forward substitution calculation on the time series data of a single page in the database based on the parameter matrix and a preset decomposition pre-calculation algorithm to obtain the pre-calculation result; the calculation parameters of the decomposition pre-calculation algorithm correspond to the timestamps of the time series data of the single page. The recalculation module is used to recalculate the pre-calculated results of the first and last parts of the query range based on a preset recalculation algorithm, and obtain the recalculated pre-calculation results. The query module is used to perform backward substitution calculation on the recalculated pre-calculated results based on a preset query decomposition algorithm to obtain the decomposition results of the original time series in the database.
6. An electronic device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that, When the processor executes the computer program, it implements the database native time series decomposition method as described in any one of claims 1 to 4.
Citation Information
Patent Citations
Hybrid processing method and device for unit and multivariate time series data and computer equipment
CN115630100A
Time sequence prediction method based on decomposition mechanism and attention mechanism
CN116579447A