Data query method, device and system

By pooling memory resources and distributed routing management in distributed databases, cache and optimize query results of hotspot SQL, the problems of insufficient data caching capabilities and low query efficiency in distributed databases are solved, and efficient data caching and query access are achieved.

CN119719141AInactive Publication Date: 2025-03-28XIAN TONGXING HENGYAO INFORMATION TECHNOLOGY CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202510206020.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-24
Publication Date
2025-03-28
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

In distributed databases, it is difficult for the existing technology to efficiently cache and access query results of hotspot SQL, resulting in insufficient data caching capabilities and low query efficiency.

Method used

By performing logical management of memory resource pooling in a distributed database, the query results of high-frequency query SQL are cached into the memory of all nodes in a distributed form, and combined with distributed routing management capabilities, the rewriting and query routing of SQL are optimized.

Benefits of technology

It greatly improves the data caching capability of distributed databases, significantly improves the access efficiency of hotspot SQL, and efficiently utilizes all available memory.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119719141A_ABST
    Figure CN119719141A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a data query method, device and system, and relates to the technical field of computers, in particular to the technical field of databases. One specific embodiment of the data query method comprises the steps that based on the data distribution condition in a distributed database, a structured query language (SQL) is rewritten into at least one sub-SQL, and one sub-SQL corresponds to one storage engine node; querying the access frequency of at least one sub-SQL in a distributed memory unit; acquiring data corresponding to the sub-SQL of which the access frequency reaches a preset frequency threshold value from the distributed memory unit, and acquiring data corresponding to the sub-SQL of which the access frequency does not reach the preset frequency threshold value from the storage engine node; and summarizing the data corresponding to the at least one sub-SQL to generate the data corresponding to the SQL. According to the embodiment, the data caching capability of the distributed database is greatly improved, and the access efficiency of the hotspot SQL is greatly improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present disclosure relate to the field of computer technology, and more particularly, to the field of database technology. Background Art

[0002] Currently, databases are developing rapidly, and distributed databases are gradually becoming the mainstream architecture. In a distributed architecture, storage capacity and access performance are easy to scale horizontally, and data is distributed in server clusters on multiple physical or logical nodes. Each node can manage a portion of the data or assume part of the functions of the database cluster. Above the storage engine is the computing engine, which implements data segmentation and routing.

[0003] Through the network for communication and coordination, the client may need to interact with the storage engine through the distributed computing engine. The distributed database contains multiple computing engines and multiple storage engines. When an application accesses a distributed database, the access request is routed to a computing engine node through load balancing, and the computing engine is responsible for the interaction of this SQL (Structured Query Language) request. Summary of the invention

[0004] The embodiments of the present disclosure provide a data query method, device, and system.

[0005] In a first aspect, an embodiment of the present disclosure provides a data query method, the method comprising: based on the data distribution in a distributed database, rewriting a structured query language SQL into at least one sub-SQL, wherein one sub-SQL corresponds to a storage engine node; querying the access frequency of at least one sub-SQL in a distributed memory unit; obtaining data corresponding to a sub-SQL whose access frequency reaches a preset frequency threshold from the distributed memory unit, and obtaining data corresponding to a sub-SQL whose access frequency does not reach the preset frequency threshold from the storage engine node; aggregating the data corresponding to at least one sub-SQL to generate data corresponding to SQL.

[0006] In a second aspect, an embodiment of the present disclosure provides a data query device, which includes: a rewriting module, configured to rewrite a structured query language SQL into at least one sub-SQL based on the data distribution in a distributed database, wherein one sub-SQL corresponds to a storage engine node; a query module, configured to query the access frequency of at least one sub-SQL in a distributed memory unit; an acquisition module, configured to acquire data corresponding to a sub-SQL whose access frequency reaches a preset frequency threshold from the distributed memory unit, and to acquire data corresponding to a sub-SQL whose access frequency does not reach the preset frequency threshold from the storage engine node; and an aggregation module, configured to aggregate the data corresponding to at least one sub-SQL to generate data corresponding to SQL.

[0007] In a third aspect, an embodiment of the present disclosure provides a data query system, including: a virtual server, a computing engine node cluster and a storage engine node cluster; the virtual server is configured to receive a structured query language SQL and point the SQL to a computing engine node in the computing engine node cluster; the computing engine node is configured to rewrite the SQL into at least one sub-SQL based on the data distribution in the distributed database, wherein one sub-SQL corresponds to a storage engine node in the storage engine node cluster; query the access frequency of at least one sub-SQL in the distributed memory unit; obtain data corresponding to the sub-SQL whose access frequency reaches a preset frequency threshold from the distributed memory unit; obtain data corresponding to the sub-SQL whose access frequency does not reach the preset frequency threshold from the storage engine node; aggregate the data corresponding to at least one sub-SQL to generate data corresponding to the SQL.

[0008] In a fourth aspect, an embodiment of the present disclosure provides an electronic device, comprising: one or more processors; a storage device for storing one or more programs; when the one or more programs are executed by one or more processors, the one or more processors implement the method described in any implementation manner in the first aspect.

[0009] In a fifth aspect, an embodiment of the present disclosure provides a computer-readable medium having a computer program stored thereon, which, when executed by a processor, implements the method described in any implementation manner in the first aspect.

[0010] In a sixth aspect, an embodiment of the present disclosure proposes a computer program product, including a computer program, which implements the method described in any implementation manner of the first aspect when executed by a processor.

[0011] The method provided by the above-mentioned embodiment of the present disclosure provides a logical management of resource pooling of the memory of all physical nodes in a distributed database, and combines the distributed routing management capability to cache the query results of high-frequency query SQL in a distributed manner in the memory of all nodes, thereby greatly improving the data caching capability of the distributed database and significantly improving the access efficiency of hot SQL. BRIEF DESCRIPTION OF THE DRAWINGS

[0012] Other features, objects and advantages of the present disclosure will become more apparent from the detailed description of non-limiting embodiments made with reference to the following drawings: Figure 1 is a flow chart of an embodiment of a data query method according to the present disclosure; Figure 2 It is a SQL query graph with memory resource pooling; Figure 3 This is a diagram of the working principle of memory resource pooling; Figure 4 is a structural schematic diagram of an embodiment of a data query device according to the present disclosure; Figure 5 It is a schematic diagram of the structure of an electronic device suitable for implementing the embodiments of the present disclosure. DETAILED DESCRIPTION

[0013] The present disclosure is further described in detail below in conjunction with the accompanying drawings and embodiments. It is understood that the specific embodiments described herein are only used to explain the relevant invention, rather than to limit the invention. It is also necessary to explain that, for ease of description, only the parts related to the relevant invention are shown in the accompanying drawings.

[0014] It should be noted that in the technical solution of the present invention, the collection / collection, updating, analysis, use, transmission, storage and other aspects of user personal information involved are in compliance with the provisions of relevant laws and regulations, are used for legal and reasonable purposes, are not shared, leaked or sold outside of these legal uses, and are subject to supervision and management by regulatory authorities. Necessary measures should be taken for user personal information to selectively block the use or access to personal information data to prevent illegal access to such personal information data, ensure that persons who have access to personal information data comply with the provisions of relevant laws and regulations, and ensure the security of user personal information. In addition, once these user personal information data are no longer needed, the risks should be minimized by limiting or even prohibiting data collection and / or deleting data.

[0015] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present disclosure may be combined with each other. The present disclosure will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.

[0016] Figure 1 A process 100 of an embodiment of a data storage method according to the present disclosure is shown. The data storage method comprises the following steps: Step 101: rewrite the structured query language SQL into at least one sub-SQL based on the data distribution in the distributed database.

[0017] In this embodiment, the computing engine node can rewrite the SQL into at least one sub-SQL based on the data distribution in the distributed database, wherein one sub-SQL can correspond to one storage engine node.

[0018] A distributed database may include a computing engine node cluster and a storage engine node cluster. A computing engine node cluster may include multiple computing engine nodes. A storage engine node cluster may include multiple storage engine nodes. Data in a distributed database may be distributed in a storage engine node cluster, and each storage engine node may manage part of the data in the distributed database or assume part of the functions of the distributed database. Above the storage engine node is a computing engine node, which is used to implement data segmentation and routing.

