Data query method and apparatus

By applying conditional entropy correlation algorithm and consistent hashing algorithm to medical databases, the storage and querying of data cube metadata database are optimized, solving the problems of high efficiency in querying duplicate fields and conditions in medical data, and realizing fast querying and efficient data exploration.

CN117171161BActive Publication Date: 2026-04-21HANGZHOU WEIMING XINKE TECH CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
HANGZHOU WEIMING XINKE TECH CO LTD
Filing Date
2023-07-24
Publication Date
2026-04-21

AI Technical Summary

Technical Problem

Existing high-performance databases cannot achieve simple and efficient data querying in medical data, especially when the query fields and conditions in medical fusion databases have a high degree of repetition, resulting in insufficient query performance.

Method used

The target data cube is determined by a conditional entropy correlation algorithm. The data is distributed and stored in different storage nodes and virtual nodes using a consistent hashing algorithm. Combined with the data cube metadata database, the duplicate query fields are quickly located, and the data storage location with high data access volume is optimized.

Benefits of technology

It accelerates data query speed in medical databases, improves data exploration efficiency, simplifies field correlation calculations, reduces data query pressure, and improves query performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117171161B_ABST
    Figure CN117171161B_ABST
Patent Text Reader

Abstract

The application relates to a data query method and device, which comprises the following steps: determining a target data cube based on a target database, a first query field in a historical query process and a conditional entropy correlation algorithm; determining a data cube meta-database based on the target data cube; the data cube meta-database comprises at least one tree branch tree node; storing the data of the parent nodes of different levels in each tree branch in the at least one tree branch into different storage nodes based on a consistent hash algorithm and the access amounts of different tree nodes; storing the data of the tree nodes with different access amounts into different virtual nodes; and searching the query result corresponding to a second query field from the corresponding storage node in response to a query request of the second query field from a user end. Therefore, simple and efficient data query of a medical database is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer technology, and in particular to data query methods and apparatus. Background Technology

[0002] With the exponential growth of medical data, integrated medical databases are gradually becoming unable to support the demands of medical statistical queries in terms of query performance. Research has found that statistical queries on integrated medical databases often involve a high degree of repetition in query fields and conditions, but existing high-performance databases lack simple and efficient data query methods specifically designed for this medical application scenario. Summary of the Invention

[0003] This invention provides a data query method and apparatus to address the lack of a simple and efficient data query method for medical databases in the prior art, thereby enabling simple and efficient data querying of medical databases.

[0004] A data query method includes: determining a target data cube based on a target database, a first query field from a historical query process, and a conditional entropy correlation algorithm; the conditional entropy correlation algorithm is used to determine the correlation between fields in the target data cube to be executed based on the number of times a field or field combination appears in the historical query process; the correlation is used to filter field combinations in the target data cube to be executed; determining a data cube metadata database based on the target data cube; the data cube metadata database includes tree nodes of at least one tree branch; storing the data of parent nodes at different levels in each tree branch of the at least one tree branch on different storage nodes based on a consistent hashing algorithm and the access volume of different tree nodes; and storing the data of tree nodes with different access volumes on different virtual nodes; and, in response to a user's query request for a second query field, retrieving the query result corresponding to the second query field from the corresponding storage node.

[0005] In one embodiment, the step of storing the data of parent nodes at different levels in each of the at least one tree branch on different storage nodes based on the consistent hashing algorithm and the access volume of different tree nodes, and storing the data of tree nodes with different access volumes on different virtual nodes, includes: determining the storage node corresponding to the parent node at different levels in each tree branch by bitwise XORing the hash value of the parent node at different levels in each tree branch with the hash value of the storage node; storing the data of the parent node at different levels in each tree branch on different storage nodes based on the determined storage node corresponding to the parent node at different levels in each tree branch; and determining the virtual node corresponding to the tree node with different access volumes by multiplying the data access volume of the tree node with different access volumes with the hash value of the virtual node, and storing the data of the tree node with different access volumes on the corresponding virtual node.

[0006] In one embodiment, the formula corresponding to the consistent hashing algorithm is: hash(s, k, n, m, p) = (((s.hash_code()^p1^p2^p3)*(k+1))%n+m*hashed_color(k)%n)%n, where s.hash_code() represents the integer value obtained by hashing the identity identifier of the storage node s, ^ represents the bitwise XOR operation, p represents the tree node, p1, p2 and p3 represent the parent nodes of different levels in each tree branch, hashed_color(k) represents the integer value obtained by hashing the virtual node numbered k, n represents the size of the data volume of the tree node in the preset time period, and m represents the size of the data access volume of the tree node in the preset time period.

[0007] In one embodiment, determining a target data cube based on a target database, first query fields in historical query processes, and a conditional entropy correlation algorithm includes: in response to a data update notification for the target data cube, determining the target data cube to be executed for each first query field in the query log data within a preset time period from the target database; and determining the final target data cube based on the target data cube to be executed and the conditional entropy correlation algorithm.

[0008] In one embodiment, determining the final target data cube based on the target data cube to be executed and the conditional entropy correlation algorithm includes: determining the correlation between fields in each target data cube based on the first occurrence of the target dimension field combination, the second occurrence of the target metric field, the third occurrence of the target metric field and the target dimension field combination, and the total occurrence of the first combination formed by the target dimension field combination and the target metric field in the target data cube to be executed, combined with the conditional entropy formula; saving the correlation and the corresponding first query statement identification information to the data cube meta-database; based on the correlation, arranging at least one first combination in each target data cube to be executed in order, and determining the field combination with a sequence greater than a first preset threshold in the at least one first combination as the second combination, and determining the final target data cube based on the second combination.

[0009] In one embodiment, the correlation r1 between fields in each target data cube is calculated using the following formula: Where M is the total number of target metric fields in each target data cube to be executed, N is the total number of combinations of target metric fields in each target data cube to be executed, count(d) is the first occurrence of target dimension field combination d in each target data cube to be executed, count(a) is the second occurrence of target metric field a in each target data cube to be executed, count(a,d) is the third occurrence of target metric field a and target dimension field combination d together in each target data cube to be executed, and total is the total number of occurrences of the first combination formed by the target dimension field combination and the target metric field in each target data cube to be executed.

[0010] In one embodiment, the method further includes: establishing access permission priorities for tree nodes at different levels in each of the at least one tree branch based on the data cube metadata database; and establishing a mapping table between different users and tree nodes of at least one tree branch.

