CN116975126B - Data query method, device, computing equipment and computer readable storage medium - Google Patents

Data query method, device, computing equipment and computer readable storage medium Download PDF

Info

Publication number
CN116975126B
CN116975126B CN202311239929.5A CN202311239929A CN116975126B CN 116975126 B CN116975126 B CN 116975126B CN 202311239929 A CN202311239929 A CN 202311239929A CN 116975126 B CN116975126 B CN 116975126B
Authority
CN
China
Prior art keywords
query
target
prompt
block
query block
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202311239929.5A
Other languages
Chinese (zh)
Other versions
CN116975126A (en
Inventor
姚崇
褚华兴
张君华
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hundsun Technologies Inc
Original Assignee
Hundsun Technologies Inc
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hundsun Technologies Inc filed Critical Hundsun Technologies Inc
Priority to CN202311239929.5A priority Critical patent/CN116975126B/en
Publication of CN116975126A publication Critical patent/CN116975126A/en
Application granted granted Critical
Publication of CN116975126B publication Critical patent/CN116975126B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2458Special types of queries, e.g. statistical queries, fuzzy queries or distributed queries
    • G06F16/2471Distributed queries
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/242Query formulation
    • G06F16/2433Query languages
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2453Query optimisation
    • G06F16/24534Query rewriting; Transformation

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • General Physics & Mathematics (AREA)
  • Mathematical Physics (AREA)
  • Probability & Statistics with Applications (AREA)
  • Software Systems (AREA)
  • Fuzzy Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

Embodiments of the present application provide a data query method, apparatus, computing device, and computer readable storage medium, where the data query method includes: acquiring a query request, wherein the query request comprises at least one query block, and the query block is obtained based on query object division; analyzing at least one query block to obtain prompt information corresponding to each query block; generating an execution plan of each query block based on the prompt information corresponding to each query block; performing inverse analysis on the execution plans of the query blocks respectively to obtain target query sentences corresponding to the query blocks; and sending each target query statement to the distributed query node so that the distributed query node executes a query task based on each target query statement to obtain a data query result. Generating an execution plan of each query block, obtaining target query sentences of each query block, executing query tasks at distributed query nodes, realizing fine granularity control on the generation of the execution plan, and improving the efficiency of processing query requests.

Description

Data query method, device, computing equipment and computer readable storage medium
Technical Field
Embodiments of the present disclosure relate to the field of computer technologies, and in particular, to a data query method, a data query device, a computing device, and a computer readable storage medium.
Background
The database is used as the most common underlying data storage tool and is widely applied to various industries, and the processing efficiency of the database for the structured query statement is extremely high in each industry.
The processing efficiency of the database depends on the execution plan for the structured query statement to a great extent, for example, when the execution plan is generated for the structured query statement, the selection of whether the control option is opened or not is used for realizing the control of the generation of the execution plan corresponding to the whole structured query statement, so that the execution plan is generated by taking the whole structured query statement as a control unit, the granularity of the generation of the control execution plan is too coarse, and the efficiency of the database for processing the structured query statement based on the execution plan generated by coarse granularity is low, so that a method for improving the processing efficiency of the structured query statement is needed.
Disclosure of Invention
In view of this, the embodiment of the application provides a data query method. One or more embodiments of the present application relate to a data query device, a computing device, a computer-readable storage medium and a computer program, which solve the technical drawbacks of the prior art.
According to a first aspect of an embodiment of the present application, there is provided a data query method, including:
obtaining a query request, wherein the query request comprises at least one query block, and the query block is obtained based on query object division;
analyzing the at least one query block to obtain prompt information corresponding to each query block;
generating an execution plan of each query block based on the prompt information corresponding to each query block;
performing inverse analysis on the execution plans of the query blocks respectively to obtain target query sentences corresponding to the query blocks;
and sending each target query statement to a distributed query node so that the distributed query node executes a query task based on each target query statement to obtain a data query result.
According to a second aspect of embodiments of the present application, there is provided a data query device, including:
the acquisition module is configured to acquire a query request, wherein the query request comprises at least one query block, and the query block is divided based on a query object;
the analysis module is configured to analyze the at least one query block to obtain prompt information corresponding to each query block;
The generation module is configured to generate an execution plan of each query block based on the prompt information corresponding to each query block;
the inverse analysis module is configured to respectively carry out inverse analysis on the execution plans of the query blocks to obtain target query sentences corresponding to the query blocks;
the obtaining module is configured to send each target query statement to the distributed query node so that the distributed query node executes a query task based on each target query statement to obtain a data query result.
According to a third aspect of embodiments of the present application, there is provided a computing device comprising:
a memory and a processor;
the memory is configured to store computer-executable instructions that, when executed by the processor, perform the steps of the data query method described above.
According to a fourth aspect of embodiments of the present application, there is provided a computer-readable storage medium storing computer-executable instructions which, when executed by a processor, implement the steps of the data querying method described above.
According to a fifth aspect of embodiments of the present application, there is provided a computer program, wherein the computer program, when executed in a computer, causes the computer to perform the steps of the data query method described above.
An embodiment of the application obtains a query request, wherein the query request comprises at least one query block, and the query block is obtained based on query object division; analyzing at least one query block to obtain prompt information corresponding to each query block; generating an execution plan of each query block based on the prompt information corresponding to each query block; performing inverse analysis on the execution plans of the query blocks respectively to obtain target query sentences corresponding to the query blocks; and sending each target query statement to the distributed query node so that the distributed query node executes a query task based on each target query statement to obtain a data query result. Analyzing the query blocks to obtain prompt information corresponding to each query block, generating an execution plan of each query block based on the prompt information corresponding to each query block, controlling generation of the execution plan by granularity corresponding to the query blocks, dividing query sentences in a query request based on query objects by the query blocks, controlling generation of the execution plan by taking the query blocks as a unit, controlling generation of the execution plan corresponding to the fine-granularity query blocks relative to generation of the execution plan corresponding to the whole query sentences, realizing control of fineness and flexibility of the generation of the execution plan, performing inverse analysis on the execution plan of the query blocks to obtain target query sentences of each query block, sending the target query sentences to distributed query nodes, executing query tasks to obtain data query results, controlling generation of the fine granularity of the execution plan of the query blocks, enabling the generated execution plan to be better, further enabling efficient processing of the query request based on the better execution plan, enabling the query tasks to be executed by the distributed query nodes, enabling the query tasks to be executed in the distributed query nodes according to the better execution plan, reducing the consumption of the distributed execution plan, and improving the query task execution efficiency.
Drawings
FIG. 1 is a flow chart of a method for querying data according to one embodiment of the present application;
FIG. 2 is a flow chart of a process of a data query method according to one embodiment of the present application;
FIG. 3 is a flow chart of string parsing in a data query method according to an embodiment of the present application;
FIG. 4 is a flow chart of an execution stage in a data query method according to one embodiment of the present application;
FIG. 5 is a schematic diagram of a data query device according to an embodiment of the present application;
FIG. 6 is a block diagram of a computing device provided in one embodiment of the present application.
Detailed Description
In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present application. This application is, however, susceptible of embodiment in many other ways than those herein described and similar generalizations can be made by those skilled in the art without departing from the spirit of the application and the application is therefore not limited to the specific embodiments disclosed below.
The terminology used in one or more embodiments of the application is for the purpose of describing particular embodiments only and is not intended to be limiting of one or more embodiments of the application. As used in this application in one or more embodiments and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used in one or more embodiments of the present application refers to and encompasses any or all possible combinations of one or more of the associated listed items.
It should be understood that, although the terms first, second, etc. may be used in one or more embodiments of the present application to describe various information, these information should not be limited to these terms. These terms are only used to distinguish one type of information from another. For example, a first may also be referred to as a second, and similarly, a second may also be referred to as a first, without departing from the scope of one or more embodiments of the present application. The word "if" as used herein may be interpreted as "at … …" or "at … …" or "responsive to a determination", depending on the context.
Furthermore, it should be noted that the user information (including, but not limited to, user equipment information, user personal information, etc.) and the data (including, but not limited to, data for analysis, stored data, presented data, etc.) according to one or more embodiments of the present application are information and data authorized by the user or sufficiently authorized by the parties, and the collection, use and processing of the relevant data is required to comply with relevant laws and regulations and standards of the relevant country and region, and is provided with corresponding operation entries for the user to select authorization or rejection.
First, terms related to one or more embodiments of the present application will be explained.
Database: is an ordered set of structured information or data that is typically stored electronically in a computer system. Typically controlled by a database management system (DBMS, database Management System), in practice the data, DBMS and associated applications together are referred to as a database system, typically simply a database, which may be a relational database.
Execution plan (execution plan): is a specific step in the database to execute structured query language (SQL, structured Query Language) statements, such as accessing data in a table by indexing or full table scanning, the implementation of join queries, the order of join, etc.
A distributed architecture: the multi-node processing method has the advantages that multiple nodes are used for processing each service request so as to achieve the functions of flow sharing and pressure balancing, users have no perception difference, and stability and high availability of the system can be guaranteed, for example, the method is applied to a framework in a distributed database.
The database is used as the most common underlying data storage tool and is widely applied to various industries, and the processing efficiency of the database for the structured query statement is extremely high in each industry.
The processing efficiency of the database depends on the execution plan of the structured query statement to a great extent, and two modes are currently used for generating the execution plan, namely, when the execution plan is generated for the structured query statement, for example, the control option is selected whether to start the index or not to realize the generation of the corresponding execution plan of the whole structured query statement, so that the execution plan is generated by taking the whole structured query statement as a control unit, and the granularity of the generation of the control execution plan is too coarse; the second is to create a plug-in the database, the plug-in can be a program which is similar to a dynamic library and can be plugged in and pulled out without changing a kernel, but the generation of the control execution plan can only be performed aiming at the statement level corresponding to the query statement by creating the plug-in, the granularity of the generation of the control execution plan is still thicker, and the method of creating the plug-in the database can only be applied to a single environment, the query task can not be executed based on the execution plan by using a distributed environment, and the execution efficiency of the query task is low. In summary, both control methods make the control granularity of the execution plan generation thicker, so that finer and more flexible control cannot be performed on the generation of the execution plan, and further, the efficiency of processing the structured query sentence by the database based on the execution plan generated by coarse granularity is lower, so a method for improving the processing efficiency of the structured query sentence is needed.
In order to solve the above technical problems, in the present application, a data query method is provided, and the present application relates to a data query device, a computing device, and a computer readable storage medium, which are described in detail in the following embodiments one by one.
Referring to fig. 1, fig. 1 shows a flowchart of a data query method according to an embodiment of the present application, which specifically includes the following steps.
Step 102: obtaining a query request, wherein the query request comprises at least one query block, and the query block is obtained based on query object division.
One or more embodiments of the present invention are applied to a server to which an application having a data query function belongs, and in practical application, the present invention may be specifically applied to a database in a server.
Specifically, the query request refers to a request for querying data in a database, the query request may be in a form of a query statement identifiable by the database, for example, the query request may be in a form of a structured query statement, and the query statement of the query request includes a query request statement and a query supplement statement, where the query supplement statement is a prompt statement for prompting the database to generate an execution plan, and the prompt statement may be a prompt (hit) string. The query block refers to an execution statement block obtained by dividing the query request, the granularity of the query block is smaller than that of the query statement in the query request, and the query request is divided into query blocks based on query objects in the query request.
The query object refers to an object acted by the query request, for example, the query object may be a query manner, a query target, etc., the query manner may be a query character, the query target may be an object form of the acted object, for example, the query request includes a query statement of select from (select a) x, the query statement is divided according to the query character select, the query statement is divided into two query blocks select from a and select from x, for example, the object acted by the query request has a data table, a data graph, etc., the division acted on the data table is divided into one query block, and the division acted on the data graph is divided into one query block.
The implementation manner of obtaining the query request may be to receive a query statement submitted by a user through a front end, and take the query statement as the query request; the method can also be that a query request initiated by a user through a front end is received, the query request carries a location identifier, and a server acquires a query statement of the query request from a designated location according to the location identifier, so that the subsequent execution of a query task is performed by using the query statement of the query request, wherein the query statement at the designated location can be a query statement which is edited in advance and is executed immediately when the editing is not completed, for example, the query request is initiated at fixed time to perform the execution of the query task.
Optionally, after obtaining the query statement, dividing the query statement included in the query request based on the query object, to obtain the query request including at least one query block.
Step 104: and analyzing at least one query block to obtain prompt information corresponding to each query block.
Specifically, the hint information refers to information that hints an execution plan for generating a query block, and the hint information is stored in a hint interface structure, and includes a hint type, a acting query block identifier, an acting object, and the like.
The method includes that at least one query block is analyzed, and various implementation modes for obtaining prompt information corresponding to each query block are available, and the prompt information is determined according to actual conditions, and the method is not limited in any way.
In one possible implementation manner of the method, prompt sentences in at least one query block can be identified, and prompt information corresponding to each query block is obtained based on the prompt sentences of each query block.
In another possible implementation manner of the application, at least one query block is matched with the reference prompt keyword, at least one query block which is successfully matched is determined, prompt sentences in the at least one query block which is successfully matched are identified based on a matching result, and prompt information corresponding to each query block is obtained based on the prompt sentences in the at least one query block which is successfully matched.
The method comprises the steps of extracting prompt sentences from a query block based on the query block successfully matched with a reference prompt keyword, obtaining prompt information corresponding to the query block based on the prompt sentences, generating an execution plan of the query block based on the prompt information, and generating an execution plan based on a preset execution plan generation strategy if the prompt sentences are not successfully matched with the query block to obtain the corresponding prompt information.
Illustratively, the hint type includes a hint that controls a list lookup path; controlling prompting of the multi-table association sequence; controlling prompting of a multi-table association algorithm; controlling the prompt of whether concurrency and the concurrency degree; controlling prompt sub-query and sub-link prompt; prompting the number of lines of the control result set; setting a prompt of statement-level GUC parameters; prompt to control the group by algorithm, etc.
GUC (Grand Unified Configuration) parameters are a mechanism for opening a source database to set database variables to control the database.
The calculation process of the group by algorithm is to group all data according to fields, then to group the grouped data for aggregation operation (counting, summation, average value solving and the like), and finally to collect the aggregated data of each group to obtain a result.
And defining matched parameters for each prompt message based on the difference of prompt message corresponding prompt types corresponding to each query block so as to be used in the process of generating a corresponding execution plan based on the prompt message.
In an optional embodiment of the present application, the step of analyzing at least one query block to obtain prompt information corresponding to each query block includes the following steps:
extracting prompt sentences in each query block respectively;
and generating prompt information corresponding to each query block based on the prompt sentences in each query block.
Specifically, the prompt statement refers to a statement for prompting the execution plan generation of the query statement, the form of the prompt statement may be a statement identifiable by a database, and the existence form of the prompt statement in the structured query statement may be an annotation statement of the structured query statement, which is used for supplementing the structured query statement.
The implementation manner of extracting the prompt sentences in each query block respectively may be based on a preset extraction manner, wherein the preset extraction manner may be a latest preset first and last character, the preset first and last characters include a preset first character and a preset last character, and sentences in the query block between the preset first character and the preset last character are determined to be prompt sentences.
The implementation manner of generating the prompt information corresponding to each query block based on the prompt sentences in each query block may be to match the prompt sentences in each query block with the reference prompt keywords, and generate the prompt information corresponding to each query block based on the matching result, where the matching result includes matching success and matching failure, the query sentences corresponding to the matching success query block are divided into at least one part, and the at least one part is one or more of keywords, query block identifiers, and action objects.
The implementation manner of generating the prompt information corresponding to each query block based on the matching result may be based on at least one part obtained by dividing the query sentence in the matching query block successfully corresponding to the matching query block, and generating the prompt information corresponding to the matching query block.
The implementation manner of generating the prompt information corresponding to each query block based on the matching result may be to generate an execution plan corresponding to the matching query block based on a preset execution plan generation policy corresponding to the matching query block corresponding to the matching failure, that is, not generating the prompt information, and directly generating the execution plan.
By applying the scheme of the embodiment of the application, the prompt sentences in each query block are respectively extracted; the prompt messages corresponding to the query blocks are generated based on the prompt sentences in the query blocks respectively, and the prompt messages corresponding to the query blocks can be generated based on the prompt sentences in the query blocks by extracting the prompt sentences in the query blocks, namely, the prompt sentences are analyzed, so that the prompt messages in the execution plan generation process are obtained, and the execution plan generation efficiency is improved.
In an optional embodiment of the present application, the foregoing steps generate, based on the prompt statements in each query block, prompt information corresponding to each query block, respectively, including the following steps:
matching the prompt sentences in the query blocks with the reference prompt keywords respectively;
and generating prompt information corresponding to the first query block based on the prompt sentences in the first query block aiming at the successfully matched first query block.
Specifically, the benchmark hint keywords refer to keywords of hint types recognizable by the database processing the query request. The first query block is a query block corresponding to a statement for prompting the execution plan generation, and is processed by a database corresponding to a reference prompting keyword.
And respectively matching the prompt sentences in each query block with the reference prompt keywords, and checking whether the database for processing the query request supports the prompt sentences in each query block or not, and if so, generating prompt information corresponding to the query blocks.
The implementation way of matching the prompt sentences in the query blocks with the reference prompt keywords respectively can be to identify the keywords of the prompt sentences in the query blocks and match the keywords with the reference prompt keywords; the method can also be to match the prompt sentences in any query block with the reference prompt keywords respectively for any query block.
Aiming at the successfully matched first query block, generating a prompt message corresponding to the first query block based on prompt sentences in the first query block, namely splitting the prompt sentences of the first query block according to the matching with the reference prompt keywords aiming at the successfully matched first query block to obtain prompt parameters in the prompt sentences, and generating the prompt message corresponding to the first query block based on the prompt parameters; the prompt statement of the first query block can be analyzed for the successfully matched first query block, so that the prompt parameters of the prompt statement are obtained, and the prompt information corresponding to the first query block is constructed based on the prompt parameters.
After the prompt sentences in the query blocks are matched with the reference prompt keywords, the method further comprises generating a strategy according to a preset execution plan aiming at the second query block with failed matching, and generating an execution plan of the second query block.
By applying the scheme of the embodiment of the application, the prompt sentences in the query blocks are respectively matched with the reference prompt keywords; for a successfully matched first query block, based on prompt sentences in the first query block, prompt information corresponding to the first query block is generated, whether prompt sentences corresponding to prompt types supported by a database are contained in each query block is determined based on a matching result by matching the prompt sentences in each query block with reference keywords, and for the query blocks containing the prompt sentences corresponding to the prompt types supported by the database, the prompt information corresponding to each query block is generated, so that the prompt information is generated, and the query blocks corresponding to an execution plan are generated according to the prompt information, the prompt sentences can be used in the process of generating the execution plan, the step of continuously executing the execution plan when the system recognizes that the prompt sentences are not supported is reduced, namely, the resource waste caused by processing the query request is reduced.
In an optional embodiment of the present application, the step of generating the prompt information corresponding to the first query block based on the prompt sentence in the first query block includes the following steps:
analyzing the prompt sentences in the first query block to obtain prompt parameters of the prompt sentences in the first query block;
and constructing prompt information corresponding to the first query block based on the prompt parameters.
Specifically, the hint parameter refers to a parameter used to hint a generation process that generates an execution plan, and may include a query block identifier, an action object, a hint type, and the like.
Analyzing the prompt sentences in the first query block to obtain the implementation mode of the prompt parameters of the prompt sentences in the first query block, wherein the implementation mode can be a preset analysis mode, splitting the prompt sentences in the first query block to obtain the prompt parameters of the prompt sentences in the first query block, and the preset analysis mode can be a preset symbol.
Based on the prompt parameters, constructing a prompt structure body, and storing the prompt parameters into the prompt structure body to obtain prompt information corresponding to the first query block; the format conversion may also be performed on the prompt parameter to obtain the prompt information corresponding to the first query block, where the basis for performing the format conversion is a format identifiable in the process of generating the execution plan by the database, for example, the identifiable format is a data format carrying the parameter identifier.
By applying the scheme of the embodiment of the application, the prompt sentences in the first query block are analyzed to obtain the prompt parameters of the prompt sentences in the first query block; and constructing prompt information corresponding to the first query block based on the prompt parameters. The prompt parameters are obtained by analyzing the prompt sentences in the first query blocks, and prompt information is constructed based on the prompt parameters, so that the generation of the execution plan of the corresponding query blocks can be generated based on the prompt information in the follow-up process, and the designability and the efficiency of the generation of the execution plan are improved.
In an optional embodiment of the present application, after the parsing of the hint statement in the first query block in the above step, the method further includes the following steps:
if the prompting parameters of the prompting sentences in the first query block are not obtained, constructing prompting information corresponding to the first query block based on the keywords and the object information of the prompting sentences in the first query block.
Specifically, the object information refers to information of a query block to which the prompt statement belongs, and the object information may include a query block identifier and a query object included in the query block.
If the prompting parameters of the prompting statement in the first query block are not obtained, the prompting statement only contains keywords, and other parameters are not contained.
Based on the keywords and the object information of the prompt sentences in the first query block, constructing an implementation mode of the prompt information corresponding to the first query block, which can be to acquire the object information based on the first query block, construct a prompt structure body, and store the keywords and the object information into the prompt structure body to acquire the prompt information corresponding to the first query block; the method can also be used for acquiring the object information based on the first query block, associating the object information with the keywords, and carrying out format conversion on the information obtained by association to acquire the prompt information of the first query block, wherein the basis of format conversion is a recognizable format in the process of generating an execution plan by the database, for example, the recognizable format is a data format carrying parameter identification.
By applying the scheme of the embodiment of the application, if the prompting parameters of the prompting statement in the first query block are not obtained, the prompting information corresponding to the first query block is constructed based on the keywords and the object information of the prompting statement in the first query block. Through analyzing the prompt sentences in the first query block, if the prompt parameters are not obtained, defaulting the prompt sentences to act on all query objects in the current query block, thereby reducing the complexity in the process of setting the prompt sentences and reducing the calculation power consumption for analyzing the prompt sentences.
In an optional embodiment of the present application, the data query method further includes the following steps:
and generating a strategy according to a preset execution plan aiming at the second query block with failed matching, and generating an execution plan of the second query block.
Specifically, the second query block is a query block corresponding to a statement for prompting execution plan generation, and cannot be processed by the database corresponding to the reference prompting keyword. The preset execution plan generation policy refers to a preset policy for generating an execution plan in a database, for example, the preset execution plan generation policy refers to generation of an execution plan according to a query statement of a current query block.
According to the preset execution plan generation strategy, the implementation manner of generating the execution plan of the second query block may be to extract the execution sequence of the query statement of the second query block according to the preset execution plan generation strategy, and generate the execution plan.
By applying the scheme of the embodiment of the application, aiming at the second query block with failed matching, generating a strategy according to a preset execution plan, and generating an execution plan of the second query block. By matching the prompt sentences in each query block with the reference prompt keywords, checking whether the prompt sentences in the query blocks are prompt types supported by the database, and determining that the prompt sentences in the second query block cannot be executed in the database for generating the prompt execution plan under the condition of failure in matching, the execution plan for the second query block is generated according to the preset execution plan generation strategy of the second query block, the generation of the corresponding execution plan for any query block is realized, and the efficiency of executing the query task by using the execution plan in the follow-up is improved.
Step 106: and generating an execution plan of each query block based on the prompt information corresponding to each query block.
After the prompt information corresponding to each query block is obtained, the generation of the execution plan of each query block is prompted based on the prompt information.
The implementation mode of generating the execution plan of each query block based on the prompt information corresponding to each query block can be to determine the prompt type of each prompt information based on the prompt information corresponding to each query block, and generate the target prompt information of each query block according to the execution plan generation strategy corresponding to each prompt type.
Optionally, the query block includes at least one query object, where the query object may be a data table, a data graph, or the like, and the prompt information corresponding to each query block includes an action object, and the action object in the prompt information is used to determine that the prompt information acts on the query object in the query block.
In an optional embodiment of the present application, the foregoing steps generate an execution plan of each query block based on the prompt information corresponding to each query block, respectively, including the following steps:
determining a target prompt type based on target prompt information corresponding to a target query block, wherein the target query block is any one of the query blocks;
And generating a target execution plan of the target query block according to the execution plan generation strategy corresponding to the target prompt type.
Determining a realization mode of the target prompt type based on the target prompt information corresponding to the target query block, wherein the realization mode can be to extract an extracted keyword in the target prompt information corresponding to the target query block, match the extracted keyword with a reference prompt keyword and determine the target prompt type; and extracting the target prompt type in the target prompt information corresponding to the target query block.
According to the execution plan generation strategy corresponding to the target prompt type, the implementation mode of generating the target execution plan of the target query block can be to control the generation of the target query block execution plan according to the execution plan generation strategy corresponding to the target prompt type, and generate the target execution plan of the target query block corresponding to the target prompt information.
Optionally, the target query block includes at least one query object, the target prompt information includes an action object, when generating an execution plan for the query object in the target query block, it is determined whether the target prompt information acts on the currently determined query object in the target query block, if yes, the execution plan for the current query object is generated based on the target prompt information, and if not, a preset execution plan generation strategy for the current query object is obtained, and an execution plan for the current query object is generated.
Illustratively, if the hint type is a control list table, the corresponding execution plan generation policy is to increase the cost of non-selected paths by adjusting GUC parameters, and then select only the specified path when generating the path.
The prompt type is used for controlling a multi-table association algorithm, and the corresponding execution plan generation strategy is used for modifying the value of the Rows variable of the single-table path to influence the generation of the multi-table association path; the prompt type is path selection, and the corresponding execution plan generation strategy is a value of the middle path generated by modification so as to influence the generation of the upper-layer path; the prompt type is to control the multi-table association sequence, the execution plan generation strategy is realized by realizing the corresponding hook function, when the corresponding prompt is found, the prompt is realized by directly skipping the optimization, and when the prompt is used, the optimization flow of the query block is directly skipped, and the like.
The Rows variables are used to quickly manipulate Rows in the spreadsheet, such as select, insert, delete, or duplicate Rows, among others.
Alternatively, the configuration parameters of the database may be expanded for use in the cost calculation function to achieve a finer control execution plan before increasing the cost of the non-selected paths.
By applying the scheme of the embodiment of the application, the target prompt type is determined based on the target prompt information corresponding to the target query block, wherein the target query block is any one of the query blocks; and generating a target execution plan of the target query block according to the execution plan generation strategy corresponding to the target prompt type. The target prompt type is determined through the target prompt information corresponding to each query block, and the target execution plan of the target query block is generated through the execution plan generation strategy corresponding to the target prompt type defined in the database, so that the target execution plan of the generated target query block meets the requirement of the prompt information and is also generated based on the execution plan generation strategy supported by the database, the subsequent execution of the query task based on the generated execution plan is facilitated, and the query result is obtained.
In an optional embodiment of the present application, the determining the target prompt type based on the target prompt information corresponding to the target query block includes the following steps:
identifying whether target prompt information acts on a target query object aiming at the target query object in the target query block;
if yes, determining the prompt type of the target prompt information based on the object information of the target query object;
the steps generate a strategy according to an execution plan corresponding to the target prompt type, and generate a target execution plan of the target query block, and the method comprises the following steps:
generating a sub-execution plan aiming at the target query object according to an execution plan generation strategy corresponding to the target prompt type;
a target execution plan for the target query block is determined based on the sub-execution plans of the target query object.
The implementation manner of identifying whether the target prompt information acts on the target query object may be to identify an acting object included in the target prompt information, compare the acting object with the target query object, and determine whether to act on the target query object based on a comparison result.
The implementation manner of determining the prompt type of the target prompt information based on the object information of the target query object may be to determine the prompt type of the target prompt information based on the object information of the target query object and the target prompt information.
The implementation manner of determining the prompt type of the target prompt information based on the object information and the target prompt information of the target query object may be determining the prompt manner based on keywords included in the target prompt information, and determining the prompt type of the target prompt information based on the prompt manner and the object information of the target query object, where the prompt manner may be association, sequential adjustment, concurrency, specified line number, and the like.
The implementation manner of generating the sub-execution plan for the target query object according to the execution plan generation policy corresponding to the target prompt type may be to control generation of the sub-execution plan for the target query object according to the execution plan generation policy corresponding to the target prompt type, so as to generate the sub-execution plan for the target query object.
Based on the sub-execution plans of the target query objects, determining an implementation manner of the target execution plan of the target query block may be to integrate the sub-execution plans of the query objects in the target query block according to a preset sequence of the query objects in the target query block to obtain the target execution plan of the target query block; the sub-execution plans of the query objects in the target query block can be integrated according to the execution plan generation sequence of the target query objects in the target query block, so as to obtain the target execution plan of the target query block.
By applying the scheme of the embodiment of the application, aiming at the target query object in the target query block, whether the target prompt information acts on the target query object is identified; if yes, determining the prompt type of the target prompt information based on the object information of the target query object; generating a sub-execution plan aiming at the target query object according to an execution plan generation strategy corresponding to the target prompt type; and determining a target execution plan of the target query block based on the sub-execution plan of the target query object. When the unit for generating the execution plan by the query object is used for generating the execution plan, judging whether prompt information corresponding to the query block corresponding to the query object acts on the judged query object, if so, generating a sub-execution plan for the query object based on the prompt information, and generating the execution plan of the query block based on the sub-execution plans of the query objects in the query block, so that the follow-up execution plan is transmitted by taking the query block as a unit when the execution plan is transmitted to the distributed query node for executing the query task, and the condition of chaotic matching after the query block is transmitted to the distributed query node is avoided.
In an optional embodiment of the present application, after identifying whether the target prompt information acts on the target query object in the above step, the method further includes the following steps:
if not, generating a sub-execution plan aiming at the target query object according to a preset execution plan generation strategy.
Aiming at the generation of the sub-execution plan corresponding to the target query object, specifically, whether the target prompt information corresponding to the target query block acts on the target query object is judged, different execution plan generation strategies are determined based on the judgment result, the generation of the execution plan is carried out, if the judgment result is negative, the prompt information which does not act on the target query object is determined, the preset execution plan generation strategy corresponding to the target query object is obtained, the sub-execution plan corresponding to the target query object is generated, and therefore the generation of the corresponding sub-execution plan of each query object in each query block is ensured, and further the generation of the corresponding execution plan of each query block is ensured.
By applying the scheme of the embodiment of the application, if the target prompt information does not act on the target query object, generating the sub-execution plan of the target query object according to the preset execution plan generation strategy, so that the generation of the execution plan is based on the granularity of the query object, and under the condition that the prompt information acting on the query object is not available, generating the sub-execution plan of the query object according to the preset execution plan generation strategy, so as to ensure that each query object and each query block have corresponding execution plan generation, and the distributed query node executes the query task based on the execution plan, thereby obtaining the data query result.
Step 108: and respectively carrying out inverse analysis on the execution plans of the query blocks to obtain target query sentences corresponding to the query blocks.
Specifically, the target query statement is a query statement for executing the query task according to the prompt of the database, and the execution of the query task can be realized according to the prompt statement in the query block through the target query statement.
The execution plan of each query block is reversely analyzed to obtain the implementation mode of the target query statement corresponding to each query block, which may be to obtain the prompt information of each query block, and reversely analyze the prompt information and the execution plan of each query block to obtain the target query statement corresponding to each query block.
The prompt information and the execution plan of each query block are reversely analyzed to obtain an implementation mode of the target query statement corresponding to each query block, namely the prompt information corresponding to the target query block is reversely analyzed to obtain a target prompt statement, the execution plan of the target query block is reversely analyzed to obtain an initial query statement, and the target prompt statement and the initial query statement are integrated to generate a target query statement corresponding to the target query block; the execution plan of the target query block can be reversely analyzed to the reverse analysis query module to obtain a reverse analysis query block, the prompt information corresponding to the target query block is reversely analyzed to the reverse analysis query block, and the target query statement corresponding to the target query module is generated.
Before the execution plans of the query blocks are reversely analyzed, starting the functions of the distributed query units, and reversely analyzing the execution plans of the query blocks through the distributed query units to obtain target query sentences corresponding to the query blocks.
In an optional embodiment of the present application, the step of performing inverse analysis on the execution plan of each query block to obtain a target query statement corresponding to each query block includes the following steps:
reversely analyzing prompt information corresponding to a target query block to obtain a target prompt statement, wherein the target query block is any one of the query blocks;
performing reverse analysis on the execution plan of the target query block to obtain an initial query statement;
integrating the target prompt statement and the initial query statement to generate a target query statement corresponding to the target query block.
Specifically, the target prompt statement is a statement for prompting execution according to an execution plan, and the target prompt statement is a statement that can be directly identified and executed by the database.
The implementation manner of obtaining the target prompt statement may be to obtain an inverse analysis function corresponding to the prompt information of the target query block, and reversely analyze the prompt information corresponding to the target query block based on the inverse analysis function.
The obtaining mode of the inverse analysis function can be an inverse analysis function pointer, and the inverse analysis function of the prompt message corresponding to the target query block is obtained based on the inverse analysis function pointer, wherein the inverse analysis function pointer is connected with the prompt module to obtain the prompt message stored in the prompt module.
The implementation manner of performing inverse analysis on the execution plan of the target query block to obtain the initial query statement may be performing inverse analysis on the execution plan of the target query block according to a preset inverse analysis policy of the execution plan to obtain the initial query statement.
The implementation manner of integrating the target prompt statement and the initial query statement to generate the target query statement corresponding to the target query block may be to insert the target prompt statement into the initial query statement based on the corresponding relationship between the target prompt information and the execution plan to generate the target query statement corresponding to the target query block.
By applying the scheme of the embodiment of the application, the prompt information corresponding to the target query block is reversely analyzed to obtain a target prompt sentence, wherein the target query block is any one of the query blocks; performing reverse analysis on the execution plan of the target query block to obtain an initial query statement; integrating the target prompt statement and the initial query statement to generate a target query statement corresponding to the target query block. The target query statement is generated by reversely analyzing the prompt information and the execution plan corresponding to the target query block, so that the target query statement comprises the execution plan, the prompt statement and the query statement, and further the query task can be executed through the target query statement, so that high-efficiency data query is realized.
Step 110: and sending each target query statement to the distributed query node so that the distributed query node executes a query task based on each target query statement to obtain a data query result.
Specifically, the distributed query node refers to a data node that performs data query under a distributed architecture.
The implementation manner of sending each target query statement to the distributed query node may be to obtain a sending rule, and send the target query statement to the distributed query node according to the sending rule.
The sending rule may be to divide the data according to the hash index, and according to the division rule, the query block corresponds to the distributed query node.
By applying the scheme of the embodiment of the application, the prompt information corresponding to each query block is obtained by analyzing the query block, the execution plan of each query block is generated based on the prompt information corresponding to each query block, the query block is obtained by dividing the query statement in the query request based on the query object by controlling the generation of the execution plan according to the granularity corresponding to the query block, the generation of the execution plan corresponding to the fine granularity query block is controlled relative to the generation of the execution plan corresponding to the whole query statement, the fineness and the flexibility of the generation control of the execution plan are realized, the target query statement of each query block is obtained by reversely analyzing the execution plan of the query block, the target query statement is sent to the distributed query node to execute the query task, the data query result is obtained, the generated execution plan of the query block is better by controlling the granularity of the query block, the execution of the query task is further realized based on the better execution plan, the query task is executed by the distributed query node, the query task is executed according to the better execution plan, the query task consumption is reduced by the distributed query node, and the query task execution efficiency is improved.
One or more embodiments of the present application implement comprehensive, flexible, efficient, and distributed support for generating an execution plan control, where the comprehensive includes an execution plan control means that comprehensively expands a database, so that a user can perform finer control on an execution plan, and at the same time, the hit itself supports both stand-alone data and a distributed database; flexibility includes the introduction of execution plan hint statements that allow a user to specify an execution plan at the structured query statement block level, providing greater flexibility; the efficiency comprises the steps that through fine control of the execution plan, a user can select an optimal execution plan according to the query requirement, so that the query efficiency and the database performance are improved; distributed support includes allowing users to specify a hit in a distributed query in a distributed database environment to better control and optimize data access and computation across nodes.
The application of the data query method provided in the present application to a database is taken as an example, and the data query method is further described below with reference to fig. 2. Fig. 2 is a flowchart of a processing procedure of a data query method according to an embodiment of the present application, which specifically includes the following steps.
Step 202: acquiring a query statement;
step 204: in the query analysis stage, dividing a query sentence into at least one query block based on a character 'select' in the query sentence, and matching to obtain a hit character string of each query block;
step 206: analyzing the Hint character strings on each query block in the initial stage of the optimizer, obtaining prompt parameters contained in the Hint character strings, generating the hints, and binding the generated hints to the corresponding query blocks;
wherein, resolving the Hint character string on any query block, and generating the Hint, referring to fig. 3, fig. 3 shows a flow chart of character string resolving in a data query method according to an embodiment of the present application; step 302: judging whether the hit character string on the query block is matched with the reference prompt keyword; if yes, go to step 304; if not, go to step 312; step 304: judging whether the hit character string has no parameters; if yes, go to step 306; if not, go to step 308; step 306: generating a Hint based on the Hint string; step 308: calling an analysis function of the hint character string, and analyzing the hint character string; step 310: judging whether the analysis is successful; if yes, go to step 306, if not, go to step 312; step 312: and (5) reporting errors.
The Hint is used for representing prompt information, specifically, prompt information (Hint) obtained by analyzing a Hint character string.
Step 208: judging whether the target query block has a corresponding Hint or not at each stage of the optimizer;
if yes, go to step 210; if not, go to step 212.
The target query block is any one of the at least one query block;
step 210, based on Hint, modifying the original execution plan to generate an execution plan corresponding to the target query block;
step 212: and executing the original execution plan to generate an execution plan corresponding to the corresponding target query block.
Step 214: in the execution stage, according to the execution plan of each query block, executing the query task to obtain the corresponding query result of the query statement.
Referring to fig. 4, fig. 4 shows a flowchart of an execution stage in a data query method according to an embodiment of the present application; step 402: judging whether a Hint acting on the current query block exists or not; if yes, go to step 404; if not, go to step 406; step 404: invoking an inverse analysis function, and inversely analyzing Hint to obtain a target prompt statement; step 406: reversely analyzing the execution plan to obtain an initial query statement; step 408: generating a target query statement corresponding to the current query block based on the target prompt statement and the initial query statement; step 410: and sending the target query statement to the corresponding distributed query node so that the distributed query node executes the query task based on each target query statement to obtain a data query result.
By applying the scheme of the embodiment of the application, the prompt information corresponding to each query block is obtained by analyzing the query block, the execution plan of each query block is generated based on the prompt information corresponding to each query block, the query block is obtained by dividing the query statement in the query request based on the query object by controlling the generation of the execution plan according to the granularity corresponding to the query block, the generation of the execution plan corresponding to the fine granularity query block is controlled relative to the generation of the execution plan corresponding to the whole query statement, the fineness and the flexibility of the generation control of the execution plan are realized, the target query statement of each query block is obtained by reversely analyzing the execution plan of the query block, the target query statement is sent to the distributed query node to execute the query task, the data query result is obtained, the generated execution plan of the query block is better by controlling the granularity of the query block, the execution of the query task is further realized based on the better execution plan, the query task is executed by the distributed query node, the query task is executed according to the better execution plan, the query task consumption is reduced by the distributed query node, and the query task execution efficiency is improved.
Corresponding to the method embodiment, the present application further provides a data query device embodiment, and fig. 5 shows a schematic structural diagram of a data query device according to one embodiment of the present application. As shown in fig. 5, the apparatus includes:
an obtaining module 502 configured to obtain a query request, where the query request includes at least one query block, and the query block is partitioned based on a query object;
the parsing module 504 is configured to parse at least one query block to obtain prompt information corresponding to each query block;
a generating module 506, configured to generate an execution plan of each query block based on the prompt information corresponding to each query block;
the inverse analysis module 508 is configured to respectively perform inverse analysis on the execution plans of the query blocks to obtain target query sentences corresponding to the query blocks;
the obtaining module 510 is configured to send each target query statement to the distributed query node, so that the distributed query node performs a query task based on each target query statement to obtain a data query result.
Optionally, the parsing module 504 is further configured to extract the hint statements in each query block separately; and generating prompt information corresponding to each query block based on the prompt sentences in each query block.
Optionally, the parsing module 504 is further configured to match the prompt sentences in the query blocks with the reference prompt keywords respectively; and generating prompt information corresponding to the first query block based on the prompt sentences in the first query block aiming at the successfully matched first query block.
Optionally, the parsing module 504 is further configured to parse the prompt sentence in the first query block to obtain a prompt parameter of the prompt sentence in the first query block; and constructing prompt information corresponding to the first query block based on the prompt parameters.
Optionally, the data query device further includes a construction module configured to construct, if the prompt parameters of the prompt sentence in the first query block are not obtained, prompt information corresponding to the first query block based on the keywords and the object information of the prompt sentence in the first query block.
Optionally, the data query device further includes a matching module configured to generate, for the second query block that fails to match, an execution plan of the second query block according to a preset execution plan generation policy.
Optionally, the generating module 506 is further configured to determine a target prompt type based on target prompt information corresponding to a target query block, where the target query block is any one of the query blocks; and generating a target execution plan of the target query block according to the execution plan generation strategy corresponding to the target prompt type.
Optionally, the generating module 506 is further configured to identify, for the target query object in the target query block, whether the target prompt information acts on the target query object; if yes, determining the prompt type of the target prompt information based on the object information of the target query object; generating a sub-execution plan aiming at the target query object according to an execution plan generation strategy corresponding to the target prompt type; a target execution plan for the target query block is determined based on the sub-execution plans of the target query object.
Optionally, the generating module 506 is further configured to generate a sub-execution plan for the target query object according to a preset execution plan generating policy if not.
Optionally, the inverse analysis module 508 is further configured to perform inverse analysis on the prompt information corresponding to the target query block to obtain a target prompt statement, where the target query block is any one of the query blocks; performing reverse analysis on the execution plan of the target query block to obtain an initial query statement; integrating the target prompt statement and the initial query statement to generate a target query statement corresponding to the target query block.
By applying the scheme of the embodiment of the application, the prompt information corresponding to each query block is obtained by analyzing the query block, the execution plan of each query block is generated based on the prompt information corresponding to each query block, the query block is obtained by dividing the query statement in the query request based on the query object by controlling the generation of the execution plan according to the granularity corresponding to the query block, the generation of the execution plan corresponding to the fine granularity query block is controlled relative to the generation of the execution plan corresponding to the whole query statement, the fineness and the flexibility of the generation control of the execution plan are realized, the target query statement of each query block is obtained by reversely analyzing the execution plan of the query block, the target query statement is sent to the distributed query node to execute the query task, the data query result is obtained, the generated execution plan of the query block is better by controlling the granularity of the query block, the execution of the query task is further realized based on the better execution plan, the query task is executed by the distributed query node, the query task is executed according to the better execution plan, the query task consumption is reduced by the distributed query node, and the query task execution efficiency is improved.
The foregoing is a schematic solution of a data query device of this embodiment. It should be noted that, the technical solution of the data query device and the technical solution of the data query method belong to the same concept, and details of the technical solution of the data query device, which are not described in detail, can be referred to the description of the technical solution of the data query method.
FIG. 6 illustrates a block diagram of a computing device provided in one embodiment of the present application. The components of computing device 600 include, but are not limited to, memory 610 and processor 620. The processor 620 is coupled to the memory 610 via a bus 630 and a database 650 is used to hold data.
Computing device 600 also includes access device 640, access device 640 enabling computing device 600 to communicate via one or more networks 660. Examples of such networks include public switched telephone networks (PSTN, public Switched Telephone Network), local area networks (LAN, local Area Network), wide area networks (WAN, wide Area Network), personal area networks (PAN, personal Area Network), or combinations of communication networks such as the internet. The access device 640 may include one or more of any type of network interface, wired or wireless, such as a network interface card (NIC, network interface controller), such as an IEEE802.11 wireless local area network (WLAN, wireless Local Area Network) wireless interface, a worldwide interoperability for microwave access (Wi-MAX, worldwide Interoperability for Microwave Access) interface, an ethernet interface, a universal serial bus (USB, universal Serial Bus) interface, a cellular network interface, a bluetooth interface, near field communication (NFC, near Field Communication).
In one embodiment of the present application, the above-described components of computing device 600, as well as other components not shown in FIG. 6, may also be connected to each other, such as by a bus. It should be understood that the block diagram of the computing device illustrated in FIG. 6 is for exemplary purposes only and is not intended to limit the scope of the present application. Those skilled in the art may add or replace other components as desired.
Computing device 600 may be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., tablet, personal digital assistant, laptop, notebook, netbook, etc.), mobile phone (e.g., smart phone), wearable computing device (e.g., smart watch, smart glasses, etc.), or other type of mobile device, or a stationary computing device such as a desktop computer or personal computer (PC, personal Computer). Computing device 600 may also be a mobile or stationary server.
Wherein the processor 620 is configured to execute computer-executable instructions that, when executed by the processor, perform the steps of the data query method described above.
The foregoing is a schematic illustration of a computing device of this embodiment. It should be noted that, the technical solution of the computing device and the technical solution of the data query method belong to the same concept, and details of the technical solution of the computing device, which are not described in detail, can be referred to the description of the technical solution of the data query method.
An embodiment of the present application also provides a computer-readable storage medium storing computer-executable instructions that, when executed by a processor, implement the steps of the data query method described above.
The above is an exemplary version of a computer-readable storage medium of the present embodiment. It should be noted that, the technical solution of the storage medium and the technical solution of the data query method belong to the same concept, and details of the technical solution of the storage medium which are not described in detail can be referred to the description of the technical solution of the data query method.
An embodiment of the present application further provides a computer program, where the computer program when executed in a computer causes the computer to execute the steps of the data query method described above.
The above is an exemplary version of a computer program of the present embodiment. It should be noted that, the technical solution of the computer program and the technical solution of the data query method belong to the same concept, and details of the technical solution of the computer program, which are not described in detail, can be referred to the description of the technical solution of the data query method.
The foregoing describes specific embodiments of the present application. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims can be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
The computer instructions include computer program code that may be in source code form, object code form, executable file or some intermediate form, etc. The computer readable medium may include: any entity or device capable of carrying the computer program code, a recording medium, a U disk, a removable hard disk, a magnetic disk, an optical disk, a computer Memory, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), an electrical carrier signal, a telecommunications signal, a software distribution medium, and so forth. It should be noted that the content of the computer readable medium can be increased or decreased appropriately according to the requirements of the patent practice, for example, in some areas, according to the patent practice, the computer readable medium does not include an electric carrier signal and a telecommunication signal.
It should be noted that, for simplicity of description, the foregoing method embodiments are all expressed as a series of combinations of actions, but it should be understood by those skilled in the art that the embodiments are not limited by the order of actions described, as some steps may take other order or occur simultaneously in accordance with the embodiments. Further, those skilled in the art will also appreciate that the embodiments described in the specification are all preferred embodiments, and that the acts and modules referred to are not necessarily all required for the embodiments of the present application.
In the foregoing embodiments, the descriptions of the embodiments are emphasized, and for parts of one embodiment that are not described in detail, reference may be made to the related descriptions of other embodiments.
The above-disclosed preferred embodiments of the present application are provided only as an aid to the elucidation of the present application. Alternative embodiments are not intended to be exhaustive or to limit the invention to the precise form disclosed. Obviously, many modifications and variations are possible in light of the teachings of the embodiments of the present application. These embodiments were chosen and described in order to best explain the principles of the embodiments and the practical application, to thereby enable others skilled in the art to best understand and utilize the invention. This application is to be limited only by the claims and the full scope and equivalents thereof.