[0019] Business applications can initiate SQL query requests. Through load balancing, the SQL can be directed to a computing engine node in the computing engine node cluster. The computing engine node can establish handshake communication with the application node through access protocol management and perform access permission verification on the SQL. For SQL that passes access permission verification, data query can be performed. For SQL that fails access permission verification, it can be discarded.

[0020] After passing the access rights verification, the computing engine node can perform SQL parsing and SQL optimization, and rewrite SQL through distributed routing rules. After SQL rewriting, the original SQL can be rewritten into at least one sub-SQL based on the data distribution in the distributed database, corresponding to the corresponding underlying storage engine node.

[0021] For example, the original SQL query is for information about people between the ages of 6 and 20. Information about people between the ages of 6 and 10 is stored in one storage engine node, information about people between the ages of 11 and 15 is stored in one storage engine node, and information about people between the ages of 16 and 20 is stored in one storage engine node. Based on the data distribution, the original SQL can be rewritten into three sub-SQLs. One sub-SQL query is for information about people between the ages of 6 and 10. One sub-SQL query is for information about people between the ages of 11 and 15. One sub-SQL query is for information about people between the ages of 16 and 20.

[0022] Step 102: query the access frequency of at least one sub-SQL in the distributed memory unit.

[0023] In this embodiment, the computing engine node may query the access frequency of at least one sub-SQL in the distributed memory unit, wherein the distributed memory unit may store the access frequency of the queried sub-SQL.

[0024] The SQL distribution executor can generate a fingerprint identifier for each sub-SQL and send it to the result processing module. The result processing module can match the fingerprint identifier of each sub-SQL in the distributed memory unit to obtain the access frequency of each sub-SQL. Among them, the distributed memory unit can store the fingerprint identifier and access frequency of the queried sub-SQL accordingly.

[0025] Step 103, obtaining data corresponding to the sub-SQL whose access frequency reaches the preset frequency threshold from the distributed memory unit, and obtaining data corresponding to the sub-SQL whose access frequency does not reach the preset frequency threshold from the storage engine node.

[0026] In this embodiment, the storage engine node can obtain data corresponding to the sub-SQL whose access frequency reaches the preset frequency threshold from the distributed memory unit, and obtain data corresponding to the sub-SQL whose access frequency does not reach the preset frequency threshold from the storage engine node.

[0027] Compare the access frequency of the sub-SQL with the preset frequency threshold (such as 20 concurrent accesses within 10 seconds). If the preset frequency threshold is reached, it means that the sub-SQL is a hot SQL. The data corresponding to the hot SQL can be pre-stored in the distributed memory unit. At this time, obtain the routing rules for the data corresponding to the sub-SQL. Perform SQL query in the distributed memory unit based on the routing rules, obtain the data corresponding to the sub-SQL, and send it to the result processing module. If the preset frequency threshold is not reached, it means that the sub-SQL is not a hot SQL. At this time, the SQL distribution executor can distribute the sub-SQL to the corresponding storage engine node. The storage engine nodes can query based on the sub-SQLs they receive, obtain the data corresponding to the sub-SQLs they receive, and send them to the result processing module.

[0028] Step 104: Summarize the data corresponding to at least one sub-SQL to generate data corresponding to the SQL.

[0029] In this embodiment, the computing engine node may aggregate data corresponding to at least one sub-SQL to generate data corresponding to the SQL.

[0030] The result processing module can summarize the data returned by the storage engine nodes and distributed memory units, perform corresponding aggregation operations, generate data corresponding to the SQL, and return it to the application end.

[0031] At the same time, the result processing module can also update the access frequency of at least one sub-SQL. For the sub-SQL that is accessed for the first time, the fingerprint identifier of the sub-SQL is stored in the distributed storage unit, and its access frequency is set to 1. For the sub-SQL that is not accessed for the first time, since its fingerprint identifier has been stored in the distributed storage unit, its access frequency can be increased by 1. For the sub-SQL whose access frequency has recently reached the preset frequency threshold, its corresponding data is stored in the distributed memory unit. Specifically, the result processing module can count the access frequency of each sub-SQL according to the fingerprint identifier of the sub-SQL, and when it meets the standards of the hot spot SQL, it can be distributedly stored based on the hash value of the fingerprint identifier of the sub-SQL. The result processing module can also obtain the SQL routing rules, and based on the SQL routing rules, store the data corresponding to the sub-SQL in the corresponding distributed memory unit.

[0032] It should be noted that when the computing engine node has table changes corresponding to the cached SQL, such as insert\update\delete and DDL changes, the distributed memory unit can trigger the recycling strategy to recycle the invalid cached data.

[0033] Figure 2 The SQL query diagram of memory resource pooling is shown. The SQL query steps of memory resource pooling can be as follows: In the first step, the business application can initiate an SQL query request. Through load balancing, the SQL query request is directed to a computing engine node in the computing engine node cluster, such as node 1-computing engine.

[0034] In the second step, after receiving the SQL query request, node 1-computing engine can establish handshake communication with the application node through access protocol management and verify the access rights of SQL.

[0035] In the third step, after the access rights are verified, node 1-computing engine can perform SQL parsing and SQL optimization on the SQL, and rewrite the SQL through distributed routing rules. After SQL rewriting, the original SQL can be rewritten into at least one sub-SQL based on the data distribution in the distributed database, corresponding to the corresponding underlying storage engine node. For example, the original SQL is rewritten into 3 sub-SQLs, corresponding to nodes 3-storage engine, node 4-storage engine, and node 5-storage engine.

[0036] In the fourth step, the SQL distribution executor distributes and executes the rewritten sub-SQL, and the corresponding sub-SQL will be distributed to the corresponding storage engine node for data query. At the same time, the SQL distribution executor can also generate a fingerprint identifier for each sub-SQL and send it to the result processing module.

[0037] In the fifth step, the storage engine node can query the sub-SQL requested by the SQL distribution executor and return the queried data to the result processing module.

[0038] In the sixth step, the result processing module can aggregate the data returned by multiple storage engine nodes, perform corresponding aggregation operations, and return the final data to the application. At the same time, the result processing module can also cache SQL and results based on the access frequency of the sub-SQL fingerprint identifier.

[0039] In the seventh step, when the sub-SQL is accessed again, the SQL distribution executor does not make SQL requests from multiple storage engine nodes, but makes requests to the relevant distributed memory units based on the distributed rules of the SQL cache, directly obtains the data corresponding to the sub-SQL, and returns it to the result processor to summarize and aggregate the data corresponding to multiple sub-SQLs, and returns the aggregated data to the application end.

[0040] Figure 3 The working principle diagram of memory resource pooling is shown. The working steps of memory resource pooling can be as follows: The first step is to generate the fingerprint of the sub-SQL and send it to the result processing module for SQL hot spot frequency judgment and result caching.

[0041] The second step is to determine whether the fingerprint identifier of the sub-SQL is in the distributed memory unit and obtain the routing rules of the corresponding sub-SQL result set.

[0042] The third step is to perform SQL query based on SQL routing rules and send the queried data to the result processing module.

[0043] Step 4: If not, the SQL distribution executor can distribute the sub-SQL to the corresponding storage engine node for query. The storage engine node can return the data corresponding to the sub-SQL received by each node to the result processing module.

[0044] In the fifth step, the result processing module can summarize the data returned by multiple storage engine nodes and distributed memory units, perform corresponding aggregation operations, and return the final data to the application end.

[0045] Step 6. At the same time, the result processing module can also count the access frequency of each sub-SQL according to the fingerprint of the sub-SQL. When it meets the standard of the hot SQL, the hash value of the fingerprint of the sub-SQL is distributed and stored. The result processing module can also obtain the SQL routing rules, and based on the SQL routing rules, store the data corresponding to the sub-SQL in the corresponding distributed memory unit.

[0046] Step 7: When the computing engine node has table changes corresponding to the cached SQL, such as insert\update\delete and DDL changes, the distributed memory unit can trigger the recycling strategy to recycle the invalid cached data.

[0047] The method provided by the above-mentioned embodiment of the present disclosure provides a logical management of resource pooling of the memory of all physical nodes in a distributed database, and combines the distributed routing management capability to cache the query results of high-frequency query SQL in a distributed manner in the memory of all nodes, thereby greatly improving the data caching capability of the distributed database and significantly improving the access efficiency of hot SQL.