[0011] The present invention also provides a data query device, the device comprising: a first determining module, configured to determine a target data cube based on a target database, a first query field in a historical query process, and a conditional entropy correlation algorithm; the conditional entropy correlation algorithm is configured to determine the correlation between fields in the target data cube to be executed based on the number of times a field or field combination appears in a historical query process; the correlation is used for filtering field combinations in the target data cube to be executed; a second determining module, configured to determine a data cube metadata database based on the target data cube; the data cube metadata database includes tree nodes of at least one tree branch; a storage module, configured to store the data of parent nodes at different levels in each tree branch in the at least one tree branch on different storage nodes based on a consistent hashing algorithm and the access volume of different tree nodes; and to store the data of tree nodes with different access volumes on different virtual nodes; and a search module, configured to, in response to a user's query request for a second query field, search for the query result corresponding to the second query field from the corresponding storage node.

[0012] The present invention also provides a computer device, including a memory and a processor, wherein the memory stores computer-readable instructions, which, when executed by the processor, cause the processor to perform the steps of the above-described data query method.

[0013] The present invention also provides a storage medium storing computer-readable instructions, which, when executed by one or more processors, cause the one or more processors to perform the steps of the above-described data query method.

[0014] The aforementioned data query method and apparatus address the high repetition rate of query fields and conditions in statistical queries of medical fusion databases. By organizing the fields queried in historical queries into data cubes and saving the corresponding data cube metadata database, it becomes easier to directly locate the corresponding query field information from the data cube metadata database when duplicate query fields are received again, thereby accelerating the query speed. Furthermore, based on the defined data cube metadata database, a consistent hashing algorithm is used to distribute the data of tree nodes in each branch of the data cube metadata database to different storage nodes or different virtual nodes. This allows data from tree nodes with large amounts of data to be distributed and stored in different storage locations, thereby distributing the data query pressure and accelerating the data query speed. Furthermore, when medical researchers conduct data exploration, there is no simple and quick method to calculate the correlation between fields, which affects the progress of medical data exploration. The data query method of this invention proposes to determine the correlation between fields in the target data cube to be executed by calculating the correlation between fields in the medical database based on the conditional entropy correlation algorithm and the frequency of occurrence of fields or field combinations in the historical query process. Based on the correlation, the combination of fields in the target data cube to be executed is filtered. This enables simple and quick calculation of the correlation between multiple fields, which facilitates the simple and quick determination of the data cube, thereby improving the efficiency of subsequent data exploration and querying of related fields in the data cube. Attached Figure Description

[0015] Figure 1 This is one of the flowcharts illustrating the data query method provided by the present invention;

[0016] Figure 2 The second flowchart illustrating the data query method provided by this invention;

[0017] Figure 3 The third flowchart illustrating the data query method provided by this invention;

[0018] Figure 4 The fourth flowchart illustrating the data query method provided by this invention;

[0019] Figure 5 The fifth flowchart illustrating the data query method provided by this invention;

[0020] Figure 6 A schematic diagram of the data cube meta-database provided by this invention;

[0021] Figure 7 A schematic diagram of the framework of the data query method provided by the present invention;

[0022] Figure 8A schematic diagram of a framework for determining the target data cube to be executed, provided by the present invention;

[0023] Figure 9 A schematic diagram of the framework for determining the data cube meta-database provided by the present invention;

[0024] Figure 10 A schematic diagram of the framework of the data query device provided by the present invention;

[0025] Figure 11 A schematic diagram of the electronic device provided by the present invention. Detailed Implementation

[0026] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.

[0027] It should be noted that, unless otherwise defined, the technical or scientific terms used in the embodiments of this disclosure should have the ordinary meaning understood by one of ordinary skill in the art to which this disclosure pertains. The terms "first," "second," and similar terms used in the embodiments of this disclosure do not indicate any order, quantity, or importance, but are merely used to distinguish different components. Terms such as "comprising" or "including" mean that the element or object preceding the word encompasses the elements or objects listed following the word and their equivalents, without excluding other elements or objects. Terms such as "connected" or "linked" are not limited to physical or mechanical connections, but can include electrical connections, whether direct or indirect. Terms such as "upper," "lower," "left," and "right" are used only to indicate relative positional relationships; when the absolute position of the described object changes, the relative positional relationship may also change accordingly.

[0028] To facilitate understanding, the inventive concept of the invention will be explained first.

[0029] It is understandable that the high repetition rate of query fields and conditions in statistical queries of medical fusion databases, coupled with the lack of a simple and quick method to calculate the correlation between fields when medical researchers explore data, and the concentrated storage of all data without distributing high-access data, all affect the progress of medical data exploration. Therefore, the application scenarios and hardware devices of most existing data query methods are not suitable for medical statistical queries. Consequently, most existing data query methods are not suitable for solving the query performance problem of medical fusion databases, and a new technology is needed to improve the query performance of medical fusion databases.

[0030] In view of this, the present invention provides a data query method for querying medical databases. Specifically, for statistical queries on medical fusion databases, where the query fields and query conditions have a high repetition rate, a pre-computation method is used to merge duplicate queries. The fields queried during historical queries are organized into data cubes, and the corresponding data cube metadata database is saved. This facilitates direct retrieval of the corresponding query field information from the data cube metadata database when duplicate query fields are received again, thereby accelerating the query speed. Furthermore, based on the defined data cube metadata database, a consistent hashing algorithm is used to distribute the data of tree nodes in each branch of the data cube metadata database to different storage nodes or different virtual nodes. This allows data from tree nodes with large amounts of data to be distributed and stored in different storage locations, thereby distributing the data query pressure and accelerating the data query speed. Furthermore, when medical researchers conduct data exploration, there is no simple and quick method to calculate the correlation between fields, which affects the progress of medical data exploration. The data query method of this invention proposes to determine the correlation between fields in the target data cube to be executed by calculating the correlation between fields in the medical database based on the conditional entropy correlation algorithm and the frequency of occurrence of fields or field combinations in the historical query process. Based on the correlation, the combination of fields in the target data cube to be executed is filtered. This enables simple and quick calculation of the correlation between multiple fields, which facilitates the simple and quick determination of the data cube, thereby improving the efficiency of subsequent data exploration and querying of related fields in the data cube.

[0031] The data query method and apparatus provided by the present invention will be described below with reference to the accompanying drawings.

[0032] Figure 1 This is a flowchart illustrating a data query method provided by the present invention. It can be understood that this data query method can be executed by a data query device, which can be a computer device.

[0033] like Figure 1 As shown, in one embodiment, a data query method is proposed, which may specifically include the following steps:

[0034] Step 110: Determine the target data cube based on the target database, the first query field in the historical query process, and the conditional entropy correlation algorithm.

[0035] The target database can be a medical database, such as at least one of the following: hospital information system (HIS), clinical information system (CIS), laboratory information management system (LIS), electronic medical record (EMR), picture archiving and communication system (PACS), radiology information system (RIS), and computer-aided design (CAD).

