CN112579637A - SQL statement execution method, system, terminal and medium - Google Patents

SQL statement execution method, system, terminal and medium Download PDF

Info

Publication number
CN112579637A
CN112579637A CN202011480506.9A CN202011480506A CN112579637A CN 112579637 A CN112579637 A CN 112579637A CN 202011480506 A CN202011480506 A CN 202011480506A CN 112579637 A CN112579637 A CN 112579637A
Authority
CN
China
Prior art keywords
target
node
sql
readable
task
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.)
Pending
Application number
CN202011480506.9A
Other languages
Chinese (zh)
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.)
Shenzhen Hanyun Technology Co ltd
Original Assignee
Shenzhen Hanyun Technology Co ltd
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 Shenzhen Hanyun Technology Co ltd filed Critical Shenzhen Hanyun Technology Co ltd
Priority to CN202011480506.9A priority Critical patent/CN112579637A/en
Publication of CN112579637A publication Critical patent/CN112579637A/en
Pending legal-status Critical Current

Links

Images

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/2453Query optimisation
    • G06F16/24532Query optimisation of parallel 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/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computational Linguistics (AREA)
  • Computing Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention provides an SQL statement execution method, a system, a terminal and a medium, the method avoids the multi-thread expense and the complexity of asynchronous programming by acquiring an SQL statement to be issued and a plurality of target connection objects, sending the SQL statement to be issued to a target node through the target connection objects, generating an SQL sending result, acquiring a target message, generating a final execution result and dividing the execution SQL into two stages, and can solve the problems that the tasks executed by each node of an MPP distributed database in the related technology are always heavier and need to spend longer execution time, therefore, if the API of synchronous blocking is used for serial execution, the performance is very low, for the multi-thread scheme of the distributed database, the expense is larger, one thread needs to be opened for each executed SQL, the efficiency is lower, the performance is improved, and the expense of multi-thread concurrent execution is reduced, is simple and convenient.

Description