[0048] By logically managing the memory of all physical nodes in a resource pool in a distributed database, the memory space of each physical node except the necessary exclusive memory consumption is uniformly managed for resource caching the query data of each sub-SQL after SQL rewriting. The distributed database computing engine kernel will store the result information of each sub-SQL in the memory storage unit of each physical node in a distributed manner based on the fingerprint identification of each SQL and the hash algorithm. In this way, the SQL results with high frequency of access can be cached, and the query results of large data volumes can be distributedly stored, which greatly improves the query efficiency and result cache capacity of the distributed database kernel, efficiently uses all available memory of the distributed database, and greatly improves resource utilization and the performance of concurrent access of the distributed database.

[0049] Further references Figure 4 As an implementation of the methods shown in the above figures, the present disclosure provides an embodiment of a data query device, which is similar to Figure 1 Corresponding to the method embodiment shown, the device can be specifically applied to various electronic equipment.

[0050] like Figure 4 As shown, the data query device 400 provided in this embodiment includes a rewriting module 401, a query module 402, an acquisition module 403 and a summary module 404. The rewriting module 401 is configured to rewrite the structured query language SQL into at least one sub-SQL based on the data distribution in the distributed database, wherein one sub-SQL corresponds to one storage engine node; the query module 402 is configured to query the access frequency of at least one sub-SQL in the distributed memory unit; the acquisition module 403 is configured to acquire data corresponding to the sub-SQL whose access frequency reaches a preset frequency threshold from the distributed memory unit, and acquire data corresponding to the sub-SQL whose access frequency does not reach the preset frequency threshold from the storage engine node; the summary module 404 is configured to summarize the data corresponding to at least one sub-SQL to generate data corresponding to SQL.

[0051] In this embodiment, in the data query device 400, the specific processing of the rewriting module 401, the query module 402, the acquisition module 403 and the summary module 404 and the technical effects thereof can be referred to in Figure 1 The relevant descriptions of steps 101 - 104 in the corresponding embodiment are not repeated here.

[0052] In some optional implementations of this embodiment, the acquisition module 403 is further configured to: distribute the sub-SQLs whose access frequency does not reach the preset frequency threshold to the corresponding storage engine nodes; and receive the data obtained by the corresponding storage engine nodes through queries based on the sub-SQLs.

[0053] In some optional implementations of this embodiment, the query module 402 is further configured to: generate a fingerprint identifier of at least one sub-SQL; match the fingerprint identifier of at least one sub-SQL in a distributed memory unit to obtain an access frequency of at least one sub-SQL, wherein the distributed memory unit corresponds to storing the fingerprint identifier and access frequency of the queried sub-SQL.

[0054] In some optional implementations of this embodiment, the data query device 400 also includes: an update module, configured to update the access frequency of at least one sub-SQL; a storage module, configured to store the data corresponding to the sub-SQL whose access frequency has recently reached a preset frequency threshold in a distributed memory unit.

[0055] In some optional implementations of this embodiment, the data query device 400 further includes: a verification module configured to perform access permission verification on SQL; perform data query on SQL that passes the access permission verification, and discard SQL that fails the access permission verification.

[0056] An embodiment of a data query system according to the present disclosure is provided below. The data query system may include: a virtual server, a computing engine node cluster, and a storage engine node cluster.

[0057] The virtual server is configured to receive a structured query language SQL and direct the SQL to a computing engine node in the computing engine node cluster.

[0058] The computing engine node is configured to rewrite the SQL into at least one sub-SQL based on the data distribution in the distributed database, wherein one sub-SQL corresponds to a storage engine node in the storage engine node cluster; query the access frequency of at least one sub-SQL in the distributed memory unit; obtain data corresponding to the sub-SQL whose access frequency reaches a preset frequency threshold from the distributed memory unit; obtain data corresponding to the sub-SQL whose access frequency does not reach the preset frequency threshold from the storage engine node; summarize the data corresponding to at least one sub-SQL to generate data corresponding to the SQL.

[0059] In some optional implementations of this embodiment, the computing engine node is further configured to: distribute the sub-SQLs whose access frequency does not reach a preset frequency threshold to the corresponding storage engine nodes; the storage engine node is further configured to: perform queries based on the received sub-SQLs to obtain data; and send the data to the computing engine node.

[0060] In some optional implementations of this embodiment, the computing engine node is further configured to: generate a fingerprint identifier of at least one sub-SQL; match the fingerprint identifier of at least one sub-SQL in a distributed memory unit to obtain an access frequency of at least one sub-SQL, wherein the distributed memory unit corresponds to storing the fingerprint identifier and access frequency of the queried sub-SQL.

[0061] In some optional implementations of this embodiment, the computing engine node is further configured to: update the access frequency of at least one sub-SQL; and store the data corresponding to the sub-SQL whose access frequency has recently reached a preset frequency threshold in the distributed memory unit.

[0062] In some optional implementations of this embodiment, the computing engine node is further configured to: perform access permission verification on SQL; perform data query on SQL that passes the access permission verification, and discard SQL that fails the access permission verification.

[0063] In some optional implementations of this embodiment, the virtual server is further configured to: direct SQL to a computing engine node in the computing engine node cluster through load balancing.

[0064] Reference below Figure 5 , which shows a schematic diagram of the structure of an electronic device (such as a computing engine node) 500 suitable for implementing an embodiment of the present disclosure. The terminal device in the embodiment of the present disclosure may include but is not limited to mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 5 The server shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.

[0065] like Figure 5 As shown, the electronic device 500 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 501, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 502 or a program loaded from a storage device 508 to a random access memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the electronic device 500 are also stored. The processing device 501, the ROM 502, and the RAM 503 are connected to each other via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.

[0066] Typically, the following devices may be connected to the I / O interface 505: an input device 506 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 507 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 508 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 509. The communication device 509 may allow the electronic device 500 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 5 The electronic device 500 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead. Figure 5 Each block shown in the figure may represent one device, or may represent multiple devices as required.

[0067] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device 509, or installed from a storage device 508, or installed from a ROM 502. When the computer program is executed by the processing device 501, the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.

[0068] It should be noted that the computer-readable medium described in the embodiments of the present disclosure may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the embodiments of the present disclosure, the computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, device or device. In the embodiments of the present disclosure, the computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer readable signal media may also be any computer readable medium other than computer readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.

[0069] The computer-readable medium may be included in the electronic device; or it may exist independently without being installed in the electronic device. The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device: rewrites the structured query language SQL into at least one sub-SQL based on the data distribution in the distributed database, wherein one sub-SQL corresponds to one storage engine node; queries the access frequency of at least one sub-SQL in the distributed memory unit; obtains data corresponding to the sub-SQL whose access frequency reaches the preset frequency threshold from the distributed memory unit, and obtains data corresponding to the sub-SQL whose access frequency does not reach the preset frequency threshold from the storage engine node; and aggregates the data corresponding to at least one sub-SQL to generate data corresponding to SQL.

[0070] Computer program code for performing the operations of the embodiments of the present disclosure may be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0071] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0072] The modules involved in the embodiments described in the present disclosure may be implemented by software or hardware. The modules described may also be set in a processor, for example, it may be described as: a processor includes a rewrite module, a query module, an acquisition module and a summary module. The names of these modules do not constitute a limitation on the modules themselves in some cases. For example, the rewrite module may also be described as "a module that rewrites the structured query language SQL into at least one sub-SQL based on the data distribution in the distributed database".

[0073] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of the invention involved in the embodiments of the present disclosure is not limited to the technical solutions formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above inventive concept. For example, the above features are replaced with (but not limited to) technical features with similar functions disclosed in the embodiments of the present disclosure to form a technical solution.

Claims

1. A data query method, applied to a computing engine node, characterized in that: include: Based on the data distribution in the distributed database, the structured query language SQL is rewritten into at least one sub-SQL, where one sub-SQL corresponds to one storage engine node; Querying the access frequency of the at least one sub-SQL in the distributed memory unit; Acquire data corresponding to a sub-SQL whose access frequency reaches a preset frequency threshold from the distributed memory unit, and acquire data corresponding to a sub-SQL whose access frequency does not reach the preset frequency threshold from a storage engine node; The data corresponding to the at least one sub-SQL is aggregated to generate data corresponding to the SQL.

2. The method according to claim 1, characterized in that The step of obtaining data corresponding to a sub-SQL whose access frequency does not reach a preset frequency threshold from a storage engine node includes: Distribute the sub-SQLs whose access frequency does not reach the preset frequency threshold to the corresponding storage engine nodes; Receive the data obtained by the corresponding storage engine node based on the sub-SQL query.

3. The method according to claim 2, characterized in that The querying the access frequency of the at least one sub-SQL in the distributed memory unit includes: Generate a fingerprint identifier of the at least one sub-SQL; The fingerprint identifier of the at least one sub-SQL is matched in the distributed memory unit to obtain the access frequency of the at least one sub-SQL, wherein the distributed memory unit stores the fingerprint identifier and access frequency of the queried sub-SQL accordingly.

4. The method according to claim 3, characterized in that The method further comprises: Update the access frequency of the at least one sub-SQL; The data corresponding to the sub-SQL whose access frequency has recently reached the preset frequency threshold is stored in the distributed memory unit.

5. The method according to claim 1, characterized in that The method further comprises: The SQL is verified for access rights; data query is performed on the SQL that passes the access rights verification, and the SQL that fails the access rights verification is discarded.

6. A data query device, arranged in a computing engine node, characterized in that: include: The rewriting module is configured to rewrite the structured query language SQL into at least one sub-SQL based on the data distribution in the distributed database, wherein one sub-SQL corresponds to one storage engine node; A query module, configured to query the access frequency of the at least one sub-SQL in the distributed memory unit; an acquisition module configured to acquire data corresponding to a sub-SQL whose access frequency reaches a preset frequency threshold from the distributed memory unit, and to acquire data corresponding to a sub-SQL whose access frequency does not reach the preset frequency threshold from a storage engine node; The aggregation module is configured to aggregate the data corresponding to the at least one sub-SQL to generate data corresponding to the SQL.

7. A data query system, characterized in that: include: Virtual servers, compute engine node clusters, and storage engine node clusters; The virtual server is configured to receive a structured query language SQL and direct the SQL to a computing engine node in the computing engine node cluster; The computing engine node is configured to rewrite the SQL into at least one sub-SQL based on data distribution in the distributed database, wherein one sub-SQL corresponds to a storage engine node in the storage engine node cluster; Query the access frequency of the at least one sub-SQL in the distributed memory unit; obtain data corresponding to the sub-SQL whose access frequency reaches a preset frequency threshold from the distributed memory unit; obtain data corresponding to the sub-SQL whose access frequency does not reach the preset frequency threshold from the storage engine node; summarize the data corresponding to the at least one sub-SQL to generate data corresponding to the SQL.

8. The system according to claim 7, characterized in that The computing engine node is further configured to: distribute the sub-SQL whose access frequency does not reach the preset frequency threshold to the corresponding storage engine node; The storage engine node is further configured to: perform a query based on the received sub-SQL to obtain data; and send the data to the computing engine node.

9. The system according to claim 8, characterized in that The computing engine node is further configured to: generate a fingerprint identifier of the at least one sub-SQL; match the fingerprint identifier of the at least one sub-SQL in the distributed memory unit to obtain the access frequency of the at least one sub-SQL, wherein the distributed memory unit stores the fingerprint identifier and access frequency of the queried sub-SQL.

10. The system according to claim 9, characterized in that The computing engine node is further configured to: update the access frequency of the at least one sub-SQL; and store data corresponding to the sub-SQL whose access frequency has recently reached the preset frequency threshold in the distributed memory unit.

11. The system according to claim 7, characterized in that The computing engine node is further configured to: perform access permission verification on the SQL; perform data query on the SQL that passes the access permission verification, and discard the SQL that fails the access permission verification.

12. The system according to claim 7, characterized in that The virtual server is further configured to: direct the SQL to a computing engine node in the computing engine node cluster through load balancing.

13. An electronic device, characterized in that: include: one or more processors; a storage device having one or more programs stored thereon; When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 5.

14. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 5 is implemented.

15. A computer program product, characterized in that The invention comprises a computer program which, when executed by a processor, implements the method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Data access method, device and system based on virtual database, equipment and medium

    CN113688151A

  • Data query method and device, computer equipment and storage medium

    CN113886426A

  • Data management method, system and equipment and storage medium

    CN117453712A

  • Burst Performance of Database Queries According to Query Size

    US20200050694A1