Claims (13)

1. A method of querying data, comprising:
obtaining a query request, wherein the query request comprises at least one query block, and the query block is obtained by dividing based on a query object, wherein the query object refers to an object acted by processing the query request;
analyzing the at least one query block to obtain prompt information corresponding to each query block;
generating an execution plan of each query block based on the prompt information corresponding to each query block;
performing inverse analysis on the execution plans of the query blocks respectively to obtain target query sentences corresponding to the query blocks;
and sending each target query statement to a distributed query node so that the distributed query node executes a query task based on each target query statement to obtain a data query result.
2. The method of claim 1, wherein the parsing the at least one query block to obtain the prompt message corresponding to each query block comprises:
extracting prompt sentences in each query block respectively;
and generating prompt information corresponding to each query block based on the prompt sentences in each query block.
3. The method according to claim 2, wherein generating the hint information corresponding to each query block based on the hint statements in each query block, respectively, comprises:
matching the prompt sentences in the query blocks with the reference prompt keywords respectively;
and generating prompt information corresponding to the first query block based on prompt sentences in the first query block aiming at the successfully matched first query block.
4. The method of claim 3, wherein generating the hint information corresponding to the first query block based on the hint statement in the first query block comprises:
analyzing the prompt sentences in the first query block to obtain prompt parameters of the prompt sentences in the first query block;
and constructing prompt information corresponding to the first query block based on the prompt parameters.
5. The method of claim 4, further comprising, after said parsing the hint statement in the first query block:
if the prompting parameters of the prompting sentences in the first query block are not obtained, constructing prompting information corresponding to the first query block based on the keywords and the object information of the prompting sentences in the first query block.
6. A method according to claim 3, further comprising:
and generating an execution plan of the second query block according to a preset execution plan generation strategy aiming at the second query block with failed matching.
7. The method according to any one of claims 1-6, wherein generating an execution plan for each query block based on the prompt messages corresponding to each query block, respectively, comprises:
determining a target prompt type based on target prompt information corresponding to a target query block, wherein the target query block is any one of the query blocks;
and generating a target execution plan of the target query block according to an execution plan generation strategy corresponding to the target prompt type.
8. The method of claim 7, wherein determining the target hint type based on target hint information corresponding to the target query block comprises:
identifying whether the target prompt information acts on the target query object aiming at the target query object in the target query block;
if yes, determining the prompt type of the target prompt information based on the object information of the target query object;
the generating the target execution plan of the target query block according to the execution plan generating strategy corresponding to the target prompt type comprises the following steps:
Generating a sub-execution plan aiming at the target query object according to an execution plan generation strategy corresponding to the target prompt type;
and determining a target execution plan of the target query block based on the sub-execution plan of the target query object.
9. The method of claim 8, further comprising, after said identifying whether the target hint information acts on the target query object:
if not, generating a sub-execution plan aiming at the target query object according to a preset execution plan generation strategy.
10. The method according to any one of claims 1-6, wherein performing inverse parsing on the execution plan of each query block to obtain a target query statement corresponding to each query block includes:
performing inverse analysis on prompt information corresponding to a target query block to obtain a target prompt statement, wherein the target query block is any one of the query blocks;
performing reverse analysis on the execution plan of the target query block to obtain an initial query statement;
integrating the target prompt statement and the initial query statement to generate a target query statement corresponding to the target query block.
11. A data query device, comprising:
the acquisition module is configured to acquire a query request, wherein the query request comprises at least one query block, the query block is divided based on query objects, and the query objects are objects acted on by processing the query request;
the analysis module is configured to analyze the at least one query block to obtain prompt information corresponding to each query block;
the generation module is configured to generate an execution plan of each query block based on the prompt information corresponding to each query block;
the inverse analysis module is configured to respectively carry out inverse analysis on the execution plans of the query blocks to obtain target query sentences corresponding to the query blocks;
the obtaining module is configured to send each target query statement to the distributed query node so that the distributed query node executes a query task based on each target query statement to obtain a data query result.
12. A computing device, comprising:
a memory and a processor;
the memory is configured to store computer executable instructions, the processor being configured to execute the computer executable instructions, which when executed by the processor, implement the steps of the method of any one of claims 1-10.
13. A computer readable storage medium, characterized in that it stores computer executable instructions which, when executed by a processor, implement the steps of the method of any of claims 1-10.
CN202311239929.5A 2023-09-25 2023-09-25 Data query method, device, computing equipment and computer readable storage medium Active CN116975126B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311239929.5A CN116975126B (en) 2023-09-25 2023-09-25 Data query method, device, computing equipment and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311239929.5A CN116975126B (en) 2023-09-25 2023-09-25 Data query method, device, computing equipment and computer readable storage medium