[0036] As mentioned earlier, since the query fields and query conditions of the medical data medical fusion database have a high repetition rate, we can first perform statistics and calculations on the query fields that appear in the historical query process, and save the statistically calculated data in the form of target data cubes into the corresponding data cube meta-database. This way, when the same query fields appear in subsequent query requests, the corresponding target data cube can be quickly retrieved from the corresponding data cube meta-database.

[0037] Furthermore, it should be noted that the conditional entropy correlation algorithm is used to determine the correlation between fields in the target data cube to be executed based on the number of times a field or field combination appears in the historical query process; the correlation is used to filter the field combinations in the target data cube to be executed.

[0038] The target data cubes to be executed are mainly the data cubes corresponding to the data associated with the query fields, and the data cubes corresponding to the fields with a high number of queries.

[0039] It is understandable that by determining the frequency of occurrence of fields or field combinations during historical queries, the correlation between fields in the target data cube to be executed can be determined, thus providing a simple method for calculating correlation. Furthermore, the correlation calculated by this simple method is used to filter the field combinations in the target data cube to be executed, thereby reducing the number of fields in the target data cube and making the data in the corresponding data cube meta-database more concise and effective. As a result, when receiving actual query requests, the amount of data retrieved from the data cube meta-database is reduced, thereby speeding up data querying.

[0040] Step 120: Based on the target data cube, determine the data cube meta-database; the data cube meta-database includes tree nodes of at least one tree branch.

[0041] The data cube metadata database can be understood as a tree-structured database of target data cubes and its metadata, containing target data cubes with at least one query field. Each target data cube corresponds to a tree node in the tree structure, and each target data cube reflects the target data table corresponding to the first query field in the historical query process, the calculated information, and its metadata. The metadata information of the target data table corresponding to the first query field includes: table name and table extension information, table hierarchy information, column names and column extension information, and basic column statistics. The table hierarchy information represents the index information of the target data table corresponding to the first query field in the tree-structured database of target data cubes. It is understood that the query field corresponding to a subsequent query request may be the same as the first query field in a historical query process. Therefore, by using the metadata information of the target data table corresponding to the first query field, the computer can quickly determine the data table information corresponding to the first query field in the query request, thereby helping the computer quickly retrieve the information of the first query field that the user wants to query from the corresponding data table.

[0042] Step 130: Based on the consistent hashing algorithm and the access volume of different tree nodes, store the data of the parent nodes at different levels in each tree branch of the at least one tree branch on different storage nodes; and store the data of tree nodes with different access volumes on different virtual nodes.

[0043] Each branch of the tree contains at least one tree node. The bottom-level tree node can be called a child node, and the tree nodes one or more levels above the child node are the parent nodes at different levels. Parent nodes at different levels can be, for example, the parent node of the bottom-level child node, the grandparent node, and the great-grandparent node. A storage node can be understood as a physical storage node, corresponding to an identity document (ID) or an Internet Protocol address (IP). A virtual node can be understood as a virtual storage space further subdivided from a storage node.

[0044] Understandably, consistent hashing algorithms are typically used to map different storage nodes onto hash rings, with different identifiers at different positions on the hash ring. Data is then divided into different data slices, distributed across storage nodes at different positions on different hash rings. In this invention, each target data cube corresponds to a tree node in a tree structure. Each target data cube reflects the target data table, calculated information, and metadata information corresponding to one or more query fields in the historical query process. Furthermore, since some query fields may correspond to large amounts of data or large query volumes, different target data cubes correspond to different amounts of data or large query volumes; that is, different tree nodes correspond to different amounts of data or large query volumes. Moreover, since parent nodes at different levels within the same tree branch may contain the same query field with a large data volume, to avoid over-concentrating the data corresponding to large query fields, this invention stores the data of parent nodes at different levels within each tree branch on different storage nodes. It also stores the data of tree nodes with different access volumes on different virtual nodes, thus distributing high-access data across different virtual nodes.

[0045] Step 140: In response to the user's query request for the second query field, retrieve the query result corresponding to the second query field from the corresponding storage node.

[0046] The query request is a query request to a medical database, and the second query field can be a field from the real-time query request. The query request includes query conditions for the second query field. These query conditions are used to query information about the second query field and its related field combinations. For example, the query conditions for the second query field could be historical query information where the second query field equals a preset threshold, or the historical maximum value of the second query field, or the situation of related fields when the second query field equals a preset threshold.

[0047] The data query method provided by this invention addresses the high repetition rate of query fields and conditions in statistical queries of medical fusion databases. By organizing the fields queried in historical queries into data cubes and saving the corresponding data cube metadata database, it facilitates direct retrieval of the corresponding query field information from the data cube metadata database when duplicate query fields are received again, thereby accelerating the query speed. Furthermore, based on the defined data cube metadata database, a consistent hashing algorithm is used to distribute the data of tree nodes in each branch of the data cube metadata database to different storage nodes or different virtual nodes. This allows data from tree nodes with large amounts of data to be distributed and stored in different storage locations, thereby distributing the data query pressure and accelerating the data query speed. Furthermore, when medical researchers conduct data exploration, there is no simple and quick method to calculate the correlation between fields, which affects the progress of medical data exploration. The data query method of this invention proposes to determine the correlation between fields in the target data cube to be executed by calculating the correlation between fields in the medical database based on the conditional entropy correlation algorithm and the frequency of occurrence of fields or field combinations in the historical query process. Based on the correlation, the combination of fields in the target data cube to be executed is filtered. This enables simple and quick calculation of the correlation between multiple fields, which facilitates the simple and quick determination of the data cube, thereby improving the efficiency of subsequent data exploration and querying of related fields in the data cube.

[0048] In one embodiment, such as Figure 2 As shown, step 130 above may specifically include the following steps:

[0049] Step 210: By bitwise XORing the hash values ​​of the parent nodes at different levels in each tree branch with the hash values ​​of the storage nodes, the storage nodes corresponding to the parent nodes at different levels in each tree branch are determined; and based on the determined storage nodes corresponding to the parent nodes at different levels in each tree branch, the data of the parent nodes at different levels in each tree branch is stored on different storage nodes.

[0050] The hash values ​​of parent nodes at different levels and the hash values ​​of storage nodes can be determined based on a preset hash function, such as a message digest algorithm (MD5) or a secure hash algorithm (SHA).

[0051] It is understandable that different storage nodes can be mapped to corresponding positions on a hash ring using a pre-defined hash function, with the identifier of the corresponding position being the hash value of the storage node. Furthermore, the same hash function as the aforementioned pre-defined hash function can be used to calculate the hash values ​​corresponding to parent nodes at different levels, thereby determining the storage nodes corresponding to parent nodes at different levels on the hash ring, and thus determining the storage nodes corresponding to parent nodes at different levels within each tree branch. Moreover, to ensure that the data of parent nodes at different levels within the same tree branch is stored in a distributed manner, this can be achieved by bitwise XORing the hash values ​​of parent nodes at different levels within each tree branch with the hash values ​​of the storage nodes.