SQL statement execution method, system, terminal and medium
Technical Field
The invention relates to the technical field of computers, in particular to a method, a system, a terminal and a medium for executing SQL sentences.
Background
MPP distributed databases are typically based on a sophisticated monolithic database implementation, such as MYSQL. The client side library provided by the current monomer database is a blocked synchronization API. Conventional concurrent execution schemes are implemented using multiple threads, each executing one SQL, and finally assembling the results.
For a multi-thread scheme, the overhead is large, each executed SQL needs to open one thread, and the efficiency is low.
Disclosure of Invention
The invention mainly aims to provide a method, a system, a terminal and a medium for executing SQL statements, and aims to solve the technical problems that in the related technology, the cost is high for a distributed database multithreading scheme, each executed SQL needs to be started by one thread, and the efficiency is low.
In order to solve the above technical problem, there is provided an SQL statement execution method, including:
acquiring SQL sentences to be issued and a plurality of target connection objects;
sending the SQL sentence to be issued to each target node through the target connection object, and generating an SQL sending result;
and acquiring a target message and generating a final execution result, wherein the target message comprises a task canceling message or a node execution result of each target node.
Optionally, the obtaining the target message and generating the final execution result include any one of:
if the target message comprises the node execution result of each target node, generating a result set according to the node execution result, wherein the final execution result comprises the result set;
and if the target message comprises a task canceling message, the final execution result comprises task canceling.
Optionally, the obtaining manner of the execution result of each node is as follows:
obtaining a node execution result of the target node;
and if the target message is not acquired currently, continuously acquiring the node execution result of the next target node until the node execution result of each target node is acquired.
Optionally, the method further includes:
and if the target message is currently acquired and comprises a task canceling message, stopping acquiring a node execution result of the next target node, wherein the final execution result comprises task canceling.
Optionally, the obtaining manner of the execution result of each node is as follows:
respectively initializing a poll object and a pipeline, and monitoring a readable event of the pipeline through the poll object, wherein the readable event of the pipeline comprises writing in the task canceling message;
monitoring readable events of each target connection object through the poll object, and waiting for the readable events of each target connection object through poll _ wait, wherein the readable events of the target connection objects comprise node execution results of the target nodes;
acquiring a readable event of the target connection object;
and if the pipeline is not readable, acquiring the next readable event of the target connecting object until all the readable events of the target connecting object are acquired.
Optionally, if the pipeline is readable, the final execution result includes task cancellation.
Optionally, if the final execution result includes task cancellation, any one of the following is further included:
adding the target connection object into a task canceling queue;
and adding the target connection object into a task cancellation queue, and ending the task of each target connection object in the task cancellation queue.
The invention also provides a SQL statement execution system, which comprises:
the acquisition module is used for acquiring the SQL sentence to be issued and a plurality of target connection objects;
the sending module is used for sending the SQL sentence to be issued to each target node through the target connection object and generating an SQL sending result;
and the generating module is used for acquiring a target message and generating a final execution result, wherein the target message comprises a task canceling message or a node execution result of each target node.
The invention also provides a terminal, which comprises a processor, a memory and a communication bus;
the communication bus is used for connecting the processor and the memory;
the processor is configured to execute the computer program stored in the memory to implement the SQL statement execution method according to any of the above embodiments.
The present invention also provides a computer-readable storage medium, having stored thereon a computer program,
the computer program is used for making the computer execute the SQL statement execution method in any one of the above embodiments.
As described above, the SQL statement execution method, system, terminal and medium provided by the present invention have the following beneficial effects:
by acquiring an SQL sentence to be issued and a plurality of target connection objects, sending the SQL sentence to be issued to a target node through the target connection objects, generating an SQL sending result, acquiring a target message, and generating a final execution result, and dividing the execution SQL into two stages, the multi-thread overhead is avoided, the complexity of asynchronous programming is also avoided, and the problems that tasks executed by each node of an MPP distributed database in the related art are often heavier and need to cost longer execution time can be solved.
Drawings
Fig. 1 is a schematic flow chart of a method for executing an SQL statement according to an embodiment of the present invention;
fig. 2 is a specific flowchart of a method for executing an SQL statement according to an embodiment of the present invention;
fig. 3 is a schematic flowchart of another specific method for executing an SQL statement according to an embodiment of the present invention;
fig. 4 is a schematic flowchart of another specific method for executing an SQL statement according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of an SQL statement execution system according to a second embodiment of the present invention;
fig. 6 is a schematic structural diagram of a terminal according to an embodiment of the present invention.
Detailed Description
The embodiments of the present invention are described below with reference to specific embodiments, and other advantages and effects of the present invention will be easily understood by those skilled in the art from the disclosure of the present specification. The invention is capable of other and different embodiments and of being practiced or of being carried out in various ways, and its several details are capable of modification in various respects, all without departing from the spirit and scope of the present invention. It is to be noted that the features in the following embodiments and examples may be combined with each other without conflict.
It should be noted that the drawings provided in the following embodiments are only for illustrating the basic idea of the present invention, and the components related to the present invention are only shown in the drawings rather than drawn according to the number, shape and size of the components in actual implementation, and the type, quantity and proportion of the components in actual implementation may be changed freely, and the layout of the components may be more complicated.
Example one
Referring to fig. 1, an embodiment of the present invention provides a method for executing an SQL statement, including:
s101: and acquiring the SQL sentences to be issued and a plurality of target connection objects.
Optionally, the manner of obtaining an SQL (Structured Query Language) statement to be issued and a plurality of target connection objects may be implemented by using the existing related technical means, which is not limited herein.
Optionally, the target connection object may be obtained in a manner that a corresponding number of connection objects are obtained from the connection pool according to the number of nodes that need to be executed by the SQL statement to be issued.
S102: and sending the SQL sentences to be issued to each target node through the target connection object, and generating SQL sending results.
Optionally, after the SQL statement to be issued is sent to each target node through the target connection object, an SQL sending result is generated. In other words, after the normal issuing of the SQL statements to be issued of each target node is completed, the SQL sending result can be generated without waiting for the return of the node execution result by each target node.
Optionally, the SQL statement to be issued is issued to the target node, and the SQL statement to be issued is returned after being successfully sent through a tcp (transmission Control protocol) network, without waiting for a node response.
Optionally, a connection object list may be generated according to the target connection object, and whether the sending of the to-be-sent SQL statement is completed through each target connection object in the connection object list is traversed to determine whether to generate the SQL sending result. If the traversal is completed, namely the work of distributing the SQL sentence to be issued through each target connection object is completed, generating an SQL sending result, otherwise, continuing to speak the SQL sentence to be issued and sending the SQL sentence to the corresponding target node through the target connection object which has not completed the distribution work.
S103: and acquiring the target message and generating a final execution result.
Optionally, the target message includes a task cancellation message or a node execution result of each target node.
Optionally, after or at the same time of returning the SQL sending result, the target message is obtained, and a final execution result is generated according to the target message, where the target message includes a task canceling message or a node execution result of each target node. Therefore, the SQL execution process can be divided into two stages: the first stage is that the SQL sentence to be executed is issued to the target node, and the SQL sentence to be issued is returned after being successfully sent through the TCP network without waiting for the response of the node; and the second stage is to call a result obtaining interface and wait for the target node to return the node execution result. By the SQL sentence executing method, the SQL sentences to be issued can be issued to all target nodes in batches, the target nodes execute the SQL sentences to be issued concurrently, and then the execution results of the nodes waiting for all the target nodes in batches are readable. The technical problem that tasks executed by each node of an MPP distributed database in the related technology are often heavy and need to spend long execution time, so that if synchronous blocked API is used for executing serially, the performance is low, the performance is improved, the cost of concurrent multithreading is reduced, and the method is simple and convenient.
In some embodiments, before obtaining the target message, after sending the SQL statement to be issued to each target node through the target connection object, the method further includes:
and controlling each target node to concurrently execute the SQL statement to be issued.
Optionally, the manner in which each target node concurrently executes the to-be-issued SQL statement may be implemented by using a technical means of a related technology, which is not limited herein.
Optionally, the process of acquiring the target message is to monitor two message sources, on one hand, to monitor whether a task canceling message exists, and on the other hand, to monitor whether a node execution result of each target node exists. The node execution result of each target node, that is, all target nodes complete executing the SQL statement to be issued, and the respective node execution result is returned.
Optionally, the target message is acquired first, that is, which of the task canceling message and the node execution result of each target node is acquired first and which is the current target message. Therefore, the target message only includes the cancel task message and any one of the node execution results of each target node, and there is no case where both cases coexist.
In some embodiments, obtaining the target message and generating the final execution result comprises any one of:
if the target message comprises the node execution result of each target node, generating a result set according to the node execution result, wherein the final execution result comprises the result set;
and if the target message comprises a task canceling message, the final execution result comprises task canceling.
Optionally, the result set is a set generated by executing results by nodes corresponding to all the target nodes.
Optionally, in the related art, a problem still exists in the MPP distributed database, because the SQL task executed by each node is relatively heavy. After a request for canceling the task is issued, the node often needs to wait for a long time to actually cancel the task and return error information. In the method provided by the embodiment of the invention, once the task canceling message is acquired before the node execution result of each target node is not acquired, the final execution result comprises task canceling, and the task canceling can be returned without waiting for the real cancellation of the target node. The task can be cancelled quickly, other affairs can be processed more quickly by the application layer, the resource utilization rate is improved, and the system efficiency is improved.
The method provided by the embodiment of the invention is characterized in that SQL sentences to be issued are issued to target nodes in batches, after the target nodes are executed concurrently, a blocked reading result set is not immediately removed, but a flow for waiting that the result set is readable in batches or tasks are cancelled is entered, namely, in the process of acquiring the target message, when any one of the task cancelling message or the node execution results of each target node is acquired, namely, the node execution results of all the target nodes are waited to be readable, or a task cancelling event is received and returned. Therefore, IO multiplexing can be realized, and the system efficiency is improved.
In some embodiments, if the final execution result includes task cancellation, the method further includes:
and adding the target connection object into a task cancel queue.
In some embodiments, referring to fig. 2, the SQL statement execution method includes:
s201: and acquiring a corresponding number of target connection objects from the connection pool according to the number of target nodes to be executed.
For example, if the number of target nodes to be executed is N, N target connection objects are obtained from the connection pool.
S202: and acquiring the SQL sentence to be issued.
The execution sequence of step S201 and step S202 is not limited herein.
S203: and traversing a connection object list consisting of the target connection objects.
S204: and judging whether the traversal is finished, if so, executing the step S206, and if not, executing the step S205.
S205: and sending the SQL sentence to be issued to the target node for execution through the target connection object.
Optionally, after step S205 is completed, step S203 is continuously executed.
S206: the batch waits for the result set to be readable or the task to be cancelled.
And optionally, acquiring the target message. The batch waiting result set also obtains the node execution result of each target node, and the task is cancelled also obtains the task cancelling message.
S207: it is determined whether the task is canceled, if not, step S208 is executed, and if so, step S209 is executed.
That is, it is determined whether the cancel task message is acquired.
S208: and reading and combining the execution results of all the nodes to generate a result set.
That is, the node execution results of the respective target nodes are read, and a result set is generated.
S209: and adding each target connection object into a task cancel queue.
In some embodiments, the manner of obtaining the execution result of each node is as follows:
obtaining a node execution result of a target node;
and if the target message is not acquired currently, continuously acquiring the node execution result of the next target node until the node execution result of each target node is acquired.
Optionally, the readable event of the target connection object may be acquired, and then the node execution result of the target node corresponding to the readable event may be acquired.
Optionally, the obtaining order of the node execution results of each target node may be sorted in advance, and the node execution results are obtained one by one according to the sorting.
For example, a node execution result of one target node is obtained, if the task canceling message is not obtained yet at this time, the target number is reduced by 1, a node execution result of the next target node is obtained, and the above steps are repeated until all the node execution results of all the target nodes are obtained, at this time, the target message includes the node execution results of all the target nodes. The final execution result at this time includes a result set generated from the execution results of the respective nodes.
In some embodiments, if the target message is currently acquired and includes a task canceling message, the acquisition of the node execution result of the next target node is stopped, and the final execution result includes task canceling.
Optionally, at this time, each target node needs to be cancelled to execute the SQL statement to be issued, so that the node execution result of the target node that is not yet acquired is no longer needed, and therefore, the acquisition of the node execution results of the other target nodes is stopped, resources can be effectively saved, and the system efficiency is improved.
In some embodiments, if the target message is acquired before the node execution result of the first target node is acquired, that is, the task cancellation message is acquired, at this time, similar to the above embodiments, the acquisition of the node execution results of all the target nodes is cancelled, and task cancellation is returned.
In some embodiments, the manner of obtaining the execution result of each node is as follows:
respectively initializing a poll object and a pipeline, and monitoring readable events of the pipeline through the poll object, wherein the readable events of the pipeline comprise a write-in task canceling message;
monitoring readable events of each target connection object through the poll object, and waiting for the readable events of each target connection object through the poll _ wait, wherein the readable events of the target connection objects comprise node execution results of target nodes;
acquiring a readable event of a target connection object;
and if the pipeline is not readable, acquiring the readable event of the next target connecting object until the readable events of all the target objects are acquired.
Optionally, before acquiring the readable event of the next target connection object, the method further includes:
the Poll object removes monitoring on the target connection object which has acquired the readable event, that is, the Poll object only monitors the target connection object which has not acquired the readable event, and does not monitor the target connection object which has completed acquisition of the readable event any more.
Optionally, before acquiring the readable event of the next target connection object, at least one of the following is further included:
whether readable events of all the target connection objects waiting for traversing poll _ wait are all acquired;
the number of readable events of the currently acquired target connection object.
Optionally, if the readable events of each target connection object that are waiting for poll _ wait are all obtained, and/or the number of the currently obtained readable events is equal to the number of the target connection objects corresponding to the SQL statement to be issued, it indicates that all the connection objects have completed the execution of SQL, and a target message including the node execution result of each target node is returned.
Optionally, if the readable events of each target connection object that are waiting for poll _ wait are all obtained before obtaining the readable event of the next target connection object, but the number of the previously obtained readable events is less than the number of the target connection objects corresponding to the SQL statement to be issued, the method further includes:
poll _ wait waits for a readable event of the target connection object that has not yet been acquired.
Optionally, if the target information is acquired before the readable event of the next target connection object is acquired, where the target information includes a task canceling message, the task is canceled, and the step of acquiring the readable event of the next target connection object is not executed any more.
In some embodiments, if the pipeline is readable, the final execution result includes task cancellation.
Optionally, the pipeline is readable, that is, the pipeline writes a task canceling message, at this time, the target message is already acquired, but the node execution result of the target node is not yet acquired, that is, the node execution result of some target nodes is not yet acquired, so that at this time, the final execution result includes task canceling. Optionally, the node execution result of the target node is obtained, that is, the readable event of a target connection object monitored by the poll object and the related steps are ended.
Optionally, referring to fig. 3, a more specific embodiment is shown for obtaining the target message and generating the final execution result, where the specific method includes:
s301: the poll object is initialized.
S302: initializing the pipeline and monitoring the readability of the pipeline through the poll object.
S303: the number of finished nodes is initialized.
It should be noted that the step sequence between step S301 and step S303 is not limited, and may be executed simultaneously or in any order.
Optionally, the pipe is configured to write a cancel task message, and when the cancel task message is written in the pipe, the pipe is readable, otherwise, the pipe is not readable.
Optionally, when the number of the initialized finished nodes is initialized, the number of the initialized finished nodes is equal to the number of the target nodes, and is also equal to the number of the target connection objects.
S304: and traversing the target connection object list.
S305: if the traversal is completed, step S307 is executed, and if not, step S306 is executed.
S306: and monitoring the readable event of the target connection object through the poll object.
That is, all readable events of the target connection object need to be listened to through the poll object.
S307: calling poll wait for a readable event.
Optionally, a plurality of target connection objects are returned to be readable through poll _ wait, and at this time, all the target connection objects may be readable; it is also possible that only some of the target connection objects are readable and other target connection objects are not.
S308: traversing the occurring readable events.
Optionally, the readable event of each target link object is traversed.
S309: and judging whether the traversal is completed, if not, executing the step S310, and if so, executing the step S307.
S310: and judging whether the pipeline is readable, if so, executing the step S311, and if not, executing the step S315.
S311: the number of finished nodes is reduced by 1.
Optionally, the readable event of one target connection object a returned by the poll _ wait is obtained, traversal of the readable event for the target connection object a is completed, if the current pipeline is not readable, the number of finished nodes is decreased by 1, if the number of finished nodes at this time is not zero, and there is not yet read among the readable events of a plurality of target connection objects b returned by the poll _ wait, that is, traversal is not completed, the readable event of the next target connection object b returned by the poll _ wait is continuously obtained, and traversal of the readable event for the target connection object b is completed … … until traversal is completed.
S312: it is determined whether the number of finished nodes is equal to 0, if yes, step S313 is performed, and if no, step S314 is performed.
Optionally, when step S312 determines whether finished is equal to 0, and if it is equal to 0, it indicates that all the target connection objects have been checked, or when the task is canceled, the process automatically exits the loop.
S313: and taking the node execution result of each target node as a target message.
S314: the snoop to the target connection object is removed from the poll object.
Optionally, after the step S314 is completed, the step S308 is continuously executed.
S315: and taking the task canceling message as a target message.
S316: the final execution result includes task cancellation.
Optionally, if the pipeline is readable, that is, the task canceling message is written in, at this time, the readable events of the remaining target nodes are no longer acquired, the task canceling message is directly used as the target message, and the final execution result includes task canceling.
S317: the final execution result includes a result set.
The embodiment of the invention solves the problem that in the related technology, because SQL tasks executed by each node are heavier in the MPP distributed database, after a task canceling request is issued, the node always needs to wait for a long time to truly cancel the tasks and return error information. After the SQL is distributed to the nodes in batches for execution, the blocked reading result set is not immediately removed, and the flow (obtaining the target message) of waiting for the result set to be readable or the task to be cancelled in batches is entered. The process introduces an IO multiplexing and pipeline mechanism, and returns after all result sets are readable or a task canceling event is received, so that the task can be canceled quickly, and an application layer can deal with other things quickly.
When all target nodes are executed, the result set can be returned from the logic after being readable (the node execution results of all target nodes are obtained), and the result set can be read in a non-blocking batch mode. When the user needs to cancel the task, the user only needs to write data into the pipeline, namely, the readable event of the pipeline is triggered and returned from the poll _ wait, so that the process of waiting for the result set can be immediately finished, and the task can be quickly cancelled.
In some embodiments, the method further comprises:
and adding the target connection object into a task canceling queue, and ending the task of each target connection object in the task canceling queue.
Since only the task cancellation is returned as the final execution result, and only the to-be-issued SQL statement is executed at the end of the application layer, the tasks are not cancelled from each node actually, and the tasks are still running, but the tasks are cancelled from the MPP distributed database layer. In order to actually cancel the task at the node level, a task canceling operation needs to be performed at the target node level as well.
Alternatively, this can be achieved by introducing a thread dedicated to task cancellation (kill thread). And the kill thread is responsible for canceling tasks and recovering connections at the node level.
Optionally, referring to fig. 4, fig. 4 provides a specific example method for canceling a task at a node level, where the method includes:
s401: the kill thread is started.
S402: whether an exit signal is received, if not, executing step S403:
s403: and acquiring the target connection object from the task dequeuing.
S404: and executing a kill thread on the target connection object which is executing the task of the SQL statement to be issued.
S405: and returning the target connection object to the connection pool.
Optionally, if an exit signal is received, i.e., the system exits, the kill thread will also be terminated.
Optionally, if all the target connection objects are returned to the connection pool, the kill thread still remains until the system exits, and the kill thread is not finished.
Alternatively, the exit signal may be other signals set by those skilled in the art, and is not limited herein.
The embodiment of the invention avoids the multi-thread expense and the complexity of asynchronous programming by acquiring the SQL sentence to be issued and a plurality of target connection objects, sending the SQL sentence to be issued to the target node through the target connection objects, generating an SQL sending result, acquiring the target message and generating a final execution result, and dividing the execution SQL into two stages, thereby solving the problems that in the prior art, each node of the MPP distributed database executes a heavier task and needs to spend longer execution time, so if the synchronous blocked API is used for executing the serial operation, the performance is very low, for the multi-thread scheme of the distributed database, the expense is larger, one thread needs to be opened for each executed SQL, the efficiency is lower, the performance is improved, the expense of the parallel multi-thread is reduced, and the invention is simple and convenient.
Example two
Referring to fig. 5, an embodiment of the present invention further provides an SQL statement execution system 500, including:
an obtaining module 501, configured to obtain an SQL statement to be issued and a plurality of target connection objects;
a sending module 502, configured to send an SQL statement to be issued to each target node through a target connection object, and generate an SQL sending result;
the generating module 503 is configured to obtain a target message and generate a final execution result, where the target message includes a task canceling message or a node execution result of each target node.
In this embodiment, the SQL statement execution system is substantially provided with a plurality of modules for executing the SQL statement execution method in the foregoing embodiment, and specific functions and technical effects are as described in the first embodiment, which is not described herein again.
Referring to fig. 6, an embodiment of the present invention further provides a terminal 1100, including a processor 1101, a memory 1102, and a communication bus 1103;
a communication bus 1103 is used to connect the processor 1101 with the memory 1102;
the processor 1101 is configured to execute the computer program stored in the memory 1102 to implement the SQL statement execution method according to any one of the first embodiment.
An embodiment of the present invention also provides a computer-readable storage medium, characterized in that, a computer program is stored thereon,
the computer program is used for making the computer execute the SQL statement execution method in any one of the above embodiments.
Embodiments of the present application also provide a non-transitory readable storage medium, where one or more modules (programs) are stored in the storage medium, and when the one or more modules are applied to a device, the device may execute instructions (instructions) included in an embodiment of the present application.
It should be noted that the computer readable medium in the present disclosure can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, 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 disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In contrast, in the present disclosure, a computer readable signal medium may comprise a propagated data signal with computer readable program code embodied therein, either in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, optical cables, RF (radio frequency), etc., or any suitable combination of the foregoing.
The computer readable medium may be embodied in the electronic device; or may exist separately without being assembled into the electronic device.
Computer program code for carrying out operations for aspects of the present disclosure may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + +, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the 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 the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The foregoing embodiments are merely illustrative of the principles and utilities of the present invention and are not intended to limit the invention. Any person skilled in the art can modify or change the above-mentioned embodiments without departing from the spirit and scope of the present invention. Accordingly, it is intended that all equivalent modifications or changes which can be made by those skilled in the art without departing from the spirit and technical spirit of the present invention be covered by the claims of the present invention.