Publications (2)

Publication Number Publication Date
CN116975126A CN116975126A (en) 2023-10-31
CN116975126B true CN116975126B (en) 2023-12-19

Family

ID=88483591

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311239929.5A Active CN116975126B (en) 2023-09-25 2023-09-25 Data query method, device, computing equipment and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN116975126B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110309196A (en) * 2019-05-22 2019-10-08 深圳壹账通智能科技有限公司 Block chain data storage and query method, apparatus, equipment and storage medium
CN111782682A (en) * 2020-06-30 2020-10-16 北京金山云网络技术有限公司 Data query method, device, equipment and storage medium
CN112597182A (en) * 2020-12-16 2021-04-02 平安普惠企业管理有限公司 Data query statement optimization method and device, terminal and storage medium
WO2022042288A1 (en) * 2020-08-31 2022-03-03 阿里巴巴集团控股有限公司 Data query method and apparatus
CN115630087A (en) * 2022-12-23 2023-01-20 金篆信科有限责任公司 Method and device for determining execution plan of database statement, electronic device and medium
CN116483850A (en) * 2022-01-14 2023-07-25 腾讯科技(深圳)有限公司 Data processing method, device, equipment and medium

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10713247B2 (en) * 2017-03-31 2020-07-14 Amazon Technologies, Inc. Executing queries for structured data and not-structured data
CN109299131B (en) * 2018-11-14 2020-05-29 百度在线网络技术(北京)有限公司 Spark query method and system supporting trusted computing

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110309196A (en) * 2019-05-22 2019-10-08 深圳壹账通智能科技有限公司 Block chain data storage and query method, apparatus, equipment and storage medium
CN111782682A (en) * 2020-06-30 2020-10-16 北京金山云网络技术有限公司 Data query method, device, equipment and storage medium
WO2022042288A1 (en) * 2020-08-31 2022-03-03 阿里巴巴集团控股有限公司 Data query method and apparatus
CN112597182A (en) * 2020-12-16 2021-04-02 平安普惠企业管理有限公司 Data query statement optimization method and device, terminal and storage medium
CN116483850A (en) * 2022-01-14 2023-07-25 腾讯科技(深圳)有限公司 Data processing method, device, equipment and medium
CN115630087A (en) * 2022-12-23 2023-01-20 金篆信科有限责任公司 Method and device for determining execution plan of database statement, electronic device and medium

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
SQL程序自动生成的语义识别;李秀忠,王义杰,陈德运;哈尔滨理工大学学报(第03期);全文 *
电波传播数据库应用程序设计;董明玉;电波科学学报(第03期);全文 *

