Data storage method and device based on time sequence database, electronic equipment and medium

By obtaining and storing the timestamps and tag information of the data source in the timing database, a data storage super table is formed, which solves the problem of poor data storage reliability in the prior art and improves the accuracy and timeliness of data query.

CN119066074AActive Publication Date: 2024-12-03成都虚谷伟业科技有限公司
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202411206442.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Priority Date
2024-06-24
Filing Date
2024-08-30
Publication Date
2024-12-03
Estimated Expiration
2044-08-30

AI Technical Summary

Technical Problem

The existing storage technology based on time series databases is relatively low in time and accuracy during data query, resulting in poor data storage reliability.

Method used

By obtaining the timestamp information and label information of the data to be stored for each target data source, it is stored in the corresponding data storage subtable to form a data storage super table to realize classified storage based on the target data source and a more complex data model. .

Benefits of technology

It improves the accuracy and timeliness of data queries, enhances the reliability of data storage, and improves the accuracy and timeliness of data during the query process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119066074A_ABST
    Figure CN119066074A_ABST
Patent Text Reader

Abstract

The invention provides a data storage method and device based on a time sequence database, electronic equipment and a medium, and relates to the technical field of data storage. In the application, firstly, to-be-stored data corresponding to each target data source can be respectively acquired, and multiple pieces of to-be-stored data corresponding to multiple target data sources are obtained; secondly, for each piece of to-be-stored data in the multiple pieces of to-be-stored data, obtaining timestamp information of the to-be-stored data and label information of the to-be-stored data; and then, for each piece of data to be stored in a plurality of pieces of data to be stored, storing the data to be stored, the timestamp information corresponding to the data to be stored and the tag information corresponding to the data to be stored in the data storage sub-table corresponding to the target data source corresponding to the data to be stored. On the basis of the content, the problem that in the prior art, the reliability of data storage is relatively poor can be solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of data storage, and in particular to a data storage method and device, electronic device and medium based on a time series database. Background Art

[0002] In a time series database, multiple data from multiple data sources are generally expanded, such as being expanded into a time series record to achieve flat storage. In this way, corresponding queries and analyses can be performed through corresponding time indexes. However, the inventors have found through research that in the existing storage technology based on time series databases, there is a problem of relatively poor reliability of data storage (e.g., the data stored based on this storage technology is relatively low in timeliness or accuracy during the query process). Summary of the invention

[0003] In view of this, the purpose of the present application is to provide a data storage method and device, electronic device and medium based on a time series database, so as to improve the problem of relatively poor reliability of data storage existing in the prior art.

[0004] To achieve the above purpose, the embodiment of the present application adopts the following technical solution:

[0005] A data storage method based on a time series database, comprising:

[0006] Respectively obtain the data to be stored corresponding to each target data source, and obtain multiple data to be stored corresponding to multiple target data sources, wherein each of the target data sources is used to reflect the data source of the corresponding data to be stored;

[0007] For each of the plurality of data to be stored, obtaining timestamp information of the data to be stored and label information of the data to be stored, wherein the label information is used to reflect at least one data source spatial feature of the target data source;

[0008] For each of the multiple data to be stored, the data to be stored, the timestamp information corresponding to the data to be stored, and the label information corresponding to the data to be stored are stored in a data storage sub-table corresponding to the target data source corresponding to the data to be stored, wherein in the data storage sub-table, the stored data is stored according to the time series represented by the corresponding timestamp information, and the data storage super table composed of multiple data storage sub-tables is stored in the target time series database.

[0009] In a preferred embodiment of the present application, in the above-mentioned data storage method based on a time series database, the step of obtaining the timestamp information of the data to be stored and the tag information of the data to be stored for each of the multiple data to be stored includes:

[0010] For each of the plurality of data to be stored, obtaining timestamp information of the data to be stored, and obtaining location feature information and shape feature information of a target data source corresponding to the data to be stored, wherein the location feature information and the shape feature information are used to reflect the data source spatial features of the corresponding target data source;

[0011] The position feature information and shape feature information of the target data source are determined as the corresponding label information of the data to be stored.

[0012] In a preferred embodiment of the present application, in the above-mentioned data storage method based on a time series database, the step of obtaining the timestamp information of each of the plurality of data to be stored, and obtaining the position feature information and shape feature information of the target data source corresponding to the data to be stored, includes:

[0013] For each of the plurality of data to be stored, obtaining timestamp information of the data to be stored, and obtaining longitude and latitude information and altitude information of a target data source corresponding to the data to be stored, and determining the longitude and latitude information and the altitude information as location feature information of the target data source;

[0014] Determine the spatial range information covered by the target data source, and determine the spatial range information as the shape feature information of the target data source, wherein, when the target data source belongs to an information acquisition device, the spatial range information is used to reflect the effective range of information acquisition by the information acquisition device, and at least includes the spatial shape and size information of the effective range.

[0015] In a preferred embodiment of the present application, in the above-mentioned data storage method based on a time series database, the step of storing, for each of the multiple data to be stored, the data to be stored, the timestamp information corresponding to the data to be stored, and the tag information corresponding to the data to be stored in the data storage subtable corresponding to the target data source corresponding to the data to be stored, includes:

[0016] For each target data source among the multiple target data sources, determining whether there is a data storage sub-table corresponding to the target data source;

[0017] For each target data source that currently has a corresponding data storage sub-table, the to-be-stored data corresponding to the target data source, the timestamp information corresponding to the to-be-stored data, and the tag information corresponding to the to-be-stored data among the multiple to-be-stored data are stored in the data storage sub-table corresponding to the target data source;

[0018] For each target data source for which there is currently no corresponding data storage sub-table, a data storage sub-table corresponding to the target data source is constructed, and the data to be stored corresponding to the target data source among the multiple data to be stored, the timestamp information corresponding to the data to be stored, and the label information corresponding to the data to be stored are stored in the data storage sub-table.

[0019] In a preferred embodiment of the present application, in the above-mentioned data storage method based on a time series database, for each target data source that currently has a corresponding data storage sub-table, the step of storing the data to be stored corresponding to the target data source among the multiple data to be stored, the timestamp information corresponding to the data to be stored, and the label information corresponding to the data to be stored in the data storage sub-table corresponding to the target data source includes:

[0020] For each target data source that currently has a corresponding data storage sub-table, perform the following operations on the target data source:

[0021] The data to be stored corresponding to the target data source among the plurality of data to be stored are stored in a data column of a data storage subtable corresponding to the target data source, wherein the data storage subtable includes at least a data column, a timestamp column, and a label column;

[0022] The timestamp information corresponding to the data to be stored is stored in the timestamp column in the data storage subtable corresponding to the target data source;

[0023] The label information corresponding to the data to be stored is stored in the label column in the data storage subtable corresponding to the target data source, wherein the data to be stored corresponding to the target data source, the timestamp information corresponding to the data to be stored, and the label information corresponding to the data to be stored are stored in the same row in the data storage subtable.

[0024] In a preferred choice of the embodiment of the present application, in the above-mentioned data storage method based on a time series database, for each target data source for which there is currently no corresponding data storage sub-table, a data storage sub-table corresponding to the target data source is constructed, and the data to be stored corresponding to the target data source among the multiple data to be stored, the timestamp information corresponding to the data to be stored, and the tag information corresponding to the data to be stored are stored in the data storage sub-table, including:

[0025] For each target data source that currently does not have a corresponding data storage sub-table, a data storage sub-table corresponding to the target data source is constructed based on the data source spatial characteristics corresponding to the target data source, wherein the data storage sub-table includes at least one row and multiple columns, and the multiple columns include at least a data column, a timestamp column, and a label column, the data column is used to store data to be stored, the timestamp column is used to store timestamp information, and the label column is used to store label information;

[0026] After constructing the data storage subtable corresponding to the target data source, the data to be stored corresponding to the target data source, the timestamp information corresponding to the data to be stored and the label information corresponding to the data to be stored among the multiple data to be stored are stored in the same row of the data storage subtable.

[0027] The embodiment of the present application also provides a data storage device based on a time series database, including:

[0028] A data acquisition module is used to respectively acquire the data to be stored corresponding to each target data source, and obtain multiple data to be stored corresponding to multiple target data sources, wherein each of the target data sources is used to reflect the data source of the corresponding data to be stored;

[0029] A related information acquisition module, used for acquiring, for each of the plurality of data to be stored, timestamp information of the data to be stored and label information of the data to be stored, wherein the label information is used to reflect at least one data source spatial feature of the target data source;

[0030] A data storage module is used to store, for each of the multiple data to be stored, the data to be stored, the timestamp information corresponding to the data to be stored, and the label information corresponding to the data to be stored in a data storage sub-table corresponding to a target data source corresponding to the data to be stored, wherein in the data storage sub-table, the stored data is stored according to the time sequence represented by the corresponding timestamp information, and a data storage super table composed of multiple data storage sub-tables is stored in a target time series database.

[0031] In a preferred embodiment of the present application, in the above-mentioned data storage device based on the time series database, the relevant information acquisition module is specifically used for:

[0032] For each of the plurality of data to be stored, obtaining timestamp information of the data to be stored, and obtaining location feature information and shape feature information of a target data source corresponding to the data to be stored, wherein the location feature information and the shape feature information are used to reflect the data source spatial features of the corresponding target data source;

[0033] The position feature information and shape feature information of the target data source are determined as the corresponding label information of the data to be stored.

[0034] Based on the above, an embodiment of the present application further provides an electronic device, including:

[0035] Memory for storing computer programs;

[0036] The processor connected to the memory is used to execute the computer program stored in the memory to implement the above-mentioned data storage method based on the time series database.

[0037] On the basis of the above, an embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored, and when the computer program is run, each step of the above-mentioned data storage method based on a time series database is executed.