[0052] Specifically, in one embodiment, this process can be implemented by referring to the first term ((s.hash_code()^p1^p2^p3)*(k+1))%n in the formula corresponding to the consistent hashing algorithm below. It can be understood that the formula ((s.hash_code()^p1^p2^p3)*(k+1))%n only provides an illustrative example of the calculation process of the consistent hashing algorithm corresponding to a tree branch with three levels of parent nodes p1, p2, and p3. In practice, an XOR term can be added based on the number of parent nodes at different levels. It can be understood that by multiplying by the virtual node number and taking the remainder with respect to the amount of data n of the tree node within a preset time period, the data of a tree node can be evenly distributed across different virtual nodes. In practical applications, other methods can also be used to ensure that the data of a tree node is evenly distributed across different virtual nodes.

[0053] In one embodiment, hash(s, k, n, m, p) = (((s.hash_code()^p1^p2^p3)*(k+1))%n+m*hashed_color(k)%n)%n, where s.hash_code() represents the integer value obtained by hashing the identity identifier of the storage node s, ^ represents the bitwise XOR operation, p represents the tree node, p1, p2 and p3 represent the parent nodes at different levels in each tree branch, hashed_color(k) represents the integer value obtained by hashing the virtual node numbered k, n represents the size of the data volume of the tree node within a preset time period, and m represents the size of the data access volume of the tree node within a preset time period.

[0054] Step 220: By multiplying the data access volume of tree nodes with different access volumes by the hash value of the virtual node, the virtual node corresponding to the tree node with different access volumes is determined, and the data of the tree nodes with different access volumes is stored on the corresponding virtual node.

[0055] It is understandable that different virtual nodes can be mapped to corresponding positions on a hash ring using a second target preset hash function, and the identifier of the corresponding position is the hash value of the virtual node. Further, the same hash function as the aforementioned second target preset hash function can be used to calculate the hash values ​​corresponding to tree nodes with different access volumes, thereby determining the storage nodes corresponding to tree nodes with different access volumes on the hash ring. Specifically, in one embodiment, this process can be implemented based on the second term m*hashed_color(k)%n in the above formula hash(s, k, n, m, p). By mapping virtual nodes to a hash ring using hashed_color(k), and then multiplying by m, data with different access volumes are distributed in the corresponding positions on the hash ring of the virtual nodes, thus distributing data of different access volumes m across different virtual nodes, resulting in a more even data distribution and preventing highly accessed data from being concentrated in a single virtual node.

[0056] In one embodiment, such as Figure 3 As shown, the target data cube is determined based on the target database, the first query field in the historical query process, and the conditional entropy correlation algorithm, including the following steps:

[0057] Step 310: In response to the data update notification for the target data cube, based on the query log data within a preset time period, determine the target data cube to be executed for each first query field in the query log data from the target database.

[0058] The data update notification can be a scheduled notification sent based on a preset period of idle computing resources. This preset period of idle computing resources refers to the time when the computer's computing resources are typically unavailable, for example, from 00:00 to 05:00. It can be understood that, in order to enable the computer to update the data cube metadata database during this idle period, pre-computation can be scheduled during this time, thereby accelerating the pre-computation process.

[0059] The query log data within the preset time period can be a period of time before the data update notification of the data cube meta database is sent, such as one month or half a year before the data update notification of the data cube meta database is sent.

[0060] Specifically, step 310 includes steps 3110 to 3130.

[0061] Step 3110: Based on the query log data, obtain from the target database the first data table and its first metadata corresponding to each first query field appearing in at least one of the query log data; and / or, based on association rules, determine the second data table and its second metadata of the target field that is related to each first query field and has an occurrence frequency greater than a second preset threshold.

[0062] The association rule can be understood as the relationship between fields determined based on combinations of frequently queried fields obtained from existing query log data. Therefore, the association rule can be pre-saved, allowing the computer to determine, based on the association rule, the second data table and its second metadata containing target fields that are related to each of the first query fields and have a frequency greater than a preset threshold.

[0063] The first metadata may include the table name and extended information of the first data table, the table hierarchy information, and the column names, extended information, and basic column statistics of the first query fields. The second metadata may include the table name and extended information of the second data table, the table hierarchy information, and the column names, extended information, and basic column statistics of the target fields that are related to each of the first query fields and have a frequency greater than a preset threshold.

[0064] It is understood that the target database can be a medical database, and the fields stored in each data table of each medical database are related data. Therefore, the fields related to the first query field can be determined by the first data table where the first query field is located, thereby further forming the initial target data cube of the target database.

[0065] Step 3120: Perform hierarchical and joint dimension pruning on the fields of the first and second data tables, and perform k-means clustering pruning on the fields of the first and second data tables after hierarchical and joint dimension pruning to obtain the initial target data cube of the target database.

[0066] Hierarchical dimensions refer to each level containing two or more dimensions. For ease of understanding, let's illustrate hierarchical dimension pruning with an example: Province, City, County. It will only appear as Province, Province, City, or Province, City, County, never as City or County alone. Each joint dimension contains two or more dimensions. Joint dimension pruning means that in a scenario, if queries and analyses are always performed simultaneously using dimensions A, B, and C, without aggregations of A, B, or C, then the joint dimensions corresponding to aggregations of A, B, or C can be removed. k-means clustering pruning refers to performing k-means clustering on all fields of the first and second data tables after hierarchical and joint dimension pruning. This groups fields of the same cluster into the same target data cube, reducing the number of target data cubes and speeding up queries.

[0067] Step 3130: Based on the initial target data cube of the target database and the query log data, determine the target data cube to be executed for each first query field in the query log data.

[0068] Specifically, step 3130 includes steps 3131 to 3132.

[0069] Step 3131: Based on the association rule, determine the association rule target data cube of the at least one first query field in the initial target data cube of the target database; and / or, based on the query log data, determine the frequent itemset target data cube in the initial target data cube of the target database whose query count ranking is greater than a third preset threshold.

[0070] Step 3132: Based on the association rule target data cube and the frequent itemset target data cube, determine the target data cube to be executed for each first query field in the query log data.

[0071] This step can be understood as prioritizing queries that are frequently executed or have relevance, thereby improving query efficiency.

[0072] Step 320: Determine the final target data cube based on the target data cube to be executed and the conditional entropy correlation algorithm.

[0073] In one embodiment, such as Figure 4 As shown, step 320 above includes the following steps:

[0074] Step 410: Based on the first occurrence of the target dimension field combination, the second occurrence of the target metric field, the third occurrence of the target metric field and the target dimension field combination in the target data cube to be executed, and the total occurrence of the first combination of the target dimension field combination and the target metric field in the target data cube to be executed, and in conjunction with the conditional entropy formula, determine the correlation between fields in each target data cube to be executed.

[0075] The correlation between fields in each target data cube that needs to be executed can be understood as the correlation between the target dimension field combination and the target metric field in each first combination of each target data cube that needs to be executed.

[0076] In this invention, dimension fields refer to descriptive fields, while metric fields refer to fields used for final effect evaluation or statistical calculation. Numerical fields or label fields can be simply used as metrics. For example, dimension fields could be alcohol consumption or years of smoking, and medical metric fields could be, for example, whether or not one has hypertension.

[0077] The correlation between each target dimension field combination and the target metric field in each target data cube to be executed can be understood as the correlation between fields in at least one first combination in each target data cube to be executed. It can be understood that a target data cube can contain at least one target dimension field and at least one target metric field, and a target dimension field combination includes one or more target dimension fields. Therefore, a target data cube contains one or more target dimension field combinations, and each target dimension field combination can form a first combination with a target metric field. Therefore, there is at least one corresponding first combination. Thus, the corresponding correlation can be calculated for each first combination in a target data cube and saved to the first pre-computation cache module, facilitating subsequent selection of field combinations based on the correlation between fields in each first combination.

[0078] Furthermore, the conditional entropy formulas for dimension fields and measure fields are as follows: Where D represents the metric field, A represents the dimension field, and H(D|A) represents the uncertainty of the corresponding metric field when the dimension field appears. For example, H(D|A) can represent the probability of developing hypertension given the amount of alcohol consumed and the number of years of smoking. N is the total number of target metric field combinations in each target data cube to be executed, count(d) is the first occurrence of the target dimension field combination d in each target data cube to be executed, count(a) is the second occurrence of the target metric field a in each target data cube to be executed, and count(a,d) is the third occurrence of the target metric field a and the target dimension field combination d together in each target data cube to be executed.

[0079] Therefore, based on the above conditional entropy formula combined with the information gain formula g(D,A)=H(D)-H(D|A), the formula for calculating the correlation r1 between fields in each target data cube can be obtained as follows: Where M is the total number of target metric fields in each target data cube that needs to be executed, and total is the total number of times the first combination of the target dimension field combination d and the target metric field a appears in each target data cube that needs to be executed.

[0080] To facilitate understanding, the following example illustrates the calculation process of the correlation r1 between fields in each target data cube. Assume the target dimension field combination {years of smoking, amount of alcohol consumed per instance} and the target metric field for whether or not one suffers from hypertension are shown in the table below:

[0081]

[0082] The process for calculating the correlation coefficient between the combination of dimensions {number of years of smoking, amount of alcohol consumed per instance} and whether or not one has hypertension is as follows:

[0083]

[0084] Among them, the number of ({m1,n2},no) is 0, therefore, The value is 0. Therefore,

[0085]

[0086] Step 420: Save the correlation and the corresponding first query statement identifier information to the data cube meta database.

[0087] The first query statement identifier is used to identify the relevant query conditions. Therefore, when the query conditions in the query request entered by the user contain the first query statement identifier, the corresponding relevant information can be obtained from the data cube meta database, which facilitates further data exploration by the user.

[0088] Step 430: Based on the correlation, at least one first combination in each target data cube to be executed is arranged in order, and the field combination in the at least one first combination whose order is greater than a first preset threshold is determined as a second combination, and the final target data cube is determined based on the second combination.

[0089] As mentioned earlier, a target data cube includes at least one first combination. Since the correlation can be calculated for each first combination, the correlation between the target dimension field combination and the target metric field of each first combination can be obtained. Based on the correlation, at least one first combination can be sorted, and the field combination with a sequence greater than a first preset threshold in the at least one first combination can be determined as the second combination. Based on the second combination, the field composition of the final target data cube can be determined, thereby filtering the data in the target data cube and reducing the number of fields with weak correlation in the target data cube, making the field relationship of the target data cube more concise and effective.

[0090] In one embodiment, the method further includes: establishing access permission priorities for tree nodes at different levels in each of the at least one tree branch based on the data cube metadata database; and establishing a mapping table between different users and tree nodes of at least one tree branch.

[0091] Specifically, the access permission priority of the tree node corresponding to the parent node can be set to be higher than the access permission priority of the child node.

[0092] In addition, a mapping table between different users and tree nodes of at least one tree branch is used to reflect the access permissions of different users to tree nodes of different tree branches.

[0093] It is understandable that by setting the aforementioned access permission priorities, warnings are issued for the data access process, restricting unauthorized data operations. Similarly, by setting the aforementioned mapping table, warnings are issued for the data access process, restricting access for unauthorized users.

[0094] In one embodiment, such as Figure 5 As shown, step 120 above includes at least one of the following steps:

[0095] Step 510: Based on the preset index operator, determine the index identifier and index order between fields in the final target data cube, and save the index identifier and index order, as well as the corresponding second query statement identifier information, to the data cube metadata database.

[0096] The second query statement identifier is used to identify the index identifier and index order of fields in the target data cube. Therefore, when the query conditions in the query request entered by the user include the second query statement identifier, the index identifier and index order of the corresponding fields can be obtained from the data cube meta-database, which helps to speed up the data query process.

[0097] Step 520: Based on the basic statistical operators, determine the statistical information and data distribution information of the fields in the final target data cube, and save the statistical information, data distribution information, and the corresponding third query statement identifier information to the data cube meta-database.

[0098] The third query statement identifier is used to identify the query conditions for the statistical information and data distribution information of the fields in the final target data cube. Therefore, when the query conditions in the query request entered by the user include the third query statement identifier, the statistical information and data distribution information of the corresponding fields can be obtained from the data cube meta-database, which helps to speed up the data query process.

[0099] The statistical information of the corresponding fields in the second combination includes at least one of the following: summation, count, average, minimum value, and maximum value. The data distribution information includes at least one of the following: percentage, variance, root mean square deviation, standard deviation, bias, and kurtosis.

[0100] Step 530: Based on medical operators, determine the medical statistical indicators of the fields in the final target data cube, and save the medical statistical indicators and the corresponding fourth query statement identification information to the data cube meta-database.

[0101] The medical statistical indicators are those required for medical statistics, including at least one of the following: mortality rate, age-specific mortality rate, cause-specific mortality rate, cause-of-death composition, morbidity rate, prevalence rate, case fatality rate, cure rate, survival rate, and median survival. The fourth query statement identifier is used to identify the query conditions for the second combination of medical statistical indicators. Therefore, when the query conditions in the user's query request contain the fourth query statement identifier, the corresponding second combination of medical statistical indicators can be retrieved from the data cube metadata database, thereby accelerating the data query process.