Also Published As

Publication number Publication date
CN116975126A (en) 2023-10-31

Similar Documents

Publication Publication Date Title
CN107832406B (en) Method, device, equipment and storage medium for removing duplicate entries of mass log data
CN107291770B (en) Mass data query method and device in distributed system
US8719299B2 (en) Systems and methods for extraction of concepts for reuse-based schema matching
CN105824957A (en) Query engine system and query method of distributive memory column-oriented database
EP3617896A1 (en) Method and apparatus for intelligent response
EP4170514A1 (en) Data association query method and apparatus, and device and storage medium
CN111858760B (en) Data processing method and device for heterogeneous database
CN108536808A (en) A kind of data capture method and device based on Spark Computational frames
CN114356971A (en) Data processing method, device and system
CN109299101B (en) Data retrieval method, device, server and storage medium
CN113297269A (en) Data query method and device
CN111125199B (en) Database access method and device and electronic equipment
CN114398371A (en) Multi-copy fragmentation method, device, equipment and storage medium for database cluster system
CN108073641B (en) Method and device for querying data table
CN117033424A (en) Query optimization method and device for slow SQL (structured query language) statement and computer equipment
CN114969441A (en) Knowledge mining engine system based on graph database
CN111475588A (en) Data processing method and device
CN112182031B (en) Data query method and device, storage medium and electronic device
CN116975126B (en) Data query method, device, computing equipment and computer readable storage medium
CN110222046B (en) List data processing method, device, server and storage medium
CN116049193A (en) Data storage method and device
CN115982230A (en) Cross-data-source query method, system, equipment and storage medium of database
CN107122381B (en) File generation method and device and data analysis method and device
US10657126B2 (en) Meta-join and meta-group-by indexes for big data
CN114924966A (en) Test case generation method and device based on database PL language

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant