Data management method and computing device

By distinguishing hash partitions based on data field characteristics and clustering data for storage, the problems of slow data query speed and high resource usage in the existing technology are solved, and fast query and efficient storage are achieved.

WO2024187996A1PCT designated stage expired Publication Date: 2024-09-19HUAWEI CLOUD COMPUTING TECHNOLOGIES CO LTD
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2024/075888
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-03-15
Filing Date
2024-02-05
Publication Date
2024-09-19

AI Technical Summary

Technical Problem

When the existing technology processes a large amount of data, querying data by traversing the database is slow and takes up a lot of read and write performance resources, making it difficult to meet the needs of real-time fast query.

Method used

By distinguishing hash partitions based on the field characteristics of the data to be written, data with the same characteristics in specific fields are clustered and stored, thereby quickly filtering out irrelevant partitions during query and improving the queryability of the data. Specific methods include obtaining the characteristic string of the data, determining its hash value, writing the data into the corresponding hash partition, and dynamically adjusting the hash partition strategy to comply with query frequency and timeliness.

Benefits of technology

It significantly improves the query speed and efficiency of data, reduces the resource occupation required for storage and query, and meets the needs of real-time and fast query.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024075888_19092024_PF_FP_ABST
    Figure CN2024075888_19092024_PF_FP_ABST
Patent Text Reader

Abstract

Embodiments of the present application relate to the field of data management, and provide a data management method and a computing device. The method comprises: acquiring first data, wherein the first data comprises N fields, and N is a positive integer greater than 1; generating a feature character string according to a partitioning policy, wherein the partitioning policy is used for indicating M fields for generating the feature character string among the N fields and for indicating an arrangement order of the M fields, and M is a positive integer less than N; determining a hash value of the first data according to the feature character string; and according to the hash value of the first data, writing all or some of the fields of the first data to a first hash partition of a database, wherein the database comprises a plurality of hash partitions. By means of the method, according to field features of data to be written, partitions to which said data is written are classified, so that data having the same features in specific fields can be clustered and stored, and a large number of irrelevant partitions can be rapidly filtered out during data query, thereby improving the queryability of stored data.
Need to check novelty before this filing date? Find Prior Art

Description

Method and computing device for managing data

[0001] This application claims priority to the Chinese patent application filed with the China Patent Office on March 15, 2023, with application number 202310250921.2 and application name “Method and computing device for managing data”, the entire contents of which are incorporated by reference into this application. Technical Field

[0002] Embodiments of the present application relate to the field of data management, and more specifically, to a method and computing device for managing data. Background Art

[0003] As internet technology continues to mature, all industries are becoming more digitized, generating massive amounts of data that need to be recorded constantly. For example, data recording device status or real-time business information is generated constantly and needs to be continuously recorded so that it can be queried and used for computational analysis when needed.

[0004] However, due to the huge amount of data, querying data by traversing the database is slow and requires a lot of read and write performance resources, making it difficult to meet the demand for real-time and fast data query. Therefore, how to store data so that it can be queried quickly has become a technical problem that needs to be solved urgently.

[0005] Summary of the Invention

[0006] The embodiments of the present application provide a method and computing device for managing data, which can distinguish the partitions to which data is written based on the field characteristics of the data to be written, so that data with the same characteristics in specific fields are clustered and stored, thereby quickly filtering out a large number of irrelevant partitions when querying data, thereby improving the queryability of stored data.

[0007] In a first aspect, a method for managing data is provided, comprising: obtaining first data, the first data including N fields, where N is a positive integer greater than 1; generating a feature string according to a partitioning strategy, wherein the partitioning strategy is used to indicate M fields of the N fields used to generate the feature string and an arrangement order of the M fields, where M is a positive integer less than N; determining a hash value of the first data according to the feature string; and writing all or part of the fields of the first data into a first hash partition of a database according to the hash value of the first data, wherein the database includes multiple hash partitions, different hash partitions correspond to different hash values, and the first hash partition is a hash partition corresponding to the hash value of the first data.

[0008] Specifically, the feature string consists of M fields, and the order of the M fields in the feature string is the same as the order indicated by the partitioning strategy.

[0009] Optionally, the first data may be time series data.

[0010] According to the technical solution provided in the present application, by clustering and storing data according to the characteristic values ​​of the fields, data with the same characteristics in a specific field can be clustered and stored in the same hash partition, so that when querying data, a large amount of data stored in hash partitions that are irrelevant to the query conditions can be quickly filtered out, thereby improving the ability of stored data to be quickly queried.

[0011] In combination with the first aspect, in certain implementations of the first aspect, the M fields and the arrangement order of the M fields are determined according to the query frequency of the N fields.

[0012] According to the above technical solution, by selecting specific fields as feature fields for hash partitioning based on the query frequency of the fields and determining the arrangement order of the feature fields, the hash partitioning method is made to match the range of possible query conditions as much as possible, thereby improving the effectiveness of filtering data based on hash partitioning and further improving the ability of stored data to be quickly queried.

[0013] In combination with the first aspect, in certain implementations of the first aspect, the method further includes: obtaining the query frequency of the N fields within the target time period; and updating the partitioning strategy according to the query frequency of the N fields within the target time period.

[0014] According to the above technical solution, by adjusting the hash partitioning strategy based on the frequency of field queries in real-time feedback, the hash partitioning strategy is made more time-effective, and the hash partitioning method of newly written data can better meet the query requirements of the field, thereby realizing dynamic hash partitioning and further improving the ability of stored data to be quickly queried.

[0015] In combination with the first aspect, in certain implementations of the first aspect, when the first data is time series data, the N fields include at least one time field, at least one constant field, and at least one variable field, and the M fields are all or part of the fields in at least one constant field.

[0016] According to the above technical solution, by using a constant field that does not change with time as a characteristic field for determining a hash partition, data stored in the same hash partition is more likely to have the same characteristic field value, thereby improving the effect of data clustering storage.

[0017] In combination with the first aspect, in certain implementations of the first aspect, the database also includes a constant data table, and the method also includes: determining an identification value of the first data based on all constant fields of the first data, wherein the identification value of the first data is different from the identification value of the second data, the second data is data stored in the database, and the value of the constant field of the second data is different from the value of the constant field of the first data; and storing the mapping relationship between the identification value of the first data and all constant fields of the first data in the constant data table.

[0018] According to the above technical solution, by storing constant fields with high repetition and corresponding identification values ​​as auxiliary tables, it is possible to easily filter the values ​​of constant fields when querying data, saving storage space and improving data query efficiency.

[0019] In combination with the first aspect, in certain implementations of the first aspect, determining the identification value of the first data based on all constant fields of the first data includes: determining the identification value of the first data based on all constant fields of the first data and the hash value of the first data, wherein the identification value of the first data is different from the identification value of the third data, the hash value of the third data is different from the hash value of the first data, and the hash value of the first data can be determined based on the identification value of the first data.

[0020] According to the above technical solution, by assigning different identification values ​​to data in different hash partitions, the hash partition to which the data belongs can be inferred based on the identification value, eliminating the need to store the data's hash value, further saving storage space. Furthermore, the identification value assignment only considers the data in the current hash partition, improving data storage efficiency.

[0021] In combination with the first aspect, in certain implementations of the first aspect, writing all or part of the fields of the first data into the first hash partition of the database includes: writing at least one time field and at least one variable field of the first data into the first hash partition; the method also includes: writing the identification value of the first data into the first hash partition.

[0022] According to the above technical solution, by storing constant fields with high repetition and corresponding identification values ​​as auxiliary tables, the identification values ​​of integers are stored in the main database for storing data instead of a large number of repeated constant fields, thereby reducing the space required for storing data.

[0023] In combination with the first aspect, in certain implementations of the first aspect, the method further includes: obtaining a query condition, the query condition being used to query fourth data in the database; determining at least one second hash partition based on the query condition, the at least one second hash partition being a hash partition that may store the fourth data; and determining the fourth data in the at least one second hash partition based on the query condition.

[0024] According to the technical solution provided in this application, by screening hash partitions that may store target data according to query conditions, a large number of hash partitions that store clustered data that do not meet the query conditions can be pruned, thereby reducing the amount of data to be queried and improving the efficiency of querying data.

[0025] In combination with the first aspect, in certain implementations of the first aspect, the query condition includes a constant filtering condition, which is used to indicate the value of all or part of the constant field of the fourth data. Based on the query condition, at least one second hash partition is determined, including: querying the constant data table based on the value of all or part of the constant field of the fourth data to determine the identification value of the fourth data; and determining the hash value of the fourth data based on the identification value of the fourth data.

[0026] According to the above technical solution, by first filtering the value range of the constant field in the auxiliary table that stores the mapping relationship between the constant field and the identification value, and then filtering the hash partition in the main database storing the data according to the corresponding identification value, the time required to retrieve a large amount of repeated constant data can be reduced, thereby improving the efficiency of querying data.

[0027] In combination with the first aspect, in certain implementations of the first aspect, determining the fourth data in at least one second hash partition according to the query condition includes: determining the fourth data in at least one second hash partition according to an identification value of the fourth data.

[0028] According to the above technical solution, when the identification value of the target data has been determined, data can be further screened within the determined hash partition according to the identification value, thereby pruning data within the hash partition that does not meet the query conditions.

[0029] In combination with the first aspect, in certain implementations of the first aspect, the query condition includes a variable filtering condition and / or a time filtering condition, the variable filtering condition is used to indicate the value of the variable field of the fourth data, and the time filtering condition is used to indicate the value of the time field of the fourth data. According to the identification value of the fourth data, the fourth data is determined in at least one second hash partition, including: according to the identification value of the fourth data, at least one candidate data is determined in the at least one second hash partition; according to the value of the variable field of the fourth data and / or the value of the variable field of the fourth data, the fourth data is determined from at least one candidate data.

[0030] According to the above technical solution, when the target data cannot be completely filtered out based on the identification value, the data can be further filtered within the determined hash partition based on the query conditions for other fields except the constant field in the query conditions, thereby further pruning the data in the hash partition that does not meet the query conditions.

[0031] In combination with the first aspect, in certain implementations of the first aspect, when the query condition includes the value of a partial constant field of the fourth data, the method further includes: reading a post-read constant field of the fourth data from a constant data table according to the identification value of the fourth data, the post-read constant field being a constant field not included in the query condition.

[0032] According to the above technical solution, after determining the query data that meets the conditions, the reading efficiency of the target data can be improved by reading the column value in the constant field from an auxiliary table with smaller data volume and easier to read according to the identification value, while saving the read and write performance resources of the data storage system.

[0033] In a second aspect, a computing device for managing data is provided, including: a data acquisition module for acquiring first data, the first data including N fields, where N is a positive integer greater than 1; a dynamic index module for generating a feature string according to a partitioning strategy, wherein the partitioning strategy is used to indicate M fields among the N fields used to generate the feature string and the arrangement order of the M fields, where M is a positive integer less than N; a partitioning module for determining a hash value of the first data according to the feature string; a storage module for writing all or part of the fields of the first data into a first hash partition of a database according to the hash value of the first data, wherein the database includes multiple hash partitions, different hash partitions correspond to different hash values, and the first hash partition is a hash partition corresponding to the hash value of the first data.

[0034] In combination with the second aspect, in certain implementations of the second aspect, the M fields and the arrangement order of the M fields are determined according to the query frequency of the N fields.

[0035] In combination with the second aspect, in some implementations of the second aspect, the dynamic index module is further used to: obtain the query frequency of N fields in the target time period; and update the partitioning strategy according to the query frequency of N fields in the target time period.

[0036] In combination with the second aspect, in certain implementations of the second aspect, the N fields include at least one time field, at least one constant field, and at least one variable field, and the M fields are all or part of the fields in the at least one constant field.

[0037] In combination with the second aspect, in certain implementations of the second aspect, the database also includes a constant data table and a storage module, which is also used to: determine the identification value of the first data based on all constant fields of the first data, wherein the identification value of the first data is different from the identification value of the second data, the second data is data stored in the database, and the value of the constant field of the second data is different from the value of the constant field of the first data; and store the mapping relationship between the identification value of the first data and all constant fields of the first data in the constant data table.

[0038] In combination with the second aspect, in certain implementations of the second aspect, the storage module is used to: determine an identification value of the first data based on all constant fields of the first data and a hash value of the first data, wherein the identification value of the first data is different from the identification value of the third data, the hash value of the third data is different from the hash value of the first data, and the hash value of the first data can be determined based on the identification value of the first data.

[0039] In combination with the second aspect, in some implementations of the second aspect, the storage module is used to: write at least one time field and at least one variable field of the first data into the first hash partition; and write the identification value of the first data into the first hash partition.

[0040] In combination with the second aspect, in some implementations of the second aspect, the computing device further includes: a condition acquisition module for acquiring query conditions, the query conditions being used to query fourth data in the database; a first query module for determining at least one second hash partition based on the query conditions, the at least one second hash partition being a hash partition that may store the fourth data; and a second query module for determining the fourth data in at least one second hash partition based on the query conditions.

[0041] In combination with the second aspect, in certain implementations of the second aspect, the query condition includes the value of all or part of the constant field of the fourth data, and the first query module is used to: query the constant data table based on the value of all or part of the constant field of the fourth data to determine the identification value of the fourth data; and determine the hash value of the fourth data based on the identification value of the fourth data.

[0042] In combination with the second aspect, in some implementations of the second aspect, the second query module is used to: determine the fourth data in at least one second hash partition according to an identification value of the fourth data.

[0043] In combination with the second aspect, in certain implementations of the second aspect, the query condition also includes the value of the variable field of the fourth data and / or the value of the time field of the fourth data, and the second query module is used to: determine at least one candidate data in at least one second hash partition based on the identification value of the fourth data; determine the fourth data from at least one candidate data based on the value of the variable field of the fourth data and / or the value of the variable field of the fourth data.

[0044] In combination with the second aspect, in certain implementations of the second aspect, when the query condition includes the value of some constant fields of the fourth data, the second query module is also used to: read the post-read constant field of the fourth data from the constant data table according to the identification value of the fourth data, and the post-read constant field is a constant field not included in the query condition.

[0045] In a third aspect, a computing device is provided, comprising a processor and a memory, wherein the memory is used to store instructions, and the processor is used to call and execute the instructions from the memory, so that the computing device executes the method in the first aspect or any possible implementation of the first aspect.

[0046] In a fourth aspect, a computing device cluster is provided, comprising at least one computing device, each computing device comprising a processor and a memory, wherein the memory is used to store instructions, and the processor is used to call and execute the instructions from the memory, so that the computing device cluster executes the method in the first aspect or any possible implementation of the first aspect.

[0047] Optionally, the processor may be a general-purpose processor, which may be implemented in hardware or software. When implemented in hardware, the processor may be a logic circuit, an integrated circuit, or the like; when implemented in software, the processor may be a general-purpose processor implemented by reading software code stored in a memory, which may be integrated into the processor or located independently of the processor.

[0048] In a fifth aspect, a chip is provided, which obtains instructions and executes the instructions to implement the method in the above-mentioned first aspect or any possible implementation manner of the first aspect.

[0049] Optionally, as an implementation, the chip includes a processor and a data interface, and the processor reads instructions stored in the memory through the data interface to execute the method in the above-mentioned first aspect or any possible implementation of the first aspect.

[0050] Optionally, as an implementation method, the chip may also include a memory, in which instructions are stored, and the processor is used to execute the instructions stored in the memory. When the instructions are executed, the processor is used to execute the method in the above-mentioned first aspect or any possible implementation method of the first aspect.

[0051] In a sixth aspect, a computer program product comprising instructions is provided. When the instructions are executed by a computing device cluster, the computing device cluster executes the method in the first aspect or any possible implementation of the first aspect.

[0052] In a seventh aspect, a computer-readable storage medium is provided, comprising computer program instructions. When the computer instructions are executed by a computing device cluster, the computing device cluster executes the method in the above-mentioned first aspect or any possible implementation manner of the first aspect.

[0053] By way of example, these computer-readable storage media include, but are not limited to, one or more of the following: read-only memory (ROM), programmable ROM (PROM), erasable PROM (EPROM), Flash memory, electrically EPROM (EEPROM), and a hard drive.

[0054] Optionally, as an implementation manner, the above-mentioned storage medium may specifically be a non-volatile storage medium. BRIEF DESCRIPTION OF THE DRAWINGS

[0055] FIG1 is a schematic diagram of a column storage compression unit provided in an embodiment of the present application.

[0056] FIG2 is a schematic diagram of a compression unit descriptor table provided in an embodiment of the present application.

[0057] FIG3 is a schematic diagram of a cloud system applied in the cloud field provided by an embodiment of the present application.

[0058] FIG4 is a schematic flowchart of a method for managing data provided in an embodiment of the present application.

[0059] FIG5 is a schematic diagram of an identification value allocation process provided in an embodiment of the present application.

[0060] FIG6 is a schematic diagram of a row-column hybrid storage structure provided in an embodiment of the present application.

[0061] FIG7 is a schematic flowchart of another method for managing data provided in an embodiment of the present application.

[0062] FIG8 is a schematic diagram of a process of querying data from a row-column hybrid storage database provided in an embodiment of the present application.

[0063] FIG9 is a schematic structural block diagram of a computing device for managing data provided in an embodiment of the present application.

[0064] FIG10 is a schematic structural block diagram of another computing device for managing data provided in an embodiment of the present application.

[0065] FIG11 is a schematic structural block diagram of a computing device provided in an embodiment of the present application.

[0066] FIG12 is a schematic structural block diagram of a computing device cluster provided in an embodiment of the present application.

[0067] FIG13 is a schematic structural block diagram of another computing device cluster provided in an embodiment of the present application. DETAILED DESCRIPTION

[0068] The technical solutions in the embodiments of the present application will be described below with reference to the accompanying drawings.

[0069] This application will present various aspects, embodiments, or features around systems including multiple devices, components, modules, etc. It should be understood and appreciated that each system may include additional devices, components, modules, etc., and / or may not include all of the devices, components, modules, etc. discussed in conjunction with the figures. Furthermore, combinations of these aspects may also be used.

[0070] Additionally, in the embodiments of this application, words such as "exemplary" and "for example" are used to indicate examples, illustrations, or descriptions. Any embodiment or design described in this application as "exemplary" should not be construed as being preferred or advantageous over other embodiments or designs. Rather, the use of the word "exemplary" is intended to present concepts in a concrete manner.

[0071] In the embodiments of the present application, “corresponding” and “relevant” may sometimes be used interchangeably. It should be noted that when the distinction between them is not emphasized, the meanings they intend to express are consistent.

[0072] The network architecture and business scenarios described in the embodiments of the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present application, and do not constitute a limitation on the technical solutions provided in the embodiments of the present application. A person skilled in the art will appreciate that, with the evolution of the network architecture and the emergence of new business scenarios, the technical solutions provided in the embodiments of the present application are equally applicable to similar technical problems.

[0073] References to "one embodiment" or "some embodiments" in this specification mean that a particular feature, structure, or characteristic described in conjunction with that embodiment is included in one or more embodiments of the present application. Thus, phrases such as "in one embodiment," "in some embodiments," "in other embodiments," and "in yet other embodiments" appearing in various places in this specification do not necessarily refer to the same embodiment, but rather mean "one or more but not all embodiments," unless otherwise specifically emphasized. The terms "including," "comprising," "having," and variations thereof mean "including but not limited to," unless otherwise specifically emphasized.

[0074] In this application, "at least one" means one or more, and "more" means two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: including the existence of A alone, the existence of A and B at the same time, and the existence of B alone, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following items" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b, or c can mean: a, b, c, ab, ac, bc, or abc, where a, b, c can be single or multiple.

[0075] To facilitate understanding, the following first introduces relevant terms and concepts that may be involved in the embodiments of this application.

[0076] 1. Internet of Things (IoT): The IoT, short for "the Internet of Everything," is an extension and expansion of the internet. It combines various information sensing devices with networks to form a vast network, enabling the interconnection of people, machines, and things at any time and anywhere. Using various devices and technologies, such as information sensors, radio frequency identification (RFID), global positioning systems (GPS), infrared sensors, and laser scanners, the IoT collects real-time information about any object or process that requires monitoring, connection, or interaction. This information includes acoustic, optical, thermal, electrical, mechanical, chemical, biological, and location information. Through various possible network access options, the IoT enables ubiquitous connectivity between objects and between objects and people, enabling intelligent perception, identification, and management of objects and processes.

[0077] 2. Application Performance Management (APM): APM monitors application performance to measure whether it meets the expected user experience and performance metrics. By collecting, aggregating, analyzing, and presenting real-time data, APM provides a constant understanding of the application's operational status. This enables full-stack performance monitoring and end-to-end traceability and diagnosis, helping operations personnel identify performance bottlenecks and anomalies in the system, ensuring a high-quality user experience.

[0078] 3. Time series data: Time series data is used to describe the changing state of information on various dimensions of an object over time. Time series data can be generated from multiple different individuals, each of which includes different attributes. These attributes can include attributes that only reflect differences between individuals and are unrelated to individual state changes, as well as attributes that reflect individual state changes. Based on the characteristics of time series data, time series data fields are divided into three types:

[0079] (1) Time field: indicates the timestamp of the data sampling time, which can also be called the time column of the data;

[0080] (2) Constant field: A field that represents the source of the data source or inherent attribute information. The value of this field is relatively stable and is only related to individual differences. It does not change with the change of the time field. It can also be called the tag column of the data;

[0081] (3) Variable field: A field that represents the data sampling dimension, which changes with the time field and can also be called the field column of the data.

[0082] 4. Row-based storage and column-based storage: Row-based storage and column-based storage are the two mainstream storage methods for distributed databases. Row-based storage, like traditional relational databases, stores data by row, with each row containing all fields for a piece of data. Therefore, querying a specific field requires reading all fields, resulting in slow queries and high resource usage.

[0083] Column storage stores data by column. Each column corresponds to a field of data and is stored in a separate storage unit. Therefore, when querying a specific field of data, only the column corresponding to that field needs to be read, eliminating the need to read other columns. This reduces unnecessary read and write resources and improves query efficiency. Furthermore, because each column stores the same field, the data characteristics are similar and suitable for compression, giving column storage a higher compression ratio than row storage.

[0084] The basic storage unit of column storage is called a compression unit (CU), which is a compressed data module consisting of a portion of a column in a table. Figure 1 shows a schematic diagram of a column storage compression unit. As shown in Figure 1, 60,000 data items in each field correspond to a CU, and each CU is distinguished by its corresponding field column and the row interval in which it is located. For example, rows 1 to 60,000 of the "Space Name" field are stored in a CU, col1 represents the number of the field column corresponding to the CU, and 1001 represents the number of the row interval corresponding to the CU.

[0085] To manage CUs in a column store database, the column store engine uses a compression unit descriptor (CUDesc) table to record basic CU information. Figure 2 shows a schematic diagram of a compression unit descriptor table. As shown in Figure 2, each CU corresponds to a row of data in the CUDesc table, which includes but is not limited to the following:

[0086] (1) Column number (col_id) and row interval number (cu_id): col_id indicates the number of the field column corresponding to the CU, for example, col1 to col5 in the example shown in Figure 1 correspond to col_id 1 to 5, and cu_id indicates the number of the row interval corresponding to the CU, for example, 1001 and 1002 in the example shown in Figure 1. The col_id and cu_id can be used to locate the position of the CU in the column storage data table;

[0087] (2) Minimum value (min) and maximum value (max): min and max are used to represent the minimum and maximum values ​​of all data in the CU, respectively. Based on min and max, the CU where the target data may be located can be screened according to the value range of the query field without decompressing the specific data in the CU;

[0088] (3) Pointer (cu_pointer): used to indicate the pointer position within the CU;

[0089] (4) Compression mode (cu_mode): used to indicate the data compression mode of the CU.

[0090] When querying column store data, you can access the corresponding CU data information by accessing the CUDesc record.

[0091] As internet technology matures, industries are increasingly informatizing, generating a growing amount of data. For example, in the IoT sector, data records device status, while in the APM sector, real-time data records business information. This data is generated and recorded constantly, requiring real-time query capabilities to provide a foundation for services like device monitoring, business analysis and prediction, and fault diagnosis.

[0092] Querying data by traversing the database is slow and requires significant read and write resources, making it difficult to meet the demand for fast, real-time data queries. Switching from row-based storage to column-based storage can improve data query speeds. However, due to the sheer volume of data, even reading only the data in the columns corresponding to specific fields requires decompression and access to a large number of CUs, making it unsuitable for business scenarios like IoT and APM that generate massive amounts of time-series data. Therefore, how to store data in a way that allows for fast querying has become a pressing technical challenge.

[0093] In view of this, an embodiment of the present application provides a method for managing data, by determining the partition to which the data is written based on the field characteristics of the data to be written, so that data with the same field characteristics in a specific field are clustered and stored in the same CU as much as possible, so that a large number of irrelevant CUs can be quickly filtered out when querying data, thereby improving the queryability of the stored data.

[0094] The data management method of the embodiment of the present application can be applied in the field of cloud computing, for example, scenarios related to cloud storage services such as data warehouses. Figure 3 shows a schematic diagram of a cloud system in the cloud field in which the embodiment of the present application is applied.

[0095] As shown in Figure 3, cloud management platform 310 is used to manage the infrastructure that provides multiple cloud services. This infrastructure includes multiple cloud data centers, each of which includes multiple servers. Each server contains cloud service resources and provides corresponding cloud services to tenants. Cloud services can include cloud storage services, such as data warehouses, and cloud services based on cloud storage services, such as online analytical processing (OLAP) services and complex event processing (CEP) services.

[0096] The cloud management platform 310 provides an access interface (such as an interface or application program interface (API)). Tenants can operate the client remote access access interface to register a cloud account and password on the cloud management platform and log in to the cloud management platform. After the cloud management platform successfully authenticates the cloud account and password, the tenant can further pay to select and purchase a virtual machine with specific specifications (processor, memory, disk) on the cloud management platform. After the payment is successful, the cloud management platform provides the remote login account and password of the purchased virtual machine. The client can remotely log in to the virtual machine and use the cloud services provided by the cloud service provider in the virtual machine.

[0097] The functions of the cloud management platform 310 include, but are not limited to, a user console, computing management services, network management services, storage management services, authentication services, and image management services. The user console provides an interface or API for interacting with tenants. The computing management service manages servers running virtual machines and containers, as well as bare metal servers. The network management service manages network services (such as gateways and firewalls). The storage management service manages storage services (such as data bucket services). The authentication service manages tenant accounts and passwords. The image management service manages virtual machine images.

[0098] Tenants can use client 330 to log in to cloud management platform 310 through Internet 320 to store or query data in the cloud data center. Cloud management platform 310 can execute the data management method of the embodiment of the present application.

[0099] The data management method of the present application is described in detail below with reference to FIG4 .

[0100] Figure 4 shows a schematic flow chart of a method for managing data provided in an embodiment of the present application. Optionally, the method of Figure 4 can be executed by a cluster of computing devices, such as the cloud management platform 310 in Figure 3 above. It should be understood that the embodiments of the present application are only illustrated by taking the execution of the method for managing data in a cloud scenario as an example, such as a scenario in which a cloud management platform provides data partitioning and query functions for a data warehouse cloud service, but it is not limited to being executed by a cloud management platform. The method for managing data provided in the embodiments of the present application can also be executed by other computing devices, such as a processor or a device containing a processor. For the sake of brevity, some embodiments of the present application are described below using the cloud management platform as an example of the execution subject, but those skilled in the art will understand that this description does not constitute a limitation on the scope of the present application.

[0101] As shown in FIG4 , the method includes the following steps.

[0102] S410: Acquire first data.

[0103] For example, in step S410, the cloud management platform may obtain first data, which is data to be written to the database. The data to be written may be input by a user through the cloud management platform, or may be generated by other devices or services, such as a virtual machine, a database, the Internet, a message queue, or an application, etc., which is not specifically limited in this application. By way of example and not limitation, in a data warehouse system, the data to be written may be collected by an agent module and pushed to the cloud management platform.

[0104] S420: Generate a characteristic character string according to the partitioning strategy.

[0105] For example, in step S420, the cloud management platform may generate a characteristic string of the data to be written based on at least some of the fields of the data to be written. For example, the data to be written may include N fields, where N is a positive integer greater than 1. The partitioning strategy is used to indicate the M fields of the N fields of the data to be written that are used to generate the characteristic string and the arrangement order of the M fields. The selected M fields are spliced ​​in the order indicated by the partitioning strategy to form the characteristic string of the data to be written. The characteristic string can determine the hash value of the data to be written through a hash operation.

[0106] S430: Determine a hash value of the first data according to the characteristic character string.

[0107] For example, in step S430, the cloud management platform may perform a hash operation on the characteristic string of the data to be written generated in S420 to obtain the hash value of the data to be written, thereby determining the hash partition to which the data to be written is to be written. Specifically, the hash value of the data may be mapped to the hash partition. As an example and not a limitation, the cloud management platform may divide the database storing the data into K hash partitions, and the output value of the string hash function may be a positive integer in the range of 1 to K, corresponding to the K hash partitions. The string hash function outputs a positive integer N in the range of 1 to K as a hash value based on the input characteristic string, which corresponds to a specific hash partition. For example, data with a hash value of N is stored in the Nth hash partition in the database. According to the common characteristics of hash functions, the same input can obtain the same output, so that data with the same characteristic string can be divided into the same hash partition. The embodiments of the present application do not limit the algorithm of the string hash function used, for example, it can be Robert Sedgwicks (RS) algorithm, Justin Sobel (JS) algorithm, Brian Kernighan & Dennis Ritchie (BKDR) algorithm, etc.

[0108] As an example and not a limitation, the string hash function can convert the input string into an integer according to a unified rule. For example, each character is converted into its corresponding American Standard Code for Information Interchange (ASCII) and the integer corresponding to the string is calculated based on the number of bits of the character in the string. The string hash function can determine the length of the hash table according to the number of hash partitions, thereby determining the final output hash value. For example, assuming that the database is divided into 32 hash partitions, the string hash function can use the remainder of the integer modulo 32 obtained by ASCII code conversion as the output hash value, for example, the hash value corresponding to 11111111 is 7. The above example is only for explaining the role of the hash function. The embodiment of the present application does not specifically limit the encoding method of the hash function and the specific clustering method after encoding.

[0109] S440: Writing all or part of the fields of the first data into the first hash partition according to the hash value of the first data.

[0110] For example, in step S440, the cloud management platform may store the data to be written in the corresponding hash partition of the database based on the hash value of the data to be written determined in S430. For example, the positive integers of hash values ​​1 to K may correspond to the K hash partitions included in the database, respectively. For data with a hash value of 1, the cloud management platform may store it in hash partition 1, and correspondingly, for data with a hash value of 3, the cloud management platform may store it in hash partition 3.

[0111] Optionally, the data in each hash partition in the database can be stored in column storage.

[0112] It should be understood that the above-mentioned hash partitioning is a partitioning method higher than CU in column storage. Each hash partition can include at least one group of CUs, where a group of CUs refers to a set composed of at least one CU, and each CU in a group corresponds to a column of a different field of data. That is, data belonging to the same CU must belong to the same hash partition, but data in the same hash partition may be located in different CUs. For example, each CU can store 60,000 data. For hash partition 1, when the 60,001th data is divided into hash partition 1, a group of CUs is already stored in hash partition 1. At this time, hash partition 1 can create a new group of CUs to continue storing the data written to hash partition 1. The new group of CUs and the above-mentioned fully stored CUs all belong to hash partition 1.

[0113] Through the technical solution of the embodiment of the present application, data is clustered and stored according to the characteristic values ​​of the fields, so that data with the same characteristics in a specific field are stored in the same hash partition. Therefore, when querying data, a large amount of data stored in hash partitions that are irrelevant to the query conditions can be quickly filtered out, thereby improving the ability of stored data to be quickly queried.

[0114] It should be understood that the data partitioning method provided in the embodiments of the present application can store data with the same characteristic fields under the same access policy in the same hash partition. However, not all data stored in the same hash partition necessarily has the same characteristic fields. In other words, when determining hash partitions based on characteristic fields, due to the limited number of hash partitions, data with different characteristic strings may also receive the same hash value and thus be assigned to the same hash partition. This application does not impose any restrictions on this.

[0115] The purpose of clustering and storing data is to facilitate querying, that is, according to the input field query conditions, the target data is distributed in the same hash partition as much as possible. Therefore, for the above step S420, in some possible implementations, the partitioning strategy is determined according to the query frequency of each field. For example, the cloud management platform can select the M most frequently queried fields among all N fields of the data as feature fields for generating feature strings. By using frequently queried fields as the basis for dividing hash partitions, data is clustered and stored according to fields with a high probability of being queried, thereby increasing the probability that the target data is located in the same hash partition when querying.

[0116] The following describes a partitioning strategy based on query frequency using a specific example. As an example, and not a limitation, a partitioning strategy can specify that all data fields are sorted by query frequency from highest to lowest, and the top three fields are selected and sequentially concatenated to form a signature string. Assuming the selected signature fields are "Device Name," "Resource Utilization," and "Location," the resulting signature string would be "Memory 80% Shanghai," representing that the device is a memory device, its resource utilization is 80%, and its location is Shanghai. Since data with the same hash value are stored in the same hash partition, if a user's next query includes values ​​for all three fields, such as "Device Name," "Resource Utilization," and "Location," for example, "Which processors in Shanghai had a 0% utilization rate on December 1st?", the target data in the query result will be distributed in the same hash partition. If a user's query includes some of the signature fields, such as "Which memory devices are located in Jiangsu?", the target data may be distributed in one or more hash partitions with the same "Device Name" and "Location" but different "Resource Utilization," which can also narrow the scope of the target hash partition. It can be seen that the determination of the partitioning strategy, that is, whether the selection of feature fields fits the user's query requirements, determines the effect of data clustering.

[0117] Through the technical solution of the embodiments of the present application, specific fields are selected as feature fields for hash partitioning and the arrangement order of the feature fields is determined based on the query frequency of the fields, so that the hash partitioning is consistent with the range of possible query conditions as much as possible, thereby improving the effectiveness of filtering data based on hash partitioning and further improving the ability of stored data to be quickly queried.