Claims (10)

1. An SQL statement execution method is characterized by comprising the following steps:
acquiring SQL sentences to be issued and a plurality of target connection objects;
sending the SQL sentence to be issued to each target node through the target connection object, and generating an SQL sending result;
and acquiring a target message and generating a final execution result, wherein the target message comprises a task canceling message or a node execution result of each target node.
2. The SQL statement execution method according to claim 1, wherein the obtaining of the target message and the generating of the final execution result comprises any one of:
if the target message comprises the node execution result of each target node, generating a result set according to the node execution result, wherein the final execution result comprises the result set;
and if the target message comprises a task canceling message, the final execution result comprises task canceling.
3. The SQL statement execution method according to claim 1, wherein each of the node execution results is obtained in the following manner:
obtaining a node execution result of the target node;
and if the target message is not acquired currently, continuously acquiring the node execution result of the next target node until the node execution result of each target node is acquired.
4. The SQL statement execution method according to claim 3, further comprising:
and if the target message is currently acquired and comprises a task canceling message, stopping acquiring a node execution result of the next target node, wherein the final execution result comprises task canceling.
5. The SQL statement execution method according to claim 1, wherein each of the node execution results is obtained in the following manner:
respectively initializing a poll object and a pipeline, and monitoring a readable event of the pipeline through the poll object, wherein the readable event of the pipeline comprises writing in the task canceling message;
monitoring readable events of each target connection object through the poll object, and waiting for the readable events of each target connection object through poll _ wait, wherein the readable events of the target connection objects comprise node execution results of the target nodes;
acquiring a readable event of the target connection object;
and if the pipeline is not readable, acquiring the next readable event of the target connecting object until all the readable events of the target connecting object are acquired.
6. The SQL statement execution method of claim 5, wherein,
and if the pipeline is readable, the final execution result comprises task cancellation.
7. The SQL statement execution method according to any one of claims 2, 4, and 6, wherein if the final execution result includes task cancellation, any one of the following is further included:
adding the target connection object into a task canceling queue;
and adding the target connection object into a task cancellation queue, and ending the task of each target connection object in the task cancellation queue.
8. An SQL statement execution system, comprising:
the acquisition module is used for acquiring the SQL sentence to be issued and a plurality of target connection objects;
the sending module is used for sending the SQL sentence to be issued to each target node through the target connection object and generating an SQL sending result;
and the generating module is used for acquiring a target message and generating a final execution result, wherein the target message comprises a task canceling message or a node execution result of each target node.
9. A terminal comprising a processor, a memory, and a communication bus;
the communication bus is used for connecting the processor and the memory;
the processor is configured to execute a computer program stored in the memory to implement the SQL statement execution method according to any of claims 1-7.
10. A computer-readable storage medium, having stored thereon a computer program,
the computer program for causing the computer to execute the SQL statement execution method according to any of claims 1 to 7.
CN202011480506.9A 2020-12-15 2020-12-15 SQL statement execution method, system, terminal and medium Pending CN112579637A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011480506.9A CN112579637A (en) 2020-12-15 2020-12-15 SQL statement execution method, system, terminal and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011480506.9A CN112579637A (en) 2020-12-15 2020-12-15 SQL statement execution method, system, terminal and medium

