# US 2021/0333994 A1 · Method for aggregation optimization of time series data

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2021/0333994 A1
- Document ID: US20210333994A1
- Status: Published application
- Kind: A1
- Application number: 17/265,284
- Filed: 2019-07-18
- Published: 2021-10-28
- Earliest claimed: 2018-08-03
- Assignees: Taos Data
- Applicants: Taos Data
- Inventors: Haojun LIAO; Shengliang GUAN; Hongze CHENG; Jianhui TAO
- Web page: https://patentgrep.com/patent/US20210333994A1

## CPC

- G06F 3/061: {Improving I/O performance}
- G06F 3/064: {Management of blocks}
- G06F 3/0643: {Management of files}
- G06F 3/0655: {Vertical data movement, i.e. input-output transfer; data movement between one or more hosts and one or more storage devices}
- G06F 3/0673: {Single storage device}
- G06F 16/24552: {Database cache management}
- G06F 16/2477: {Temporal data queries}
- G06F 12/0868: Data transfer between cache memory and other subsystems, e.g. storage devices or host systems
- G06F 2212/163: Server or database system
- G06F 2212/463: File
- G06F 2212/502: using adaptive policy
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

The invention discloses an aggregation optimized processing method for time-series data, characterized by comprising the following steps: writing a time-series data record into a database, forming a time-series database file, wherein the time-series database file comprises a data file and an index file, the data file comprises multiple data blocks, the index file comprises index blocks, and each index block correspond to one data block; by scanning an index file according to a start time period and a stop time period, extracting all index blocks of the time series that need to be aggregated that meet the time period conditions, and then sorting the index blocks according to the data block offset recorded in the index block; and by scanning the data file according to a data block offset order recorded in sorted index blocks, performing specified reading and calculating on each data block, and aggregating calculation results. According to the method, the reading of a single time series data or the aggregation operation of multiple time-series data can be completed by only opening a data file once for scanning such that the overall performance is greatly improved.

## Claims

### Claim 1

A method for aggregation and optimization of time-series data, comprising the following steps:
by writing a time-series data record into a database, forming a time-series database file, wherein the time-series database file comprises a data file and an index file, the data file comprises multiple data blocks, the index file comprises index blocks, and each index block correspond to one data block;
by scanning an index file according to a start time period and a stop time period, extracting all index blocks of the time series that need to be aggregated that meet the time period conditions, and then sorting the index blocks according to the data block offset recorded in the index block; and
by scanning the data file according to a data block offset order recorded in sorted index blocks, performing specified reading and calculating on each data block, and aggregating calculation results.

### Claim 2 (depends on 1)

The method of claim 1, wherein when the index blocks are sorted, index blocks with small offsets precede.

### Claim 3 (depends on 1)

The method of claim 1, wherein the data file contains multiple time-series data blocks.

### Claim 4 (depends on 1)

The method of claim 1, wherein the index file records information of each time-series data block.

### Claim 5 (depends on 4)

The method of claim 4, wherein each time series in the index file has one index summary information block and one or more index blocks; the index summary information block contains an ID of the time series and the number of data blocks.

### Claim 6 (depends on 3)

The method of claim 3, wherein each data block has one corresponding index block that contains an offset, a start time, an end time, and the number of records for the data block in the data file.

### Claim 7 (depends on 1)

The method of claim 1, wherein by scanning the data file according to a data block offset order recorded in sorted index blocks, performing specified reading on each data block comprise:
by scanning the data file according to a data block offset order recorded in sorted index blocks, reading data block from a data block file; and
obtaining data of a specified time period in the data block.

### Claim 8 (depends on 1)

The method of claim 1, wherein write the time-series data records to RAM before writing them to the database.

### Claim 9 (depends on 8)

The method of claim 8, wherein when RAM occupation rate reaches a certain proportion or every certain time, time-series data cached by the RAM is written to a disk.

### Claim 10 (depends on 9)

The method of claim 9, wherein a step of writing time-series data to a disk comprises:
1) sorting the data of each time series by time in the RAM;
2) for each time-series data, writing data in RAM to a data file in an appended mode according to a setting of the data block size to generate one or more data blocks;
3) for each new data block, including data block information containing a start time, an end time, and the number of records into one new index block, and writing it to the index file; and
4) continuously storing an index summary information block and index block information of each time series, and regenerating a new block index file each time when the data in RAM is written to the disk.