[0038] The data storage method and device, electronic device and medium based on the time series database provided by the present application can, firstly, respectively obtain the data to be stored corresponding to each target data source, and obtain multiple data to be stored corresponding to multiple target data sources; secondly, for each of the multiple data to be stored, obtain the timestamp information of the data to be stored and the label information of the data to be stored; then, for each of the multiple data to be stored, store the data to be stored, the timestamp information corresponding to the data to be stored and the label information corresponding to the data to be stored in the data storage subtable corresponding to the target data source corresponding to the data to be stored. Based on the above content, since the data to be stored are stored in the corresponding data storage sub-tables respectively, and the data storage sub-tables correspond to the target data source, in this way, classified storage based on the target data source can be realized, and since the stored data includes not only the data to be stored and the timestamp information, but also the label information, and the label information is at least used to reflect the data source spatial characteristics of the target data source, so that in the subsequent data query process, data query can also be performed based on the data source spatial characteristics, so that the accuracy of the query can be improved to a certain extent, such as narrowing the query range by the data source spatial characteristics, etc., wherein, when the query range is narrowed, not only the accuracy can be improved, but also the timeliness can be improved, therefore, the problem of relatively poor reliability of data storage existing in the prior art can be improved, so that the data stored based on this data storage technology is more reliable in subsequent queries. In addition, since multiple data storage sub-tables will form corresponding data storage super tables in the target time series data for storage, more complex data models and query operations can be realized. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, preferred embodiments are specifically cited below and described in detail with reference to the attached drawings.

[0040] Figure 1 A structural block diagram of an electronic device provided in an embodiment of the present application.

[0041] Figure 2 A flowchart of a data storage method based on a time series database provided in an embodiment of the present application.

[0042] Figure 3 A schematic diagram of a data storage sub-table provided in an embodiment of the present application.

[0043] Figure 4 A block diagram of a data storage device based on a time series database provided in an embodiment of the present application. DETAILED DESCRIPTION

[0044] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. The components of the embodiments of the present application described and shown in the drawings here can be arranged and designed in various different configurations.

[0045] Therefore, the following detailed description of the embodiments of the present application provided in the accompanying drawings is not intended to limit the scope of the present application for which protection is sought, but merely represents selected embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without creative work are within the scope of protection of the present application.

[0046] like Figure 1 As shown, an embodiment of the present application provides an electronic device, wherein the electronic device may include a memory, a processor, and a data storage device based on a time series database.

[0047] In detail, the memory and the processor can be electrically connected directly or indirectly to realize data transmission or interaction. For example, they can be electrically connected to each other through one or more communication buses or signal lines. The data storage device based on the time series database includes at least one software function module stored in the memory in the form of software or firmware. The processor is used to execute the executable computer program stored in the memory, for example, the software function module and computer program included in the data storage device based on the time series database, so as to realize the data storage method based on the time series database provided in the embodiment of the present application.

[0048] Optionally, the memory can be, but is not limited to, random access memory (RAM), read only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable read-only memory (Electric Erasable Programmable Read-Only Memory, EEPROM), etc.

[0049] Furthermore, the processor may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), a system on chip (SoC), etc.; it may also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0050] Understandably, Figure 1 The structure shown is for illustration only, and the electronic device may also include Figure 1 More or fewer components as shown, or with Figure 1 The different configurations shown, for example, may also include a communication unit for exchanging information with other devices (such as terminal devices, etc.).

[0051] Combination Figure 2 The embodiment of the present application also provides a data storage method based on a time series database that can be applied to the above electronic device. The method steps defined in the process related to the data storage method based on a time series database can be implemented by the electronic device.

[0052] The following will Figure 2 The specific process shown is explained in detail.

[0053] Step S110 , respectively acquiring the data to be stored corresponding to each target data source, and obtaining a plurality of data to be stored corresponding to the plurality of target data sources.

[0054] In an embodiment of the present application, the electronic device can respectively obtain the data to be stored corresponding to each target data source, and obtain multiple data to be stored corresponding to multiple target data sources. Each of the target data sources is used to reflect the data source of the corresponding data to be stored. Exemplarily, the target data source can be a sensor, other electronic devices, etc. Exemplarily, the data to be stored can be data collected by a sensor or a log file of an electronic device, etc.

[0055] Step S120: For each data to be stored among the plurality of data to be stored, obtain the timestamp information of the data to be stored and the tag information of the data to be stored.

[0056] In an embodiment of the present application, the electronic device can obtain the timestamp information of the data to be stored and the tag information of the data to be stored for each of the multiple data to be stored. The tag information is used to reflect at least one data source spatial feature of the target data source, that is, the feature of the target data source in space.

[0057] Step S130, for each of the multiple data to be stored, the data to be stored, the timestamp information corresponding to the data to be stored, and the tag information corresponding to the data to be stored are stored in the data storage subtable corresponding to the target data source corresponding to the data to be stored.

[0058] In an embodiment of the present application, the electronic device can store the data to be stored, the timestamp information corresponding to the data to be stored, and the tag information corresponding to the data to be stored in a data storage subtable corresponding to the target data source corresponding to the data to be stored for each of the multiple data to be stored. In the data storage subtable, the stored data is stored according to the time sequence represented by the corresponding timestamp information, for example, the storage position of the data with earlier timestamp information is closer to the front, and the storage position of the data with later timestamp information is closer to the back, and the data storage supertable composed of multiple data storage subtables is stored in the target time series database.

[0059] It should be noted that a super table is a collection of multiple sub tables, usually used to represent a one-to-many or many-to-many relationship. The super table itself does not store data, but is just a logical combination. Each sub table is associated with the super table through a foreign key. A sub table is an independent table in a super table, containing relevant data of an entity or concept. A sub table can be associated with data in other sub tables or super tables through foreign keys.

[0060] Based on the above content, since the data to be stored are stored in the corresponding data storage sub-tables respectively, and the data storage sub-tables correspond to the target data source, in this way, classified storage based on the target data source can be realized, and since the stored data includes not only the data to be stored and the timestamp information, but also the label information, and the label information is at least used to reflect the data source spatial characteristics of the target data source, so that in the subsequent data query process, data query can also be performed based on the data source spatial characteristics, so that the accuracy of the query can be improved to a certain extent, such as narrowing the query range by the data source spatial characteristics, etc., wherein, when the query range is narrowed, not only the accuracy can be improved, but also the timeliness can be improved, therefore, the problem of relatively poor reliability of data storage existing in the prior art can be improved, so that the data stored based on this data storage technology is more reliable in subsequent queries. In addition, since multiple data storage sub-tables will form corresponding data storage super tables in the target time series data for storage, more complex data models and query operations can be realized.

[0061] First, it should be noted that for step S110, the specific method of obtaining the data to be stored is not limited and can be selected according to actual needs.

[0062] For example, in an alternative implementation, the data obtained from the target data source may be directly used as the data to be stored, so that the efficiency of data storage may be higher.

[0063] For example, in another alternative implementation, data may be first obtained from the target data source, and then the data may be further processed, and the processed data may be used as the data to be stored, so that the reliability of the stored data may be higher. Further processing of the data may include data cleaning, removing outliers, filling missing values, data smoothing, etc.

[0064] On the second aspect, it should be noted that for step S120, the specific method of obtaining the timestamp information of the data to be stored and the tag information of the data to be stored is not limited and can be selected according to actual needs.

[0065] For example, in an alternative implementation, after the data is stored, in order to enable more accurate data query based on the tag information, the above-mentioned step S120 may further include step S121 and step S122, and the specific content of each step is described as follows.

[0066] Step S121 : for each of the plurality of data to be stored, obtain the timestamp information of the data to be stored, and obtain the position feature information and shape feature information of the target data source corresponding to the data to be stored.

[0067] In an embodiment of the present application, after the multiple data to be stored are obtained, the timestamp information of the data to be stored (such as the acquisition time, formation time, etc. of the data to be stored) can be obtained for each of the multiple data to be stored, and the position feature information and shape feature information of the target data source corresponding to the data to be stored can be obtained. Among them, the position feature information and the shape feature information are used to reflect the data source spatial characteristics of the corresponding target data source, that is, the characteristics of the target data source in space are characterized by the position feature information and the shape feature information. It can be understood that in other embodiments, only any one of the position feature information and the shape feature information can be obtained.

[0068] Step S122: determining the position feature information and shape feature information of the target data source as the corresponding label information of the data to be stored.

[0069] In the embodiment of the present application, after the location feature information and the shape feature information are obtained, the location feature information and the shape feature information of the target data source can be determined as the label information of the corresponding data to be stored. In this way, after the data is stored, corresponding data query can be performed based on the location feature information and the shape feature information.

[0070] It is understandable that what needs to be explained about step S121 is that the specific method of obtaining the position feature information and shape feature information of the target data source corresponding to the data to be stored is not limited and can be selected according to actual needs.

[0071] For example, in an alternative implementation, after the data is stored, in order to enable more accurate data query based on the tag information, the above-mentioned step S121 may further include step S121a and step S121b, and the specific content of each step is described as follows.

[0072] Step S121a, for each of the multiple data to be stored, obtain the timestamp information of the data to be stored, and obtain the longitude and latitude information and altitude information of the target data source corresponding to the data to be stored, and determine the longitude and latitude information and the altitude information as the location feature information of the target data source.

[0073] In an embodiment of the present application, after acquiring the multiple data to be stored, for each of the data to be stored, on the one hand, the timestamp information of the data to be stored can be acquired, and on the other hand, the longitude and latitude information and altitude information of the target data source corresponding to the data to be stored can be acquired. Then, the longitude and latitude information and the altitude information can be determined as the location feature information of the target data source. In this way, three-dimensional positioning of the target data source can be achieved.

[0074] Step S121b: determine the spatial range information covered by the target data source, and determine the spatial range information as the shape feature information of the target data source.

[0075] In an embodiment of the present application, after acquiring the multiple data to be stored, for each of the data to be stored, the spatial range information covered by the target data source corresponding to the data to be stored can also be acquired, and the spatial range information can be determined as the shape feature information of the target data source. Wherein, when the target data source belongs to an information acquisition device, the spatial range information is used to reflect the effective range of the information acquisition device for information acquisition, and at least includes the spatial shape and size information of the effective range. Exemplarily, the target data source can be a temperature sensor for collecting data on the temperature of the space in which it is located. In this way, for any temperature sensor, the collected temperature data can be stored through a corresponding data storage subtable, and multiple data storage subtables corresponding to multiple temperature sensors can be associated to form a corresponding data storage supertable, which can be used to reflect the overall temperature of the area where multiple temperature sensors are located.

[0076] It should be noted that the specific representation method of the spatial range information is not limited and can be selected according to actual needs. For example, for a regular space, it can be represented by a rectangular shape, a spherical shape, a regular polygon shape, etc., and can also be combined with the distance from the center point of the regular space to each edge or each face for auxiliary representation. For another example, for an irregular space, it can be represented by the location information of multiple edge points.

[0077] Thirdly, it should be noted that for step S130, the specific method of storing the data to be stored, the timestamp information corresponding to the data to be stored, and the tag information corresponding to the data to be stored in the corresponding data storage subtable is not limited and can be selected according to actual needs.

[0078] For example, in an alternative implementation, in order to ensure that each data to be stored can be reliably stored in the corresponding data storage sub-table, the above-mentioned step S130 may further include step S131, step S132 and step S133, and the specific content of each step is described as follows.

[0079] Step S131 : for each target data source among the multiple target data sources, determine whether there is a data storage sub-table corresponding to the target data source.

[0080] In an embodiment of the present application, for each of the multiple target data sources, it can be determined whether there is a data storage sub-table corresponding to the target data source. Generally speaking, when the data storage sub-table is not deleted due to an exception or other reasons, the constructed data storage sub-table will always exist. However, when the first data to be stored in the target data source needs to be stored, the data storage sub-table corresponding to the target data source may not currently exist.

[0081] Step S132, for each target data source that currently has a corresponding data storage sub-table, the data to be stored corresponding to the target data source among the multiple data to be stored, the timestamp information corresponding to the data to be stored, and the label information corresponding to the data to be stored are stored in the data storage sub-table corresponding to the target data source.

[0082] In an embodiment of the present application, after determining whether there is a data storage sub-table corresponding to the target data source, for each target data source that currently has a corresponding data storage sub-table, the data to be stored corresponding to the target data source among the multiple data to be stored, the timestamp information corresponding to the data to be stored, and the label information corresponding to the data to be stored can be stored in the data storage sub-table corresponding to the target data source.

[0083] Step S133, for each target data source that currently does not have a corresponding data storage sub-table, construct a data storage sub-table corresponding to the target data source, and store the data to be stored corresponding to the target data source among the multiple data to be stored, the timestamp information corresponding to the data to be stored, and the label information corresponding to the data to be stored in the data storage sub-table.

[0084] After determining whether there is a data storage sub-table corresponding to the target data source, for each target data source for which no corresponding data storage sub-table currently exists, a data storage sub-table corresponding to the target data source can be constructed first, and then the data to be stored corresponding to the target data source among the multiple data to be stored, the timestamp information corresponding to the data to be stored, and the label information corresponding to the data to be stored can be stored in the data storage sub-table.

[0085] It is understandable that what needs to be explained about step S132 is that, for each target data source that currently has a corresponding data storage sub-table, the specific storage method of the data corresponding to the target data source is not limited and can be selected according to actual needs.

[0086] For example, in an alternative implementation, in order to improve the orderliness of data storage and the reliability of subsequent data search, the above step S132 may further include the following steps:

[0087] For each target data source that currently has a corresponding data storage sub-table, you can perform the following operations on the target data source:

[0088] First, the data to be stored corresponding to the target data source among the multiple data to be stored can be stored in a data column of a data storage subtable corresponding to the target data source, wherein the data storage subtable at least includes a data column, a timestamp column, and a label column; illustratively, the data column can be one or more columns, which can be determined according to required data, the timestamp column can also be one or more columns, which can also be determined according to the data to be stored, and the label column can also be one or more columns, which can also be determined according to the data to be stored;

[0089] Secondly, the timestamp information corresponding to the data to be stored may be stored in the timestamp column in the data storage subtable corresponding to the target data source;

[0090] Then, the label information corresponding to the data to be stored is stored in the label column in the data storage subtable corresponding to the target data source, wherein the data to be stored corresponding to the target data source, the timestamp information corresponding to the data to be stored, and the label information corresponding to the data to be stored are stored in the same row in the data storage subtable; illustratively, for the data to be stored collected at the first time point, it can have timestamp information 1 and label information 1, so that the data to be stored, timestamp information 1 and label information 1 collected at the first time point can be stored in the first row of the data storage subtable; for the data to be stored collected at the second time point, it can have timestamp information 2 and label information 2 (generally speaking, label information 2 can be the same as label information 1, that is, the label information generally does not change), so that the data to be stored, timestamp information 2 and label information 2 collected at the second time point can be stored in the second row of the data storage subtable.

[0091] It is understandable that what needs to be explained about step S133 is that, for each target data source that currently does not have a corresponding data storage sub-table, the specific storage method of the data corresponding to the target data source is not restricted and can be selected according to actual needs.

[0092] For example, in an alternative implementation, in order to improve the orderliness of data storage and the reliability of subsequent data search, the above-mentioned step S133 may further include step S133a and step S133b, and the specific content of each step is described as follows.

[0093] Step S133a: for each target data source for which there is currently no corresponding data storage sub-table, a data storage sub-table corresponding to the target data source is constructed based on the data source spatial features corresponding to the target data source.

[0094] In an embodiment of the present application, for each of the target data sources, after determining that the target data source does not have a corresponding data storage subtable, if the data storage subtable corresponding to the target data source is deleted due to an exception or the like, or it is the first time that the data corresponding to the target data source is stored, the data storage subtable corresponding to the target data source can be constructed based on the data source spatial characteristics of the target data source. Wherein, the data storage subtable includes at least one row and multiple columns, and the multiple columns include at least a data column, a timestamp column, and a label column, the data column is used to store the data to be stored, the timestamp column is used to store timestamp information, and the label column is used to store label information. In this way, different data storage subtables can be constructed for different target data sources to achieve adaptation between the target data source and the data storage subtable.

[0095] Step S133b, after constructing the data storage subtable corresponding to the target data source, the data to be stored corresponding to the target data source, the timestamp information corresponding to the data to be stored and the label information corresponding to the data to be stored among the multiple data to be stored are stored in the same row of the data storage subtable.

[0096] In an embodiment of the present application, after constructing a data storage subtable corresponding to the target data source, the data to be stored corresponding to the target data source, the timestamp information corresponding to the data to be stored, and the tag information corresponding to the data to be stored among the multiple data to be stored can be stored in the same row of the data storage subtable, such as storing the data to be stored in the data column, storing the timestamp information in the timestamp column, and storing the tag information in the tag column.

[0097] Combination Figure 3 In a specific application example, a row in the data storage subtable may include a timestamp column (represented by "ts") for storing timestamp information, at least two data columns (represented by "data1" and "data2") for storing data to be stored, and at least five label columns (represented by "x", "y", "z", "r" and "type", where "x" represents longitude information, "y" represents latitude information, "z" represents height information, "r" represents the distance from the center point to any surface, and "type" represents a cube shape) for storing label information.

[0098] Combination Figure 4The embodiment of the present application also provides a data storage device based on a time series database that can be applied to the above electronic device. The data storage device based on a time series database can include a data acquisition module, a related information acquisition module and a data storage module.

[0099] In detail, the data acquisition module can be used to respectively acquire the data to be stored corresponding to each target data source, and obtain multiple data to be stored corresponding to multiple target data sources, wherein each of the target data sources is used to reflect the data source of the corresponding data to be stored. Figure 2 As shown in step S110, the relevant contents of the data acquisition module can refer to the above description of step S110.

[0100] In detail, the relevant information acquisition module can be used to obtain the timestamp information of each of the multiple data to be stored and the tag information of the data to be stored, wherein the tag information is used to reflect at least one data source spatial feature of the target data source. Figure 2 As shown in step S120, for the relevant content of the relevant information acquisition module, reference can be made to the above description of step S120.

[0101] In detail, the data storage module can be used to store, for each of the multiple data to be stored, the data to be stored, the timestamp information corresponding to the data to be stored, and the tag information corresponding to the data to be stored in a data storage sub-table corresponding to the target data source corresponding to the data to be stored, wherein in the data storage sub-table, the stored data is stored according to the time sequence represented by the corresponding timestamp information, and the data storage super table composed of the multiple data storage sub-tables is stored in the target time series database. In the embodiment of the present application, the data storage module can be used to execute Figure 2 As shown in step S130, for the relevant contents of the data storage module, reference may be made to the above description of step S130.

[0102] Exemplarily, in an alternative implementation, the relevant information acquisition module may be specifically used for:

[0103] For each of the plurality of data to be stored, obtaining timestamp information of the data to be stored, and obtaining location feature information and shape feature information of a target data source corresponding to the data to be stored, wherein the location feature information and the shape feature information are used to reflect the data source spatial features of the corresponding target data source;

[0104] The position feature information and shape feature information of the target data source are determined as the corresponding label information of the data to be stored.

[0105] Exemplarily, in an alternative implementation, the data storage module may be specifically used for:

[0106] For each target data source among the multiple target data sources, determining whether there is a data storage sub-table corresponding to the target data source;

[0107] For each target data source that currently has a corresponding data storage sub-table, the to-be-stored data corresponding to the target data source, the timestamp information corresponding to the to-be-stored data, and the tag information corresponding to the to-be-stored data among the multiple to-be-stored data are stored in the data storage sub-table corresponding to the target data source;

[0108] For each target data source for which there is currently no corresponding data storage sub-table, a data storage sub-table corresponding to the target data source is constructed, and the data to be stored corresponding to the target data source among the multiple data to be stored, the timestamp information corresponding to the data to be stored, and the label information corresponding to the data to be stored are stored in the data storage sub-table.

[0109] In an embodiment of the present application, corresponding to the above-mentioned data storage method based on a time series database applied to the electronic device, a computer-readable storage medium is also provided, in which a computer program is stored, and when the computer program is run, each step of the data storage method based on a time series database is executed.

[0110] Among them, the steps executed when the aforementioned computer program is running will not be described one by one here, and reference can be made to the previous explanation of the data storage method based on the time series database.

[0111] In summary, the data storage method and device, electronic device and medium based on the time series database provided by the present application can, firstly, respectively obtain the data to be stored corresponding to each target data source, and obtain multiple data to be stored corresponding to multiple target data sources; secondly, for each of the multiple data to be stored, obtain the timestamp information of the data to be stored and the label information of the data to be stored; then, for each of the multiple data to be stored, the data to be stored, the timestamp information corresponding to the data to be stored and the label information corresponding to the data to be stored can be stored in the data storage subtable corresponding to the target data source corresponding to the data to be stored. Based on the above content, since the data to be stored are stored in the corresponding data storage sub-tables respectively, and the data storage sub-tables correspond to the target data source, in this way, classified storage based on the target data source can be realized, and since the stored data includes not only the data to be stored and the timestamp information, but also the label information, and the label information is at least used to reflect the data source spatial characteristics of the target data source, so that in the subsequent data query process, data query can also be performed based on the data source spatial characteristics, so that the accuracy of the query can be improved to a certain extent, such as narrowing the query range by the data source spatial characteristics, etc., wherein, when the query range is narrowed, not only the accuracy can be improved, but also the timeliness can be improved, therefore, the problem of relatively poor reliability of data storage existing in the prior art can be improved, so that the data stored based on this data storage technology is more reliable in subsequent queries. In addition, since multiple data storage sub-tables will form corresponding data storage super tables in the target time series data for storage, more complex data models and query operations can be realized.

[0112] In several embodiments provided in the embodiments of the present application, it should be understood that the disclosed device and method can also be implemented in other ways. The device and method embodiments described above are merely schematic, for example, the flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the device, method and computer program product according to multiple embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.

[0113] In addition, the functional modules in the various embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.

[0114] If the function is implemented in the form of a software function module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, an electronic device, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a disk or an optical disk. It should be noted that, in this article, the term "include", "include" or any other variant thereof is intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements that are not explicitly listed, or also includes elements inherent to such a process, method, article or device. Without more constraints, an element defined by the phrase "comprising a..." does not exclude the existence of other identical elements in the process, method, article or apparatus comprising the element.

[0115] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims

1. A data storage method based on a time series database, characterized in that: include: Respectively obtain the data to be stored corresponding to each target data source, and obtain multiple data to be stored corresponding to multiple target data sources, wherein each of the target data sources is used to reflect the data source of the corresponding data to be stored; For each of the plurality of data to be stored, obtaining timestamp information of the data to be stored and label information of the data to be stored, wherein the label information is used to reflect at least one data source spatial feature of the target data source; For each of the multiple data to be stored, the data to be stored, the timestamp information corresponding to the data to be stored, and the label information corresponding to the data to be stored are stored in a data storage sub-table corresponding to the target data source corresponding to the data to be stored, wherein in the data storage sub-table, the stored data is stored according to the time series represented by the corresponding timestamp information, and the data storage super table composed of multiple data storage sub-tables is stored in the target time series database.

2. The data storage method based on the time series database according to claim 1 is characterized in that: The step of acquiring the timestamp information of each of the plurality of data to be stored and the tag information of the data to be stored comprises: For each of the plurality of data to be stored, obtaining timestamp information of the data to be stored, and obtaining location feature information and shape feature information of a target data source corresponding to the data to be stored, wherein the location feature information and the shape feature information are used to reflect the data source spatial features of the corresponding target data source; The position feature information and shape feature information of the target data source are determined as the corresponding label information of the data to be stored.

3. The data storage method based on the time series database according to claim 2 is characterized in that: The step of obtaining the timestamp information of each of the plurality of data to be stored, and obtaining the position feature information and shape feature information of the target data source corresponding to the data to be stored, comprises: For each of the plurality of data to be stored, obtaining timestamp information of the data to be stored, and obtaining longitude and latitude information and altitude information of a target data source corresponding to the data to be stored, and determining the longitude and latitude information and the altitude information as location feature information of the target data source; Determine the spatial range information covered by the target data source, and determine the spatial range information as the shape feature information of the target data source, wherein, when the target data source belongs to an information acquisition device, the spatial range information is used to reflect the effective range of information acquisition by the information acquisition device, and at least includes the spatial shape and size information of the effective range.

4. The data storage method based on a time series database according to claim 1, characterized in that: The step of storing, for each of the plurality of data to be stored, the data to be stored, the timestamp information corresponding to the data to be stored, and the tag information corresponding to the data to be stored in the data storage subtable corresponding to the target data source corresponding to the data to be stored, comprises: For each target data source among the multiple target data sources, determining whether there is a data storage sub-table corresponding to the target data source; For each target data source that currently has a corresponding data storage sub-table, the to-be-stored data corresponding to the target data source, the timestamp information corresponding to the to-be-stored data, and the tag information corresponding to the to-be-stored data among the multiple to-be-stored data are stored in the data storage sub-table corresponding to the target data source; For each target data source for which there is currently no corresponding data storage sub-table, a data storage sub-table corresponding to the target data source is constructed, and the data to be stored corresponding to the target data source among the multiple data to be stored, the timestamp information corresponding to the data to be stored, and the label information corresponding to the data to be stored are stored in the data storage sub-table.

5. The data storage method based on time series database according to claim 4 is characterized in that: The step of storing, for each target data source that currently has a corresponding data storage sub-table, the to-be-stored data corresponding to the target data source, the timestamp information corresponding to the to-be-stored data, and the tag information corresponding to the to-be-stored data among the multiple to-be-stored data in the data storage sub-table corresponding to the target data source, comprises: For each target data source that currently has a corresponding data storage sub-table, perform the following operations on the target data source: The data to be stored corresponding to the target data source among the plurality of data to be stored are stored in a data column of a data storage subtable corresponding to the target data source, wherein the data storage subtable includes at least a data column, a timestamp column, and a label column; The timestamp information corresponding to the data to be stored is stored in the timestamp column in the data storage subtable corresponding to the target data source; The label information corresponding to the data to be stored is stored in the label column in the data storage subtable corresponding to the target data source, wherein the data to be stored corresponding to the target data source, the timestamp information corresponding to the data to be stored, and the label information corresponding to the data to be stored are stored in the same row in the data storage subtable.

6. The data storage method based on a time series database according to claim 4 is characterized in that: The step of constructing a data storage sub-table corresponding to each target data source for which a corresponding data storage sub-table does not currently exist, and storing the data to be stored corresponding to the target data source, the timestamp information corresponding to the data to be stored, and the tag information corresponding to the data to be stored in the data storage sub-table among the multiple data to be stored, includes: For each target data source that currently does not have a corresponding data storage sub-table, a data storage sub-table corresponding to the target data source is constructed based on the data source spatial characteristics corresponding to the target data source, wherein the data storage sub-table includes at least one row and multiple columns, and the multiple columns include at least a data column, a timestamp column, and a label column, the data column is used to store data to be stored, the timestamp column is used to store timestamp information, and the label column is used to store label information; After constructing the data storage subtable corresponding to the target data source, the data to be stored corresponding to the target data source, the timestamp information corresponding to the data to be stored and the label information corresponding to the data to be stored among the multiple data to be stored are stored in the same row of the data storage subtable.

7. A data storage device based on a time series database, characterized in that: include: A data acquisition module is used to respectively acquire the data to be stored corresponding to each target data source, and obtain multiple data to be stored corresponding to multiple target data sources, wherein each of the target data sources is used to reflect the data source of the corresponding data to be stored; A related information acquisition module, used for acquiring, for each of the plurality of data to be stored, timestamp information of the data to be stored and label information of the data to be stored, wherein the label information is used to reflect at least one data source spatial feature of the target data source; A data storage module is used to store, for each of the multiple data to be stored, the data to be stored, the timestamp information corresponding to the data to be stored, and the label information corresponding to the data to be stored in a data storage sub-table corresponding to a target data source corresponding to the data to be stored, wherein in the data storage sub-table, the stored data is stored according to the time sequence represented by the corresponding timestamp information, and a data storage super table composed of multiple data storage sub-tables is stored in a target time series database.

8. The data storage device based on time series database according to claim 7, characterized in that: The relevant information acquisition module is specifically used for: For each of the plurality of data to be stored, obtaining timestamp information of the data to be stored, and obtaining location feature information and shape feature information of a target data source corresponding to the data to be stored, wherein the location feature information and the shape feature information are used to reflect the data source spatial features of the corresponding target data source; The position feature information and shape feature information of the target data source are determined as the corresponding label information of the data to be stored.

9. An electronic device, characterized in that: include: Memory for storing computer programs; A processor connected to the memory is used to execute a computer program stored in the memory to implement the data storage method based on a time series database as described in any one of claims 1 to 6.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is run, each step of the data storage method based on a time series database according to any one of claims 1 to 6 is executed.

Citation Information

Patent Citations

  • Time series data storage method and device, server and storage medium

    CN111125089A

  • Data storage method and device

    CN112925859A

  • Medical internet-of-things data storage method, storage medium, internet-of-things server and system

    CN117421356A

  • Method and apparatus for presenting printed media based on radio frequency memory tag detection

    US20120218084A1

  • Method and apparatus for multidimensional database using binary hyperspatial code

    US6161105A