Publications (1)

Publication Number Publication Date
CN112579637A true CN112579637A (en) 2021-03-30

Family

ID=75135247

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011480506.9A Pending CN112579637A (en) 2020-12-15 2020-12-15 SQL statement execution method, system, terminal and medium

Country Status (1)

Country Link
CN (1) CN112579637A (en)

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6275843B1 (en) * 1994-12-22 2001-08-14 Unisys Corporation Method and apparatus for processing multiple service requests within a global transaction by a single server application program instance
KR20140049202A (en) * 2012-10-16 2014-04-25 케이티하이텔 주식회사 Distributed database management system and method
CN105608086A (en) * 2014-11-17 2016-05-25 中兴通讯股份有限公司 Transaction processing method and device of distributed database system
CN105786594A (en) * 2016-02-25 2016-07-20 北京小米移动软件有限公司 Distributed transaction processing method, device and system
CN108306948A (en) * 2018-01-15 2018-07-20 新华三技术有限公司 Dispatching method and device
CN108933822A (en) * 2018-06-28 2018-12-04 北京百度网讯科技有限公司 Method and apparatus for handling information
CN109544015A (en) * 2018-11-26 2019-03-29 平安科技(深圳)有限公司 A kind of method for allocating tasks and relevant device based on data processing
CN111522672A (en) * 2020-04-24 2020-08-11 北京思特奇信息技术股份有限公司 Method and system for repeated consumption of fusing data
CN111651470A (en) * 2019-03-04 2020-09-11 顺丰科技有限公司 Unified SQL execution and query method and system

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6275843B1 (en) * 1994-12-22 2001-08-14 Unisys Corporation Method and apparatus for processing multiple service requests within a global transaction by a single server application program instance
KR20140049202A (en) * 2012-10-16 2014-04-25 케이티하이텔 주식회사 Distributed database management system and method
CN105608086A (en) * 2014-11-17 2016-05-25 中兴通讯股份有限公司 Transaction processing method and device of distributed database system
CN105786594A (en) * 2016-02-25 2016-07-20 北京小米移动软件有限公司 Distributed transaction processing method, device and system
CN108306948A (en) * 2018-01-15 2018-07-20 新华三技术有限公司 Dispatching method and device
CN108933822A (en) * 2018-06-28 2018-12-04 北京百度网讯科技有限公司 Method and apparatus for handling information
CN109544015A (en) * 2018-11-26 2019-03-29 平安科技(深圳)有限公司 A kind of method for allocating tasks and relevant device based on data processing
CN111651470A (en) * 2019-03-04 2020-09-11 顺丰科技有限公司 Unified SQL execution and query method and system
CN111522672A (en) * 2020-04-24 2020-08-11 北京思特奇信息技术股份有限公司 Method and system for repeated consumption of fusing data