[0118] For the above-mentioned technical solution of determining the partitioning strategy based on the query frequency of the field, the query frequency of different fields may also be continuously updated and dynamically changed according to the real-time query situation of the data. Therefore, in some possible implementations, the cloud management platform can dynamically update the partitioning strategy based on the query frequency of the field within a period of time. Specifically, the cloud management platform can obtain the query frequency of each field of the data in the first time period, and update the partitioning strategy based on the query frequency. Optionally, the first time period can be a period of time before the partitioning strategy is updated, such as the field query frequency within 3 days before the partitioning strategy is updated. The specific method of determining the partitioning strategy based on the field query frequency can be the same as the solution described above. It should be understood that the new data to be written obtained after the partitioning strategy is updated is hash partitioned according to the new partitioning strategy, but the new partitioning strategy does not affect the hash partitioning of the data already stored in the database.

[0119] Through the technical solution of the embodiment of the present application, the hash partitioning strategy is adjusted according to the query frequency of the field fed back in real time, so that the hash partitioning strategy is more time-effective, and the hash partitioning method of the newly written data can better meet the query requirements, thereby realizing dynamic hash partitioning and further improving the ability of stored data to be quickly queried.

[0120] The data management method provided by the embodiment of the present application shown in FIG4 can also be applied to time series data. As previously mentioned, time series data has a time field, a constant field, and a variable field. Based on the characteristics of each field in time series data, it can be seen that the constant field reflects the inherent properties of the data and its quantity and changes are relatively stable. Therefore, for time series data, hash partitioning based on the constant field of the data can achieve better cluster storage effects.

[0121] In this case, in some possible implementations of step S420, the field used to generate the characteristic string is selected from a constant field in the data. By using a constant field that does not change over time as a characteristic field for determining a hash partition, data stored in the same hash partition is more likely to have the same characteristic field value, thereby improving the effect of clustering and storing time series data.

[0122] In other embodiments, the fields for generating the feature string may also include other fields, for example, hash partitioning the data according to the time field and / or variable field of the time series data.

[0123] As an example and not a limitation, the time fields in the time series data can be concatenated in descending order to form a feature string. For example, the four time fields "year," "month," "day," and "time" in the time series data can be concatenated in order to form a feature string. Partitioning can be performed using a hash function to determine the hash value, thereby clustering and storing a series of data with similar sampling times.

[0124] Optionally, the above example can be combined with hash partitioning based on constant fields. For example, you can first perform primary partitioning based on the time field of the time series data, and then perform secondary partitioning within each primary partition based on the constant fields of the data within that partition, thereby achieving more detailed hash partitioning of the data.

[0125] Optionally, for time series data, when the hash value of the data to be written is determined based on the constant field, the cloud management platform can also determine the identification value of the data to be written based on the hash value of the data to be written. Specifically, time series data with different constant field values ​​correspond to different identification values. Since there may be a large number of repetitions in the constant fields of time series data, each combination of different constant field values ​​is respectively mapped one-to-one to an identification value, and this one-to-one mapping relationship is stored in the row storage table. In the main database of column storage, a column of identification values ​​is used to replace all constant field columns, which can effectively reduce the occupied storage space. In addition, since time series data is clustered and stored according to constant fields, the identification value also needs to be able to reflect the hash value of the data, so that when querying data, the hash partition of the data can be determined according to the value of the constant field, thereby improving the ability of data to be quickly queried. In view of this, an embodiment of the present application provides a method for assigning identification values ​​according to hash partitions.

[0126] Figure 5 shows a schematic flow chart of the identification value allocation provided by an embodiment of the present application. As shown in Figure 5, the dotted line is a method for allocating identification values ​​in a traditional solution without considering hash partitioning, that is, allocating unused identification values ​​in sequence according to the combination of all constant fields. For example, for data 1 to be written to the database, assuming that the identification value allocated at this time is an integer from 1 to 4, the cloud management platform compares all constant fields of data 1 with the constant fields of all data in the current database. If data with exactly the same values ​​for all constant fields already exist in the database, the identification value of the existing data is used as the identification value of data 1, otherwise a new identification value of 5 is assigned to data 1.

[0127] In the method provided by the embodiment of the present application, the cloud management platform can first determine the hash partition based on the characteristic string formed by sequentially splicing some constant fields of the data, and then assign an identification value from the hash partition to which it belongs based on the value of all constant fields. Taking the situation shown in Figure 5 as an example, the main database is divided into 32 hash partitions, and the identification value that each hash partition can assign to the data written to the partition is determined according to the remainder of the identification value modulo 32. For example, the hash value of the characteristic string formed by splicing some constant fields of data 2 is 2 after the hash function is determined, and the cloud management platform writes data 2 into hash partition 2. Assuming that the identification values ​​used by the data already in hash partition 2 are 2 and 34 respectively, the cloud management platform compares all constant fields of data 2 with the constant fields of other data in the current hash partition. If data with exactly the same values ​​of all constant fields already exist in the current hash partition, the identification value of the existing data is used as the identification value of data 2, otherwise a new identification value 66 is assigned to data 2. In the above embodiment, the identification values ​​2, 34, and 66 allocated in hash partition 2 are all modulo 32 with a remainder of 2, and only the data in hash partition 2 uses the identification value modulo 32 with a remainder of 2. Therefore, after obtaining the identification value of the data, the cloud management platform can determine that the hash value of the data is 2 based on the remainder of 2 modulo 32 of the identification value, thereby realizing the ability to reversely determine the hash partition of the data based on the identification value.

[0128] Furthermore, since constant fields contain a large amount of repeated data as described above, in some possible implementations, the cloud management platform can store the mapping relationship between the data identification value and the constant field in a constant data table. To facilitate querying the corresponding relationship between the identification value and the constant field, the constant data table can optionally be a row storage data table. By storing constant fields with high repetition rates and their corresponding identification values ​​as an auxiliary table, it is possible to easily filter the values ​​of the constant fields when querying data, thereby improving data query efficiency.

[0129] Optionally, after mapping the constant fields of the data to identification values ​​that can correspond one to one, the cloud management platform can only write the time field, variable field and identification value of the data in the main database. Among them, the main database can be a column storage part composed of hash partitions and CUs in the hash partitions, and the main database and row storage constant data table together constitute a database with a row-column hybrid storage structure. By storing the constant fields with high repetition and the corresponding hash values ​​and identification values ​​as auxiliary tables, the identification values ​​of integers are stored in the main database that stores data instead of a large number of repeated constant fields, thereby reducing the space required for storing data.

[0130] Furthermore, by assigning different identification values ​​to data in different hash partitions, the hash partition to which the data belongs can be reversely determined based on the data's identification value. Thus, the auxiliary table only needs to store constant fields and corresponding identification values, eliminating the need to separately record the hash values ​​corresponding to the constant fields. This further reduces the space required to store data and improves query efficiency. This implementation also allows data to be assigned identification values ​​by considering only the constant fields of existing data within the hash partition described by the data, eliminating the need to compare with all the data in the database. This speeds up the assignment of identification values ​​to data and improves data storage efficiency.

[0131] Figure 6 shows a schematic diagram of the above-mentioned row-column hybrid storage structure provided by an embodiment of the present application. As shown in Figure 6, the constant fields corresponding to the col1 column and the col2 column are stored in the constant data table of the row storage, and the combination that appears more than once (the combination with the space name andy and the ip address 10.73.3) is removed, so that each different constant field combination is assigned a one-to-one corresponding identification value. The situation of the main database stored in the column can be described by the CUDesc table. The variable fields corresponding to col3 and col4 and the time field corresponding to col5 are normally stored in the main database, and each column corresponds to a CU in the interval of cu_id 1001. In addition, a new column of identification values ​​for CU storage data is added to the main database, and a fixed column number (such as -12 in Figure 6) that is easy to distinguish can be defined for the column. Optionally, a column of CUs for storing hash values ​​of data (such as the column with col_id of -10 in Figure 6) can also be added to the main database. By increasing the storage capacity of data by a small amount, the hash partition to which the data in the group of CUs belongs can be more intuitively reflected, reducing the amount of calculation for determining the hash partition according to the identification value when retrieving data. By using a mixed row-column storage method, constant fields are no longer stored repeatedly during storage, reducing the data storage scale. On the other hand, during the retrieval process, the string comparison of the constant fields in the main database is converted into a more efficient integer comparison, improving data query performance.

[0132] The above description describes the data storage method in the data management method provided by the embodiment of the present application in conjunction with Figures 4 to 6. In some possible implementations, the data management method provided by the embodiment of the present application also includes a data query method.

[0133] The data query method of the present application is described in detail below with reference to FIG7 .

[0134] Figure 7 shows a schematic flow chart of a method for managing data provided in an embodiment of the present application. Optionally, the method of Figure 4 can be executed by a cluster of computing devices, such as the cloud management platform 310 in Figure 3 above. It should be understood that the embodiment of the present application is only illustrated by taking the execution of the method for managing data in a cloud scenario as an example, but it is not limited to being executed by a cloud management platform. The method for managing data provided in the embodiment of the present application can also be executed by other computing devices, such as a processor or a device containing a processor. For the sake of brevity, some embodiments of the present application are described below using the cloud management platform as an example of the execution subject, but those skilled in the art will understand that this description does not constitute a limitation on the scope of the present application.

[0135] Optionally, the data query method of FIG. 7 may be combined with the data storage method shown in FIG. 3 . For example, the methods described in the following embodiments may be executed after the aforementioned data management method.

[0136] As shown in FIG7 , the method includes the following steps.

[0137] S710: Obtain query conditions.

[0138] For example, in step S710, the cloud management platform may obtain a query condition for data in the database. Specifically, the query condition may be used to query the database for fourth data, where the fourth data may be data in the database that meets the query condition, and the fourth data may also be called target data.

[0139] Optionally, the query conditions may include filter conditions and query targets. The filter conditions are used to limit the conditions that the values ​​of at least some fields in the target data must meet. The fields defined by the filter conditions can be called filter columns. For example, the WHERE clause in the structured query language (SQL) statement defines the filter conditions. The query target is used to limit the fields to be queried in the target data, that is, the fields that are ultimately output as query results. The fields corresponding to the query target can be called target columns. It should be understood that the filter column and the target column may overlap, that is, a field of the data may belong to both the filter column and the target column, or to one or neither of them.

[0140] S720: Determine at least one second hash partition according to the query condition.

[0141] For example, in step S720, the cloud management platform may first determine the hash partition to which the target data belongs based on the query conditions. The second hash partition may be one or more hash partitions in the database that may store the target data. For example, the cloud management platform may determine the hash value or identification value of the target data based on the query conditions, thereby screening the hash partitions in which the target data may be stored.

[0142] S730: Determine fourth data in at least one second hash partition according to the query condition.

[0143] For example, in step S730, the cloud management platform may query the target data within the hash partition range determined in S720 according to the query condition.

[0144] Through the technical solution of the embodiment of the present application, since the hash partition to which the CU in the column storage belongs can be directly determined according to the CUDesc table, there is no need to decompress and read the specific data in the CU. Therefore, by screening the hash partitions that may store the target data according to the query conditions, a large number of hash partitions of clustered storage data that do not meet the query conditions can be pruned, thereby reducing the amount of data to be queried that needs to be read and improving the efficiency of querying data.

[0145] The method shown in Figure 7 can also be applied to time series data. In this case, for the above-mentioned step S720, in some possible implementations, the hash partition of the target data can be determined by querying the constant data table. Specifically, for time series data, depending on the different defined fields, the filtering conditions of the query conditions can also be divided into constant filtering conditions, variable filtering conditions and time filtering conditions, which are respectively used to define the conditions that the values ​​of some or all fields in the corresponding fields of the target data need to meet. For example, the constant filtering condition can be used to define the conditions that the values ​​of all or part of the constant fields of the target data need to meet. The cloud management platform can query the constant data table according to the constant filtering condition, so as to determine the identification value of the data in the constant field that meets the query condition, and the corresponding hash value can be determined based on the identification value, that is, the hash partition to which the target data may belong.

[0146] Through the technical solution of the embodiment of the present application, the value range of the constant field is first filtered in the auxiliary table that stores the mapping relationship between the constant field and the identification value, and then the hash partition is filtered in the main database storing the data according to the corresponding identification value. The constant field filtering condition is transferred to the identification value through a simpler constant data table, which can reduce the time required to retrieve a large amount of repeated constant field data in the main database, thereby improving the efficiency of querying data.

[0147] For time series data, in step S720, in some possible implementations, querying the target data in the second hash partition may include filtering the data in the second hash partition based on one or more of the target data's identification value, a variable filter condition, and a time filter condition. This allows row-level filtering of data within the hash partition along different dimensions.

[0148] Correspondingly, for time series data, after determining the target data through a query, the cloud management platform can read the constant fields of the constant data from the constant data table. By reading the constant field values ​​from the auxiliary table with smaller data volumes and easier to read based on the identification value, the efficiency of reading the target data can be improved, while also conserving the read and write performance resources of the data storage system.

[0149] FIG8 shows a schematic flow chart of querying target data from a database with mixed row and column storage. As shown in FIG8 , the query conditions are divided into two categories: constant filter conditions and non-constant filter conditions, which are used to filter the constant data table stored in rows and the main database stored in columns, respectively. The non-constant filter conditions can be a general term for filter conditions other than constant filter conditions, such as variable filter conditions and time filter conditions. The cloud management platform can determine the identification value of the target data by querying the constant data table based on the constant filter conditions, and then determine the hash value of the target data, and cache the identification value and hash value in memory.

[0150] On the other hand, the cloud management platform first filters the constant field columns in the column storage main database. Even if the constant field columns are also stored in the main database, the CU corresponding to the constant field is not decompressed and read, such as the CU of the col1 column in the case shown in Figure 8. Afterwards, the cloud management platform uses the CUDesc table to filter out CUs that do not meet the hash partition requirements based on the cached hash value, such as the CU in the 1002 interval in the case shown in Figure 8, thereby achieving CU-level hash partition pruning. Optionally, the cloud management platform can also perform CU-level filtering based on other conditions, such as removing CUs whose data ranges are not within the filter conditions and other CUs of the corresponding rows based on the maximum and / or minimum value information of the data in the CU recorded in the CUDesc table.

[0151] Furthermore, the cloud management platform can read the CUs storing the identification values ​​in the remaining CUs, perform row-level filtering based on the cached identification values, and remove data whose identification values ​​do not meet the conditions and data in the same CU. If the specific target data cannot be determined based on the identification value, the cloud management platform can also read the CUs involved in the non-constant conditions in the remaining CUs, and perform row-level filtering based on the non-constant conditions, removing data that does not meet the conditions and data in the same CU from the remaining candidate data. The data remaining after the final screening is the target data of the query.

[0152] After determining the target data, the cloud management platform also needs to read the query target field of the target data, that is, the target column of the target data. For the target columns that are already included in the filter columns, they can be read directly because the corresponding CU has been decompressed and read. For the target columns that are not included in the filter columns, it is necessary to access the location where the data is stored. This process is called post-reading, and the corresponding column is called a post-read column. The post-read column of the non-constant field can access and decompress the CU reading at the corresponding location in the main database; the post-read column of the constant field can be determined by looking up the constant data table based on the cached identification value, so there is no need to access and decompress the CU of the constant field, reducing the occupancy rate of the system read and write resources and saving the decompression time of the CU.

[0153] The above description uses FIG4 to FIG8 to illustrate an embodiment of the method for managing data provided by the present application. The following description uses FIG9 to FIG13 to illustrate an embodiment of the computing device for managing data provided by the present application.

[0154] FIG9 shows a schematic structural block diagram of a computing device 900 for managing data provided in an embodiment of the present application.

[0155] As shown in FIG9 , the computing device 900 includes: a data acquisition module 910 , a dynamic indexing module 920 , a partitioning module 930 , and a storage module 940 .

[0156] Specifically, the data acquisition module 910 is used to acquire first data, where the first data includes N fields, where N is a positive integer greater than 1.

[0157] Specifically, the dynamic index module 920 is used to generate a feature string according to a partitioning strategy, wherein the partitioning strategy is used to indicate M fields among N fields used to generate the feature string and an arrangement order of the M fields, where M is a positive integer less than N.

[0158] Optionally, the M fields and the arrangement order of the M fields are determined according to the query frequency of the N fields.

[0159] Optionally, the dynamic index module 920 is further configured to obtain query frequencies of the N fields within a target period; and update the partitioning strategy according to the query frequencies of the N fields within the target period.

[0160] Optionally, for time series data, the M fields can be determined from constant fields.

[0161] Specifically, the partitioning module 930 is configured to determine a hash value of the first data according to the characteristic character string.

[0162] Specifically, the storage module 940 is configured to write all or part of the fields of the first data into a first hash partition of the database according to the hash value of the first data, wherein the database includes multiple hash partitions.

[0163] Optionally, the storage module 940 is also used to determine the identification value of the first data based on all constant fields of the first data, wherein the identification value of the first data is different from the identification value of the second data, the second data is data stored in a database, and the value of the constant field of the second data is different from the value of the constant field of the first data; and the mapping relationship between the identification value of the first data and all constant fields of the first data is stored in the constant data table.

[0164] Optionally, the storage module 940 is specifically used to determine the identification value of the first data based on all constant fields of the first data and the hash value of the first data, wherein the identification value of the first data is different from the identification value of the third data, the hash value of the third data is different from the hash value of the first data, and the hash value of the first data can be determined based on the identification value of the first data.

[0165] Optionally, the storage module 940 is further configured to write at least one time field and at least one variable field of the first data into the first hash partition; and write an identification value of the first data into the first hash partition.

[0166] 10 shows a schematic structural block diagram of another data management computing device 1000 provided in an embodiment of the present application. Optionally, the computing device 1000 can be combined with the aforementioned computing device 900, that is, the computing device 1000 can also include some or all modules of the computing device 900.

[0167] As shown in FIG. 10 , the computing device 1000 includes: a condition acquisition module 1010 , a first query module 1020 , and a second query module 1030 .

[0168] Specifically, the condition acquisition module 1010 is used to acquire a query condition, and the query condition is used to query the fourth data in the database.

[0169] Specifically, the first query module 1020 is configured to determine at least one second hash partition according to the query condition, where the at least one second hash partition is a hash partition that may store the fourth data.

[0170] Optionally, the first query module 1020 is specifically configured to query the constant data table according to the constant filtering condition to determine the identification value of the fourth data; and determine the hash value of the fourth data according to the identification value of the fourth data.

[0171] Specifically, the second query module 1030 is configured to determine fourth data in at least one second hash partition according to the query condition.

[0172] Optionally, the second query module 1030 is specifically configured to determine the fourth data in the at least one second hash partition according to an identification value of the fourth data.

[0173] Optionally, the second query module 1030 is specifically configured to determine at least one candidate data in at least one second hash partition according to an identification value of the fourth data; and determine the fourth data from the at least one candidate data according to a variable filtering condition and / or a time filtering condition.

[0174] Optionally, the second query module 1030 is further configured to read a post-read constant field of the fourth data from the constant data table according to the identification value of the fourth data, where the post-read constant field is a constant field not included in the query condition.

[0175] The above modules can be implemented in software or hardware. For example, the implementation of the dynamic indexing module 920 will be described below, taking the dynamic indexing module 920 as an example. Similarly, the implementation of the data acquisition module 910, the partitioning module 930, the storage module 940, the conditional acquisition module 1010, the first query module 1020, and the second query module 1030 can refer to the implementation of the dynamic indexing module 920.

[0176] As an example of a software functional unit, the dynamic index module 920 may include code running on a computing instance. The computing instance may include at least one of a physical host (computing device), a virtual machine, and a container. Furthermore, the computing instance may be one or more. For example, the dynamic index module 920 may include code running on multiple hosts / virtual machines / containers. It should be noted that the multiple hosts / virtual machines / containers used to run the code may be distributed in the same region or in different regions. Furthermore, the multiple hosts / virtual machines / containers used to run the code may be distributed in the same availability zone (AZ) or in different AZs, each AZ including one data center or multiple geographically close data centers. Typically, a region may include multiple AZs.

[0177] Similarly, multiple hosts / virtual machines / containers running the code can be distributed within the same virtual private cloud (VPC) or across multiple VPCs. Typically, a VPC is set up within a region. Cross-region communication between two VPCs within the same region, or between VPCs in different regions, requires a communication gateway within each VPC to interconnect the VPCs.

[0178] As an example of a hardware functional unit, the dynamic indexing module 920 may include at least one computing device, such as a server. Alternatively, the dynamic indexing module 920 may be implemented using an application-specific integrated circuit (ASIC) or a programmable logic device (PLD). The PLD may be a complex programmable logical device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof.

[0179] The multiple computing devices included in the dynamic indexing module 920 can be distributed in the same region or in different regions. The multiple computing devices included in the dynamic indexing module 920 can be distributed in the same AZ or in different AZs. Similarly, the multiple computing devices included in the dynamic indexing module 920 can be distributed in the same VPC or in multiple VPCs. The multiple computing devices can be any combination of servers, ASICs, PLDs, CPLDs, FPGAs, GALs, and other computing devices.

[0180] It should be noted that, in other embodiments, the data acquisition module 910, the dynamic index module 920, the partition module 930 and the storage module 940, as well as the conditional acquisition module 1010, the first query module 1020 and the second query module 1030 can be used to respectively execute any steps in the above-mentioned method for managing data. The steps that the data acquisition module 910, the dynamic index module 920, the partition module 930 and the storage module 940, as well as the conditional acquisition module 1010, the first query module 1020 and the second query module 1030 are responsible for implementing can be specified as needed. The full functions of the computing device for managing data are realized by respectively implementing different steps in the above-mentioned method for managing data through the data acquisition module 910, the dynamic index module 920, the partition module 930 and the storage module 940, as well as the conditional acquisition module 1010, the first query module 1020 and the second query module 1030.

[0181] This application also provides a computing device 100. As shown in Figure 11, computing device 100 includes a bus 102, a processor 104, a memory 106, and a communication interface 108. Processor 104, memory 106, and communication interface 108 communicate with each other via bus 102. Computing device 100 can be a server or a terminal device. It should be understood that this application does not limit the number of processors and memories in computing device 100.

[0182] Bus 102 may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, among others. Buses may be classified as address buses, data buses, control buses, and the like. For ease of illustration, FIG10 illustrates a single bus line, but this does not imply a single bus or type of bus. Bus 102 may include a path for transmitting information between various components of computing device 100 (e.g., memory 106, processor 104, and communication interface 108).

[0183] The processor 104 may include any one or more processors such as a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor (MP), or a digital signal processor (DSP).

[0184] The memory 106 may include volatile memory, such as random access memory (RAM). The processor 104 may also include non-volatile memory, such as read-only memory (ROM), flash memory, hard disk drive (HDD), or solid state drive (SSD).

[0185] Memory 106 stores executable program code, which processor 104 executes to implement the functions of the aforementioned data acquisition module, dynamic indexing module, partitioning module, and storage module, thereby implementing the aforementioned data management method. In other words, memory 106 stores instructions for executing the aforementioned data management method.

[0186] The communication interface 108 uses a transceiver module such as, but not limited to, a network interface card or a transceiver to implement communication between the computing device 100 and other devices or a communication network.

[0187] Embodiments of the present application also provide a computing device cluster. The computing device cluster includes at least one computing device. The computing device can be a server, such as a central server, an edge server, or a local server in a local data center. In some embodiments, the computing device can also be a terminal device such as a desktop computer, a laptop computer, or a smartphone.

[0188] As shown in Figure 12, the computing device cluster includes at least one computing device 100. The memory 106 in one or more computing devices 100 in the computing device cluster may store the same instructions for executing the above-mentioned method for managing data.

[0189] In some possible implementations, the memory 106 of one or more computing devices 100 in the computing device cluster may also store partial instructions for executing the above-mentioned method for managing data. In other words, the combination of one or more computing devices 100 can jointly execute the instructions for executing the above-mentioned method for managing data.

[0190] It should be noted that the memory 106 in different computing devices 100 in the computing device cluster can store different instructions, each for executing a portion of the functions of the computing device for managing data. In other words, the instructions stored in the memory 106 in different computing devices 100 can implement the functions of one or more of the data acquisition module, dynamic indexing module, partitioning module, and storage module.

[0191] In some possible implementations, one or more computing devices in a computing device cluster may be connected via a network. The network may be a wide area network or a local area network, etc. FIG13 shows a possible implementation. As shown in FIG13 , two computing devices 100A and 100B are connected via a network. Specifically, the connection to the network is made via a communication interface in each computing device. In this type of possible implementation, the memory 106 in the computing device 100A stores instructions for executing the functions of the data acquisition module and the storage module. At the same time, the memory 106 in the computing device 100B stores instructions for executing the functions of the dynamic index module and the partitioning module.

[0192] It should be understood that the functions of the computing device 100A shown in FIG12 may also be completed by multiple computing devices 100. Similarly, the functions of the computing device 100B may also be completed by multiple computing devices 100.

[0193] An embodiment of the present application also provides a chip, which includes a processor and a data interface. The processor reads instructions stored in the memory through the data interface to execute the above-mentioned method for managing data.

[0194] Embodiments of the present application also provide a computer program product containing instructions. The computer program product may be software or a program product containing instructions that can be run on a computing device or stored on any available medium. When the computer program product is run on at least one computing device, it causes the at least one computing device to perform the aforementioned data management method.

[0195] The embodiment of the present application also provides a computer-readable storage medium. The computer-readable storage medium can be any available medium that can be stored by a computing device or a data storage device such as a data center containing one or more available media. The available medium can be a magnetic medium (for example, a floppy disk, a hard disk, a tape), an optical medium (for example, a DVD), or a semiconductor medium (for example, a solid-state hard disk), etc. The computer-readable storage medium includes instructions that instruct the computing device to perform the above-mentioned management. The various technical features can be arbitrarily combined. In order to make the description concise, not all possible combinations of the various technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0196] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the protection scope of the technical solutions of the embodiments of the present application.

Claims

1. A method for managing data, characterized in that: include: Acquire first data, where the first data includes N fields, where N is a positive integer greater than 1; Generate a characteristic string according to a partition strategy, wherein the partition strategy is used to indicate M fields among the N fields used to generate the characteristic string and an arrangement order of the M fields, where M is a positive integer less than N; Determine a hash value of the first data according to the characteristic character string; According to the hash value of the first data, all or part of the fields of the first data are written into a first hash partition of a database, wherein the database includes multiple hash partitions, different hash partitions correspond to different hash values, and the first hash partition is a hash partition corresponding to the hash value of the first data.

2. The method according to claim 1, characterized in that The M fields and the arrangement order of the M fields are determined according to the query frequencies of the N fields.

3. The method according to claim 2, characterized in that The method further comprises: Obtaining the query frequencies of the N fields within a target period; The partitioning strategy is updated according to the query frequency of the N fields within the target time period.

4. The method according to any one of claims 1 to 3, characterized in that The N fields include at least one time field, at least one constant field and at least one variable field, and the M fields are all or part of the at least one constant field.

5. The method according to claim 4, characterized in that The database also includes a constant data table, and the method further includes: determining an identification value of the first data according to all constant fields of the first data, wherein the identification value of the first data is different from the identification value of second data, the second data is data stored in the database, and the value of the constant field of the second data is different from the value of the constant field of the first data; The mapping relationship between the identification value of the first data and all constant fields of the first data is stored in the constant data table.

6. The method according to claim 5, characterized in that The determining the identification value of the first data according to all constant fields of the first data includes: An identification value of the first data is determined based on all constant fields of the first data and a hash value of the first data, wherein the identification value of the first data is different from the identification value of the third data, the hash value of the third data is different from the hash value of the first data, and the hash value of the first data can be determined based on the identification value of the first data.

7. The method according to claim 6, characterized in that Writing all or part of the fields of the first data into the first hash partition of the database includes: Writing the at least one time field and the at least one variable field of the first data into the first hash partition; The method further comprises: Write the identification value of the first data into the first hash partition.

8. The method according to claim 7, characterized in that The method further comprises: Obtaining a query condition, where the query condition is used to query the database for fourth data; Determine at least one second hash partition according to the query condition, where the at least one second hash partition is a hash partition that may store the fourth data; According to the query condition, the fourth data is determined in the at least one second hash partition.

9. The method according to claim 8, characterized in that The query condition includes values ​​of all or part of the constant fields of the fourth data, and determining at least one second hash partition according to the query condition includes: According to the values ​​of all or part of the constant fields of the fourth data, query the constant data table to determine the identification value of the fourth data; A hash value of the fourth data is determined according to the identification value of the fourth data.

10. The method according to claim 9, characterized in that The determining, according to the query condition, the fourth data in the at least one second hash partition comprises: The fourth data is determined in the at least one second hash partition according to the identification value of the fourth data.

11. The method according to claim 10, characterized in that The query condition further includes a value of a variable field of the fourth data and / or a value of a time field of the fourth data, and determining the fourth data in the at least one second hash partition according to an identification value of the fourth data includes: Determine at least one candidate data in the at least one second hash partition according to the identification value of the fourth data; The fourth data is determined from the at least one candidate data according to a value of a variable field of the fourth data and / or a value of a variable field of the fourth data.

12. The method according to any one of claims 9 to 11, characterized in that In a case where the query condition includes values ​​of some constant fields of the fourth data, the method further includes: According to the identification value of the fourth data, a post-read constant field of the fourth data is read from the constant data table, and the post-read constant field is a constant field not included in the query condition.

13. A computing device, characterized in that: include: A data acquisition module, used to acquire first data, where the first data includes N fields, where N is a positive integer greater than 1; A dynamic index module, used to generate a characteristic string according to a partition strategy, wherein the partition strategy is used to indicate M fields among the N fields used to generate the characteristic string and an arrangement order of the M fields, where M is a positive integer less than N; A partitioning module, used to determine a hash value of the first data according to the characteristic character string; A storage module is used to write all or part of the fields of the first data into a first hash partition of a database according to the hash value of the first data, wherein the database includes multiple hash partitions, different hash partitions correspond to different hash values, and the first hash partition is a hash partition corresponding to the hash value of the first data.

14. The computing device according to claim 13, characterized in that The M fields and the arrangement order of the M fields are determined according to the query frequencies of the N fields.

15. The computing device according to claim 14, characterized in that The dynamic index module is further used for: Obtaining the query frequencies of the N fields within a target period; The partitioning strategy is updated according to the query frequency of the N fields within the target time period.

16. The computing device according to any one of claims 13 to 15, characterized in that: The N fields include at least one time field, at least one constant field and at least one variable field, and the M fields are all or part of the at least one constant field.

17. The computing device according to claim 16, characterized in that The database also includes a constant data table, and the storage module is also used for: determining an identification value of the first data according to all constant fields of the first data, wherein the identification value of the first data is different from the identification value of second data, the second data is data stored in the database, and the value of the constant field of the second data is different from the value of the constant field of the first data; The mapping relationship between the identification value of the first data and all constant fields of the first data is stored in the constant data table.

18. The computing device according to claim 17, characterized in that The storage module is used for: An identification value of the first data is determined based on all constant fields of the first data and a hash value of the first data, wherein the identification value of the first data is different from the identification value of the third data, the hash value of the third data is different from the hash value of the first data, and the hash value of the first data can be determined based on the identification value of the first data.

19. The computing device according to claim 18, characterized in that The storage module is used for: Writing the at least one time field and the at least one variable field of the first data into the first hash partition; Write the identification value of the first data into the first hash partition.

20. The computing device of claim 19, wherein: The computing device further comprises: A condition acquisition module, used for acquiring a query condition, wherein the query condition is used for searching the database for fourth data; A first query module, configured to determine at least one second hash partition according to the query condition, wherein the at least one second hash partition is a hash partition that may store the fourth data; The second query module is used to determine the fourth data in the at least one second hash partition according to the query condition.

21. The computing device of claim 20, wherein: The query condition includes the value of all or part of the constant field of the fourth data, and the first query module is used to: According to the values ​​of all or part of the constant fields of the fourth data, query the constant data table to determine the identification value of the fourth data; A hash value of the fourth data is determined according to the identification value of the fourth data.

22. The computing device of claim 21, wherein: The second query module is used to: The fourth data is determined in the at least one second hash partition according to the identification value of the fourth data.

23. The computing device of claim 22, wherein: The query condition further includes a value of a variable field of the fourth data and / or a value of a time field of the fourth data, and the second query module is used to: Determine at least one candidate data in the at least one second hash partition according to the identification value of the fourth data; The fourth data is determined from the at least one candidate data according to a value of a variable field of the fourth data and / or a value of a variable field of the fourth data.

24. The computing device according to any one of claims 21 to 23, characterized in that In a case where the query condition includes values ​​of some constant fields of the fourth data, the second query module is further configured to: According to the identification value of the fourth data, a post-read constant field of the fourth data is read from the constant data table, and the post-read constant field is a constant field not included in the query condition.

25. A computing device, characterized in that The computer comprises a processor and a memory, wherein the processor is configured to execute instructions stored in the memory so that the computing device executes the method according to any one of claims 1 to 12.

26. A computing device cluster, characterized in that: comprising at least one computing device, each computing device comprising a processor and a memory; The processor of the at least one computing device is configured to execute instructions stored in the memory of the at least one computing device, so that the computing device cluster executes the method according to any one of claims 1 to 12.

27. A computer-readable storage medium, characterized in that: The method comprises computer program instructions, which, when executed by a computing device cluster, cause the computing device cluster to perform the method according to any one of claims 1 to 12.

Citation Information

Patent Citations

  • Data management method and computing device

    CN118708580A

  • Hash partitioning management method and device

    CN104298687A

  • Log data fragmentation method based on segment order-preserving Hash and log data fragmentation device based on segment order-preserving Hash

    CN105117402A

  • Data processing method and device for distributed database and storage medium

    CN110442642A

  • Data fragmentation method, related equipment and computer storage medium

    CN110851525A