[0102] Step 540: Associate the relevant fields in the final target data cube to obtain a wide table without aggregation, determine the association relationship of the fields as a pre-association operator, and save the pre-association operator and the corresponding fifth query statement identifier information to the data cube meta-database.

[0103] Specifically, the first data table and the second data table can be linked using the join method in the database.

[0104] It is understandable that since there is more than one data table containing the first query field, and there is also more than one second data table determined based on the association rules, there can be multiple first and second data tables determined in step 3110. Therefore, associating the first and second data tables can be used to associate all the first and second data tables determined in step 3110, thereby obtaining a wide table without aggregation. This prepares the data for directly retrieving the corresponding data from the corresponding wide table without aggregation in the subsequent data query process, thus speeding up the data query to a certain extent.

[0105] It's understandable that by saving the index identifiers and index order between fields in the target data cube to the data cube metadata database, the computer can quickly retrieve the field's index in the target data cube from the metadata database when receiving a user's query request, thus speeding up data retrieval. Similarly, by pre-calculating and saving statistical information, data distribution information, and medical statistical indicators, subsequent queries for the same fields can directly retrieve the relevant information from the corresponding data cube metadata database, reducing temporary calculation time and thus accelerating data retrieval.

[0106] In one embodiment, after determining the data cube metadata database based on the final target data cube, the method further includes:

[0107] Based on the hierarchical structure and the number of data entries in the final target data cube, the target data cubes containing the first query field are marked sequentially to obtain a tree-structured target data cube library of the first query field.

[0108] The hierarchical structure can be, for example, a tree structure composed of (a)->(a,b)->(a,b,c)->(a,b,c,d)->(a,b,c,d,e), where a, b, c, d, and e each represent a field. The top-level data structure (a,b) has the fewest fields. Following the hierarchical structure downwards, and combining the above example, the final target data cube can have the number of data rows corresponding to fields a and b in (a,b). For details, refer to [reference needed]. Figure 6 For the sake of brevity, the content shown will not be elaborated upon here.

[0109] Specifically, according to the hierarchical structure, the target data cube with the fewest data rows can be selected from the top to the bottom and marked, and the target data cube with the fewest marked data rows can be determined as one of the target data cubes in the tree structure target data cube library.

[0110] Combination Figure 6 If the target data cube to be executed is a circle, and the base cuboid is a box, if (a,b) is detected in the target data cube library, then the target data cube with the smallest number of data rows is selected from the parent containing (a,b). For example, among (a,b,c), (a,b,d), and (a,b,e), the one with the smallest number of data rows is (a,b,c), so (a,b,c) is selected as the marker. Then, the cuboid with the smallest number of data rows is selected from the parent containing (a,b,c), such as (a,b,c,d). Since (a,b,c,d) is already the base cuboid (a,b,c,d), (a)->(a,b)->(a,b,c,d)->(a,b,c,d,e) forms a complete tree branch. Therefore, a touched marker can be marked on this complete tree branch. Specifically, the touched markers in the above example can be found in [reference needed]. Figure 6 The black-marked circles or squares in the diagram illustrate this. By selecting the target data cube with the fewest data entries, marking it, and forming tree branches, the amount of data that needs to be queried during data lookup can be reduced, thus speeding up the query process. In this way, the scattered target data cubes in the target data cube library are organized into a tree structure, facilitating subsequent calculations based on the target data cubes in the library, thereby forming a hierarchical data cube caching mechanism.

[0111] In one embodiment, determining the index identifiers and index order among fields in the final target data cube based on a preset index operator includes:

[0112] From the final target data cube, determine the composite index identifier of the largest parent class of the field set in the final target data cube, and determine the index order of each data table in the final target data cube based on the number of data corresponding to each field in the final target data cube.

[0113] Specifically, we can iterate through the final target data cube. If every field in the field set of the final target data cube is in the same table, then we extract the corresponding fields and take the largest parent class of these field sets. For example, if the dimension set of cuboid1 is {a1,a2,a3,a4} and the dimension set of cuboid2 is {a1,a2}, and a1, a2, a3, and a4 are fields in the same table A, then we create a composite index of the largest parent class {a1,a2,a3,a4} for A. The index order is determined by the number of data corresponding to each field. For example, if the number of data for {a1} is greater than the number of data for {a2}, {a3}, and {a4}, then we put a1 first.

[0114] In one embodiment, if the target data cube corresponding to the second query field is not found in the data cube meta-database, the method further includes:

[0115] From the data cube metadata database, find the parent target data cube of the target data cube, and determine the query result of the query conditions based on the parent target data cube of the target data cube.

[0116] For example, when a user requests information about field (a, b), the tree-like hierarchical structure of the data cube metadata database can be traversed. There are two scenarios: one is that the information about field (a, b) exists in the data cube metadata database, and the cached version of (a, b) is directly returned to the user; the other is that the target data cube for (a, b) does not exist in the data cube metadata database, in which case the parent target data cube containing the information about field (a, b) can be found, such as (a, b, c) in the tree-like target data cube, and the query result can be obtained from the target data cube corresponding to (a, b, c).

[0117] Figure 6This is a schematic diagram of the data cube metadata database provided by the present invention. In the diagram, squares identify basecuboids, circles identify target data cubes to be executed, and black squares and circles exemplarily show the corresponding marked target data cubes on a tree branch. Hollow circles identify marked target data cubes to be executed, hollow squares identify marked base cuboids, squares with crosses identify unmarked base cuboids, and squares with crosses identify unmarked target data cubes to be executed. Marked target data cubes to be executed and marked base cuboids represent target data cubes that will participate in pre-computation, while unmarked target data cubes to be executed and unmarked base cuboids represent target data cubes that will not participate in pre-computation. The path (a)->(a,b)->(a,b,c)->(a,b,c,d)->(a,b,c,d,e) forms a complete hierarchical tree branch. If (a) represents the target data cube corresponding to the second query field, then its parent target data cube is (a,b).

[0118] Figure 7 This is a schematic diagram of a framework for the data query method provided by the present invention. For example... Figure 7 As shown, medical researchers and doctors can submit query requests with query fields and conditions. Upon receiving a query request, the system automatically looks up the relevant data cubes in the tree-structured metadata database. If no relevant data cube is found, the relevant query fields and conditions are passively enhanced, meaning the corresponding information can be calculated immediately from the parent target data cube of the relevant data cube. If a relevant data cube is found, the system directly finds the data cube containing the query fields and conditions for calculation or the information that has already been calculated. The metadata database can be executed automatically at regular intervals, proceeding sequentially upwards from the base cucboid according to the tree structure of the data cube metadata database.

[0119] Figure 8 This is a schematic diagram of a framework for determining the target data cube to be executed, as provided by the present invention. Figure 8As shown, firstly, all reachable cuboids in the database are calculated (corresponding to the first data table and its first metadata, and the second data table and its second metadata mentioned earlier). Then, initial target data cubes are generated using techniques such as hierarchical dimensional pruning, joint dimensional pruning, and k-means clustering pruning. Next, target data cubes are selected from the initial target data cubes and added to the target data cubes to be executed. Generally, there are two methods: 1. Using SQL query logs, based on query access counts, the most frequently occurring query results (the top k) are selected from the initial target data cubes to construct frequent itemset target data cubes (frequent query cuboids) and added to the list of target data cubes to be executed. 2. Through association rule mining, related query statements are discovered from the SQL query logs, and the relevant association rule cuboids are added to the target data cubes to be executed. It can be understood that the above methods prioritize processing queries with high counts or high relevance, thereby improving query efficiency. Simultaneously, because reachable cuboids are pre-calculated and pruned, the computational load is effectively reduced, speeding up the query process.

[0120] Figure 9 This is a schematic diagram of a framework for determining the data cube metadata database provided by the present invention. For example... Figure 9 As shown, by mapping the data structures of medical databases such as HIS, EMR, and CIS to the data cube meta-database, users can search for query fields and conditions in the data cube meta-database, find the corresponding target data cube, and then retrieve the pre-calculated real data from the corresponding data cube cache library.

[0121] The data query device provided by the present invention is described below. The data query device described below and the data query method described above can be referred to in correspondence.

[0122] like Figure 10 As shown, in one embodiment, a data query device is provided, which may include:

[0123] The first determining module 1010 is used to determine a target data cube based on the target database, the first query field in the historical query process, and the conditional entropy correlation algorithm; the conditional entropy correlation algorithm is used to determine the correlation between fields in the target data cube to be executed based on the number of times a field or field combination appears in the historical query process; the correlation is used to filter the field combinations in the target data cube to be executed.

[0124] The second determining module 1020 is used to determine a data cube metadata database based on the target data cube; the data cube metadata database includes tree nodes of at least one tree branch;

[0125] Storage module 1030 is used to store the data of the parent nodes at different levels in each tree branch in the at least one tree branch on different storage nodes based on the consistent hashing algorithm and the access volume of different tree nodes; and to store the data of tree nodes with different access volumes on different virtual nodes.

[0126] The lookup module 1040 is used to respond to the user's query request for the second query field and retrieve the query result corresponding to the second query field from the corresponding storage node.

[0127] The data query device provided by this invention addresses the high repetition rate of query fields and conditions in statistical queries of medical fusion databases. By organizing the fields queried in historical queries into the form of data cubes and saving the corresponding data cube metadata database, it facilitates direct retrieval of the corresponding query field information from the data cube metadata database when duplicate query fields are received again, thereby accelerating the query speed. Furthermore, based on the defined data cube metadata database, a consistent hashing algorithm is used to distribute the data of tree nodes of each branch in the data cube metadata database to different storage nodes or different virtual nodes. This allows data from tree nodes with large amounts of data to be distributed and stored in different storage locations, thereby distributing the data query pressure and accelerating the data query speed. Furthermore, when medical researchers conduct data exploration, there is no simple and quick method to calculate the correlation between fields, which affects the progress of medical data exploration. The data query method of this invention proposes to determine the correlation between fields in the target data cube to be executed by calculating the correlation between fields in the medical database based on the conditional entropy correlation algorithm and the frequency of occurrence of fields or field combinations in the historical query process. Based on the correlation, the combination of fields in the target data cube to be executed is filtered. This enables simple and quick calculation of the correlation between multiple fields, which facilitates the simple and quick determination of the data cube, thereby improving the efficiency of subsequent data exploration and querying of related fields in the data cube.

[0128] Figure 11 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 11As shown, the electronic device may include: a processor 1110, a communications interface 1120, a memory 1130, and a communications bus 1140, wherein the processor 1110, the communications interface 1120, and the memory 1130 communicate with each other through the communications bus 1140. The processor 1110 can call logical instructions in the memory 1130 to execute a data query method, which includes: determining a target data cube based on a target database, a first query field in a historical query process, and a conditional entropy correlation algorithm; the conditional entropy correlation algorithm is used to determine the correlation between fields in the target data cube to be executed based on the number of times a field or field combination appears in a historical query process; the correlation is used to filter field combinations in the target data cube to be executed; determining a data cube metadata database based on the target data cube; the data cube metadata database includes tree nodes of at least one tree branch; storing the data of parent nodes at different levels in each tree branch in the at least one tree branch on different storage nodes based on a consistent hashing algorithm and the access volume of different tree nodes; and storing the data of tree nodes with different access volumes on different virtual nodes; and, in response to a query request from the user terminal for a second query field, searching for the query result corresponding to the second query field from the corresponding storage node.

[0129] Furthermore, the logical instructions in the aforementioned memory 1130 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0130] On the other hand, the present invention also provides a computer program product, the computer program product comprising a computer program stored on a non-transitory computer-readable storage medium, the computer program comprising program instructions, wherein when the program instructions are executed by a computer, the computer is able to execute the data query method provided by the present invention, the data query method comprising: determining a target data cube based on a target database, a first query field in a historical query process, and a conditional entropy correlation algorithm; the conditional entropy correlation algorithm being used to determine the correlation between fields in the target data cube to be executed based on the number of times a field or field combination appears in a historical query process; the correlation being used for filtering field combinations in the target data cube to be executed; determining a data cube meta-database based on the target data cube; the data cube meta-database comprising tree nodes of at least one tree branch; storing the data of parent nodes at different levels in each tree branch in the at least one tree branch on different storage nodes based on a consistent hashing algorithm and the access volume of different tree nodes; and storing the data of tree nodes with different access volumes on different virtual nodes; and, in response to a user's query request for a second query field, searching for the query result corresponding to the second query field from the corresponding storage node.

[0131] In another aspect, the present invention also provides a non-transitory computer-readable storage medium storing a computer program thereon. When executed by a processor, the computer program implements the data query method provided by the present invention. The data query method includes: determining a target data cube based on a target database, a first query field in a historical query process, and a conditional entropy correlation algorithm; the conditional entropy correlation algorithm is used to determine the correlation between fields in the target data cube to be executed based on the number of times a field or field combination appears in a historical query process; the correlation is used for filtering field combinations in the target data cube to be executed; determining a data cube meta-database based on the target data cube; the data cube meta-database includes tree nodes of at least one tree branch; storing the data of parent nodes at different levels in each tree branch in the at least one tree branch on different storage nodes based on a consistent hashing algorithm and the access volume of different tree nodes; and storing the data of tree nodes with different access volumes on different virtual nodes; and, in response to a user's query request for a second query field, searching for the query result corresponding to the second query field from the corresponding storage node.

[0132] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.

[0133] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.

[0134] It is understood that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A data query method, characterized in that, The method includes: The target data cube is determined based on the target database, the first query field in the historical query process, and the conditional entropy correlation algorithm; the conditional entropy correlation algorithm is used to determine the correlation between fields in the target data cube to be executed based on the number of times a field or field combination appears in the historical query process; the correlation is used to filter the field combinations in the target data cube to be executed. Based on the target data cube, a data cube meta-database is determined; the data cube meta-database includes tree nodes of at least one tree branch; Based on the consistent hashing algorithm and the access volume of different tree nodes, the data of the parent nodes at different levels in each tree branch of the at least one tree branch are stored on different storage nodes; and the data of tree nodes with different access volumes are stored on different virtual nodes. In response to the user's query request for the second query field, retrieve the query result corresponding to the second query field from the corresponding storage node; Specifically, the step of storing data of parent nodes at different levels in each of the at least one tree branch on different storage nodes based on the consistent hashing algorithm and the access volume of different tree nodes, and storing data of tree nodes with different access volumes on different virtual nodes, includes: determining the storage node corresponding to the parent node at different levels in each tree branch by bitwise XORing the hash value of the parent node at different levels in each tree branch with the hash value of the storage node; storing the data of the parent node at different levels in each tree branch on different storage nodes based on the determined storage node corresponding to the parent node at different levels in each tree branch; and determining the virtual node corresponding to the tree node with different access volumes by multiplying the data access volume of the tree node with different access volumes with the hash value of the virtual node, and storing the data of the tree node with different access volumes on the corresponding virtual node.

2. The data query method according to claim 1, characterized in that, The formula corresponding to the consistent hashing algorithm is: hash(s, k, n, m, p) = (((s.hash_code() ^ p1 ^ p2 ^ p3) * (k + 1)) % n + m *hashed_color(k) % n) % n, where s.hash_code() represents the integer value obtained by hashing the identity identifier of the storage node s, ^ represents the bitwise XOR operation, p represents the tree node, p1, p2 and p3 represent the parent nodes at different levels in each tree branch, hashed_color(k) represents the integer value obtained by hashing the virtual node numbered k, n represents the size of the data volume of the tree node in the preset time period, and m represents the size of the data access volume of the tree node in the preset time period.

3. The data query method according to claim 1, characterized in that, The target data cube is determined based on the target database, the first query field in the historical query process, and the conditional entropy correlation algorithm, including: In response to a data update notification for the target data cube, based on query log data within a preset time period, the target data cube to be executed for each first query field in the query log data is determined from the target database. The final target data cube is determined based on the target data cube to be executed and the conditional entropy correlation algorithm.

4. The data query method according to claim 3, characterized in that, The process of determining the final target data cube based on the target data cube to be executed and the conditional entropy correlation algorithm includes: Based on the first occurrence of the target dimension field combination, the second occurrence of the target metric field, the third occurrence of the target metric field and the target dimension field combination in the target data cube to be executed, and the total occurrence of the first combination of the target dimension field combination and the target metric field in the target data cube to be executed, the correlation between fields in each target data cube to be executed is determined by combining the conditional entropy formula. The correlation and the corresponding first query statement identifier information are saved to the data cube meta database; Based on the correlation, at least one first combination in each target data cube that needs to be executed is arranged in order, and the field combination in the at least one first combination whose order is greater than a first preset threshold is determined as a second combination, and the final target data cube is determined based on the second combination.

5. The data query method according to claim 4, characterized in that, The formula for calculating the correlation r1 between fields in each target data cube is: Where M is the total number of target metric fields in each target data cube to be executed, N is the total number of combinations of target metric fields in each target data cube to be executed, count(d) is the first occurrence of target dimension field combination d in each target data cube to be executed, count(a) is the second occurrence of target metric field a in each target data cube to be executed, count(a,d) is the third occurrence of target metric field a and target dimension field combination d together in each target data cube to be executed, and total is the total number of occurrences of the first combination formed by the target dimension field combination and the target metric field in each target data cube to be executed.

6. The data query method according to claim 1, characterized in that, The method further includes: Based on the data cube meta-database, establish access permission priorities for tree nodes at different levels in each of the at least one tree branch; and establish a mapping table between different users and tree nodes of at least one tree branch.

7. A data query device, characterized in that, The device includes: The first determining module is used to determine the target data cube based on the target database, the first query field in the historical query process, and the conditional entropy correlation algorithm; the conditional entropy correlation algorithm is used to determine the correlation between fields in the target data cube to be executed based on the number of times a field or field combination appears in the historical query process; the correlation is used to filter the field combinations in the target data cube to be executed. The second determining module is used to determine the data cube metadata database based on the target data cube; the data cube metadata database includes tree nodes of at least one tree branch; A storage module is used to store data of parent nodes at different levels in each of the at least one tree branch onto different storage nodes based on a consistent hashing algorithm and the access volume of different tree nodes; and to store data of tree nodes with different access volumes onto different virtual nodes; wherein, the step of storing data of parent nodes at different levels in each of the at least one tree branch onto different storage nodes based on a consistent hashing algorithm and the access volume of different tree nodes, and storing data of tree nodes with different access volumes onto different virtual nodes, includes: determining the storage node corresponding to the parent node at different levels in each tree branch by bitwise XORing the hash value of the parent node at different levels in each tree branch with the hash value of the storage node; and storing the data of the parent node at different levels in each tree branch onto different storage nodes based on the determined storage node corresponding to the parent node at different levels in each tree branch; and determining the virtual node corresponding to the tree node with different access volumes by multiplying the data access volume of the tree node with different access volumes with the hash value of the virtual node, and storing the data of the tree node with different access volumes onto the corresponding virtual node. The lookup module is used to respond to the user's query request for the second query field and retrieve the query result corresponding to the second query field from the corresponding storage node.

8. A computer device, comprising a memory and a processor, characterized in that, The memory stores computer-readable instructions that, when executed by the processor, cause the processor to perform the steps of the data query method as described in any one of claims 1 to 6.

9. A storage medium storing computer-readable instructions, characterized in that, When the computer-readable instructions are executed by one or more processors, the one or more processors perform the steps of the data query method as described in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Load balancing method and device based on cloud cluster

    CN113596094A

  • Data cube configuration method and device, electronic equipment and storage medium

    CN115510289A