Similar Documents

Publication Publication Date Title
CN108537543B (en) Parallel processing method, device, equipment and storage medium for blockchain data
US8763012B2 (en) Scalable, parallel processing of messages while enforcing custom sequencing criteria
CN112148455B (en) Task processing method, device and medium
CN111338797B (en) Task processing method, device, electronic equipment and computer readable storage medium
CN109634764A (en) Work-flow control method, apparatus, equipment, storage medium and system
CN110851276A (en) Service request processing method, device, server and storage medium
CN112363913B (en) Parallel test task scheduling optimizing method, device and computing equipment
CN113760991A (en) Data operation method and device, electronic equipment and computer readable medium
CN113419841B (en) Message scheduling method and device, electronic equipment and computer readable medium
CN113282444A (en) Visualization method and device for business process debugging
CN113127564B (en) Parameter synchronization method and device
CN110413210B (en) Method, apparatus and computer program product for processing data
CN110515749B (en) Method, device, server and storage medium for queue scheduling of information transmission
CN117076096A (en) Task flow execution method and device, computer readable medium and electronic equipment
CN116821187A (en) Database-based data processing method and device, medium and electronic equipment
CN112363914A (en) Parallel test resource configuration optimization method, computing device and storage medium
CN112579637A (en) SQL statement execution method, system, terminal and medium
CN110879818B (en) Method, device, medium and electronic equipment for acquiring data
CN113888028A (en) Patrol task allocation method and device, electronic equipment and storage medium
CN112711602A (en) Running method and device of storage process, database system and storage medium
CN112182003A (en) Data synchronization method and device
CN106484536B (en) IO scheduling method, device and equipment
CN112486421B (en) Data storage method and device, electronic equipment and storage medium
CN113792051B (en) Data processing method, system, equipment and storage medium based on multi-mode lock
CN113761548B (en) Data transmission method and device for Shuffle process

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