CN117149770A - Method and device for executing storage process of database and computer equipment - Google Patents

Method and device for executing storage process of database and computer equipment Download PDF

Info

Publication number
CN117149770A
CN117149770A CN202311117631.7A CN202311117631A CN117149770A CN 117149770 A CN117149770 A CN 117149770A CN 202311117631 A CN202311117631 A CN 202311117631A CN 117149770 A CN117149770 A CN 117149770A
Authority
CN
China
Prior art keywords
executed
data
execution
executing
branch
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
CN202311117631.7A
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.)
Jinzhuan Xinke Co Ltd
Original Assignee
Jinzhuan Xinke 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 Jinzhuan Xinke Co Ltd filed Critical Jinzhuan Xinke Co Ltd
Priority to CN202311117631.7A priority Critical patent/CN117149770A/en
Publication of CN117149770A publication Critical patent/CN117149770A/en
Pending legal-status Critical Current

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/22Indexing; Data structures therefor; Storage structures
    • G06F16/2291User-Defined Types; Storage management thereof
    • 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/25Integrating or interfacing systems involving database management systems
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

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

Abstract

The disclosure provides a method, a device and a computer device for executing a storage process of a database, wherein the method comprises the following steps: acquiring data to be executed, and determining execution parameters of the data to be executed; invoking a judging condition corresponding to a storage process, and determining a target branch corresponding to the execution parameter in the storage process based on the judging condition; the target branch is used for executing the data to be executed, so that the whole storage process is not required to be occupied when the data to be executed is processed, and a plurality of data to be executed can be executed in parallel through different branches in the storage process, thereby improving the efficiency of data execution.

Description

Method and device for executing storage process of database and computer equipment
Technical Field
The disclosure relates to the technical field of databases, and in particular relates to a method and a device for executing a storage process of a database and computer equipment.
Background
In the database field, a storage process is a set of SQL statements for completing a specific function, which is stored in the database after the first compilation, and is directly executed every time the storage process is called, so that the compilation is not repeated.
With the development and popularization of the internet, the data volume of enterprise business is continuously increased, the traditional single-machine database achieves performance bottleneck in facing to real-time business demands under a massive data scene, and more enterprises select a distributed database formed by a plurality of nodes to finish the storage and processing of business data. However, in the existing distributed database technology, when a large amount of data is needed to be subjected to a storage process determination, the data still can only be subjected to the storage process in series, and a large amount of time is needed after all the data are executed, so that the data processing speed is slower, and the use requirement of a user cannot be met.
Disclosure of Invention
The embodiment of the disclosure at least provides a method, a device and computer equipment for executing a storage process of a database.
In a first aspect, an embodiment of the present disclosure provides a method for executing a storage procedure of a database, including:
acquiring data to be executed, and determining execution parameters of the data to be executed;
invoking a judging condition corresponding to a storage process, and determining a target branch corresponding to the execution parameter in the storage process based on the judging condition;
and executing the data to be executed through the target branch.
In an optional implementation manner, the determining, based on the judging condition, a target branch corresponding to the execution parameter in the storing process includes:
judging the execution parameters based on the judging conditions to obtain a judging result;
among the plurality of execution branches, a target branch that matches the determination result is determined.
In an alternative embodiment, the target branch includes: structured query language SQL statements;
the executing the data to be executed through the target branch comprises the following steps:
and when the SQL statement comprises a static SQL statement, executing the data to be executed according to the statement execution sequence indicated by the target branch.
In an optional implementation manner, the executing the data to be executed through the target branch further includes:
when the SQL statement comprises a dynamic SQL statement, assigning a value to a variable in the dynamic SQL statement based on the data to be executed to obtain an assigned SQL statement;
and determining a target database for executing the data to be executed based on the assignment SQL statement, and executing the data to be executed according to the target database.
In an alternative embodiment, the target branch includes: a conditional statement;
the executing the data to be executed through the target branch comprises the following steps:
judging the data to be executed through the conditional statement, and determining a sub-branch matched with a judging result;
and executing the data to be executed based on the sub-branch.
In an alternative embodiment, the method further comprises:
in the process of executing the data to be executed, determining the thread corresponding to the target branch as a blocking state;
and ending the blocking state after all the sub-branches of the target branch are executed.
In an alternative embodiment, the method further comprises:
analyzing the storage process to obtain at least one conditional statement;
and dividing the storage process according to each conditional statement, and establishing a corresponding execution branch.
In a second aspect, an embodiment of the present disclosure further provides a stored procedure execution apparatus of a database, including:
the determining unit is used for acquiring data to be executed and determining execution parameters of the data to be executed;
the calling unit is used for calling a judging condition corresponding to a storage process and determining a target branch corresponding to the execution parameter in the storage process based on the judging condition;
and the execution unit is used for executing the data to be executed through the target branch.
In a third aspect, embodiments of the present disclosure further provide a computer device, comprising: a processor, a memory and a bus, the memory storing machine-readable instructions executable by the processor, the processor and the memory in communication via the bus when the computer device is running, the machine-readable instructions when executed by the processor performing the steps of the first aspect, or any of the possible implementations of the first aspect.
In a fourth aspect, the present application also provides a computer storage medium storing computer executable instructions for performing the method for performing a storage procedure of a database according to any one of the above aspects of the present application.
Compared with the prior art, the technical scheme provided by the embodiment of the application has the following advantages: according to the method provided by the embodiment of the application, the data to be executed can be acquired firstly, the execution parameters of the data to be executed are determined, then the corresponding judgment conditions of the storage process are called, and the target branch of the execution parameters in the storage process is determined based on the judgment conditions, so that the data to be executed is executed through the target branch, the whole storage process is not required to be occupied when the data to be executed is processed, and a plurality of data to be executed can be executed through different branches in the storage process in parallel, so that the data execution efficiency is improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the drawings required for the embodiments are briefly described below, which are incorporated in and constitute a part of the specification, these drawings showing embodiments consistent with the present disclosure and together with the description serve to illustrate the technical solutions of the present disclosure. It is to be understood that the following drawings illustrate only certain embodiments of the present disclosure and are therefore not to be considered limiting of its scope, for the person of ordinary skill in the art may admit to other equally relevant drawings without inventive effort.
FIG. 1 is a flow chart of a method for performing a storage process of a database according to an embodiment of the present disclosure;
FIG. 2 is a schematic diagram of a storage process operation flow according to an embodiment of the present disclosure;
FIG. 3 is a flow chart of a method for executing a storage process of a database according to an embodiment of the present disclosure;
FIG. 4 is a schematic diagram of a database storage process execution apparatus according to an embodiment of the present disclosure;
fig. 5 shows a schematic diagram of a computer device provided by an embodiment of the present disclosure.
Detailed Description
For the purposes of making the objects, technical solutions and advantages of the embodiments of the present disclosure more apparent, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the drawings in the embodiments of the present disclosure, and it is apparent that the described embodiments are only some embodiments of the present disclosure, but not all embodiments. The components of the embodiments of the present disclosure, which are generally described and illustrated in the figures herein, may be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the present disclosure provided in the accompanying drawings is not intended to limit the scope of the disclosure, as claimed, but is merely representative of selected embodiments of the disclosure. All other embodiments, which can be made by those skilled in the art based on the embodiments of this disclosure without making any inventive effort, are intended to be within the scope of this disclosure.
It should be noted that: like reference numerals and letters denote like items in the following figures, and thus once an item is defined in one figure, no further definition or explanation thereof is necessary in the following figures.
The term "and/or" is used herein to describe only one relationship, meaning that there may be three relationships, e.g., a and/or B, which may mean: a exists alone, A and B exist together, and B exists alone. In addition, the term "at least one" herein means any one of a plurality or any combination of at least two of a plurality, for example, including at least one of A, B, C, and may mean including any one or more elements selected from the group consisting of A, B and C.
It is found that in the database field, the stored procedure is a set of SQL sentences for performing a specific function, which is stored in the database after the first compiling, and is directly executed every time the stored procedure is called, and the compiling is not repeated.
With the development and popularization of the internet, the data volume of enterprise business is continuously increased, the traditional single-machine database achieves performance bottleneck in facing to real-time business demands under a massive data scene, and more enterprises select a distributed database formed by a plurality of nodes to finish the storage and processing of business data. However, in the existing distributed database technology, when a large amount of data is needed to be subjected to a storage process determination, the data still can only be subjected to the storage process in series, and a large amount of time is needed after all the data are executed, so that the data processing speed is slower, and the use requirement of a user cannot be met.
Based on the above-mentioned study, in the embodiment of the present disclosure, first, data to be executed may be obtained, and an execution parameter of the data to be executed may be determined, then, a judgment condition corresponding to the storage process is invoked, and a target branch of the execution parameter in the storage process is determined based on the judgment condition, so that the data to be executed is executed through the target branch, so that the whole storage process is not required to be occupied when the data to be executed is processed, and instead, a plurality of data to be executed may be executed through different branches in parallel in the storage process, thereby improving efficiency of data execution.
For the sake of understanding the present embodiment, first, a detailed description will be given of a method for executing a storage procedure of a database disclosed in an embodiment of the present disclosure, where an execution body of the method for executing a storage procedure of a database provided in an embodiment of the present disclosure is generally a computer device with a certain computing capability. In some possible implementations, the method of executing the stored procedure of the database may be implemented by a processor calling computer readable instructions stored in a memory.
Referring to fig. 1, a flowchart of a method for executing a storage procedure of a database according to an embodiment of the disclosure is shown, where the method includes steps S101 to S105, where:
s101: and acquiring data to be executed, and determining execution parameters of the data to be executed.
In the embodiment of the present disclosure, as known from the above, the stored procedure is a set of SQL statements for performing a specific function, and thus, the execution parameters may be used as the execution parameters of the SQL statements in the stored procedure.
For example, if the specific function to be performed by the storage procedure is data pushing for accounts with a registration age greater than X, then in the storage procedure, an SQL statement for filtering accounts with a registration age greater than X is included.
After the data to be executed is obtained, if the execution parameter corresponding to the data to be executed is the registration period of 2 years, the execution parameter can be transmitted into the storage process to be used as the operation parameter of the SQL sentence, so that the account with the registration period of more than 2 years can be screened out through the SQL sentence.
S103: and calling a judging condition corresponding to a storage process, and determining a target branch corresponding to the execution parameter in the storage process based on the judging condition.
S105: and executing the data to be executed through the target branch.
In an embodiment of the present disclosure, the above-mentioned judging condition may include a conditional expression, and on the basis of this, the above-mentioned execution parameter may be transferred into the conditional expression to obtain a judging result, and a target branch matching the judging result may be determined.
It should be appreciated that the stored procedure may be pre-partitioned into multiple execution branches according to the execution logic of the stored procedure described above, where each execution branch may correspond to at least one segment of execution logic.
For example, if the function of the storage process is to process the user data according to the age of the user, the condition judgment statement may be to judge whether the age of the user is greater than 50 years old, if yes, branch 1 is executed, and if not, branch 2 is executed. If the execution parameter corresponding to the data to be executed is 20 years old, the judgment result is no, and the target branch corresponding to the data to be executed is branch 2.
As can be seen from the foregoing description, in the embodiments of the present disclosure, first, data to be executed may be acquired, an execution parameter of the data to be executed may be determined, then, a determination condition corresponding to a storage process may be invoked, and a target branch of the execution parameter in the storage process may be determined based on the determination condition, so that the data to be executed may be executed through the target branch, so that the whole storage process is not required to be occupied when the data to be executed is processed, but a plurality of data to be executed may be executed through different branches in parallel in the storage process, thereby improving efficiency of data execution.
In an optional embodiment, step S103, based on the judging condition, determines a target branch corresponding to the execution parameter in the storing process, which specifically includes the following steps:
s1031: and judging the execution parameters based on the judging conditions to obtain a judging result.
S1032: among the plurality of execution branches, a target branch that matches the determination result is determined.
In an embodiment of the present disclosure, the above-mentioned judgment condition includes a conditional expression, and the above-mentioned judgment result is used to indicate whether the execution parameter satisfies the judgment condition indicated by the conditional expression. For example, the conditional expression may be used to determine whether an execution parameter of the data to be executed is greater than 50.
It should be appreciated that the stored procedure may be pre-partitioned into multiple execution branches according to the execution logic of the stored procedure described above, where each execution branch may correspond to at least one segment of execution logic. Here, the above conditional expressions may be used to indicate logical partitioning nodes in the execution logic.
For example, in the distributed database, the enterprise a writes the business logic into a stored procedure operation flow, the stored procedure corresponds to a plurality of input parameters inputOptions, and the business logic judgment can be performed through a conditional expression (such as expression_1) of the input parameters, so as to execute the SQL statement set SQLs in different conditional branches, and the execution procedure of the stored procedure is as follows:
create procedure operationFlow(IN inputOptions)
Begin IF expression_1(inputOptions)THEN
branch 1//
SQLs_1;
ELSE expression_2(inputOptions)THEN
Branch 2//
SQLs_2;
IF expression_2_1(inputOptions)THEN
Branches 2_1
SQLs_2_1;
ELSE
Branches 2_2 of//
SQLs_2_2;
END IF;
ELSE
Branch 3/branch 3
SQLs_3;
END IF;
END。
Wherein the judgment conditions of the above-described storage process include conditional expression 1: IF expression_1 (inputs operations) THEN, ELSE expression_2 (inputs operations) THEN, and conditional expression 2: IF expression_2_1 (inputs operations) THEN, ELSE.
In specific execution, the execution parameters of the data to be executed may be first transferred into conditional expression 1, and if the execution parameters conform to expression expression_1, the data to be executed is executed through branch 1. If the expression expression_1 is not met, it is determined whether the execution parameters are met with the expression expression_2, if so, branch 2 is executed, and if not, branch 3 is executed.
In the embodiment of the disclosure, the storage process may be divided into a plurality of execution branches in advance according to the execution logic of the storage process, where each execution branch may correspond to at least one segment of execution logic, so that a plurality of pieces of data to be executed may be executed in parallel through the plurality of branches, so that the data to be executed does not need to be serially passed through the storage process, and the data execution efficiency is improved.
In an alternative embodiment, the target branch includes: the step S105 of structuring the query language SQL statement, executing the data to be executed through the target branch, includes:
and when the SQL statement comprises a static SQL statement, executing the data to be executed according to the statement execution sequence indicated by the target branch.
In the embodiment of the disclosure, in the static SQL statement described above, the character string is fixed, for example, the static SQL statement may be used to indicate that the data to be executed is stored to a designated storage location of the database.
Considering that a statement set SQLs composed of a plurality of SQL statements is generally included in a target branch, the SQL statements therein may be sequentially executed in the statement execution order indicated by the statement set SQLs.
It should be appreciated that in the above-described distributed database, a plurality of database nodes are typically included, each of which may correspond to at least one database transaction, and thus, when the statement set SQLs is executed in the target branch in the above-described statement execution order, the statement set SQLs may be executed once under each database transaction, respectively.
In the embodiment of the disclosure, the data to be executed may be executed according to the statement execution sequence indicated by the target branch, so that the data to be executed is executed through the target branch without occupying the whole storage process.
In an optional embodiment, step S105, executing the data to be executed through the target branch, specifically further includes the following steps:
s11: when the SQL statement comprises a dynamic SQL statement, assigning the variable in the dynamic SQL statement based on the data to be executed to obtain an assigned SQL statement.
S12: and determining a target database for executing the data to be executed based on the assignment SQL statement, and executing the data to be executed according to the target database.
In the embodiment of the disclosure, in the dynamic SQL statement, there is a string that cannot be determined to include a variable at the time of compiling, so that the variable needs to be assigned according to data to be executed. For example, the dynamic SQL statement is used to screen out account numbers whose registration period exceeds a, where the value of a depends on the number x of data pieces of the data to be executed, i.e., a=x/b.
After the variables in the dynamic SQL statement are assigned to obtain the assigned SQL statement, the assigned SQL statement can be executed, and the fact that a plurality of database nodes involved in the execution process of the assigned SQL statement in the distributed database can be considered. Thus, the database node corresponding to the assigned SQL statement in the distributed database can be determined to obtain the target database.
In the embodiment of the disclosure, after the assignment SQL statement is determined, the assignment SQL statement may be merged, and the merged content may be sent to the target database for execution, so as to reduce the number of communications between database nodes, thereby reducing communication consumption.
In an alternative embodiment, the target branch includes: the conditional statement, step S105, executes the data to be executed through the target branch, specifically includes the following steps:
s21: and judging the data to be executed through the conditional statement, and determining the sub-branch matched with the judging result.
S22: and executing the data to be executed based on the sub-branch.
In the embodiment of the disclosure, considering that a plurality of conditional sentences may be included in the storage process, the conditional sentences may be executed in a nested manner, wherein the conditional sentences are the conditional expressions. Here, the above-described storage process operation flow is taken as an example.
In the above-described branch 2 of the stored procedure operation flow, the conditional expression expression_2_1 (inputoperations) THEN, ELSE is included. If the judging result of the execution parameters of the data to be executed by the conditional expression accords with the expression_2_1, the subbranch 2_1 is determined to be a matched subbranch, and if the judging result does not accord with the expression_2_1, the subbranch 2_2 is determined to be a matched subbranch.
After determining the sub-branch, the data to be executed may be processed based on the sub-branch. It should be understood that the nesting condition statement may also be continued in the sub-branch, and the number of nesting layers is not specifically limited in the present disclosure, so that the actual use needs are in order.
In the embodiment of the disclosure, the storage process may include a plurality of conditional sentences, so that the conditional sentences can be executed in a nested manner, thereby perfecting the execution process of the sentences in the storage process.
In an alternative embodiment, the step S105 specifically further includes the following steps:
(1) Determining a thread corresponding to the target branch as a blocking state in the process of executing the data to be executed;
(2) And ending the blocking state after all the sub-branches of the target branch are executed.
In the embodiment of the disclosure, when a thread corresponding to a target branch is in a blocking state, processing requests of other data to be executed cannot be responded. Therefore, when executing a sub-branch in a target branch, it is necessary to adjust the state of the thread corresponding to the target branch to a blocked state.
After the execution of the SQL statements in the sub-branches is finished, the sub-branches can feed back the execution results to the target branches, and after the execution of the SQL statements in all the sub-branches is determined to be finished based on the received execution results, the target branches can determine that the execution of the data to be executed is finished and end the blocking state of the target branches so that the target branches can continue to execute the data received next.
In the embodiment of the disclosure, when the sub-branches in the target branch are executed, the state of the target branch can be adjusted to be a blocking state, so that the sub-branches in the target branch are prevented from colliding in the execution process, and the execution failure is caused.
In an alternative embodiment, the foregoing embodiment corresponding to fig. 1 further includes the following procedure:
(1) Analyzing the storage process to obtain at least one conditional statement;
(2) And dividing the storage process according to each conditional statement to establish a corresponding execution branch.
In the embodiment of the present disclosure, when a conditional statement is included in a storage process, the conditional statement may be used as a partition node for partitioning the storage process, so as to obtain execution branches corresponding to each conditional statement. Here, the SQL statement set SQLs between the current conditional statement and the next conditional statement may be combined with the current conditional statement to obtain one execution branch.
Here, as shown in fig. 2, a schematic diagram of the execution process of the above-mentioned stored process operation flow is shown, wherein the above-mentioned conditional expression 1 may be based first: IF expression_1 () THEN, ELSE expression_2 () THEN, conditional expression 2: IF expression_2_1 () THEN, ELSE splits the storage process into 3 execution branches: branch 1, branch 2 and branch 3. In branch 2, it is also possible by conditional expression 3: IF expression_2_1 () THEN, ELSE continues dividing this branch 2, resulting in branches 2_1 and 2_2.
Specifically, when the data to be executed is branched through the above-mentioned storage process operation flow, if the number of the data to be executed is 10 ten thousand, firstly, it can be judged according to the conditions of expression_1 (), expression_2 () in the expression, and k will be k 1 The stripe data is classified as branch 1, k is taken 2 The stripe data is classified as branch 2, k 3 The stripe data enters branch 3 and separate execution threads are built for different branches to execute statements within the branches in batches.
Next, for branch 2, a sub-branch determination is made: judgment is performed according to the condition of expression_2_1 () in conditional expression 3, and k is taken as 2_1 The stripe data is classified as branches2_1, let k 2_2 The stripe data is classified into a branch 2_2, and separate thread batch execution sentences in the branches are established for different branches; after the execution of the branches 2_1 and 2_2 is finished, returning an execution result to the branch 2, and waking up the branch 2 to end the blocking state so as to enable the branch 2 to continue to execute; after all execution of branches 1, 2, 3 is completed, the execution of the storage process for 10 ten thousand pieces of data is completed.
In the embodiment of the disclosure, the storage process can be divided according to the conditional statement in the storage process, and corresponding execution branches are established, so that the data to be executed is processed in parallel through a plurality of execution branches, and the processing efficiency of the storage process in processing the data to be executed is improved.
Referring to fig. 3, a flowchart of a method for executing a storage procedure of a database according to an embodiment of the disclosure is shown, where a specific flowchart is as follows:
in the embodiment of the disclosure, the storage process may be compiled first to obtain a machine language corresponding to the storage process, and the data set of the large amount of data to be executed is subjected to branch determination according to the determination condition in the compiled storage process to obtain a determination result. Here, it is determined that the target branch corresponding to the data set 1 is the branch 1 and the target branch corresponding to the data set 2-N is the branch 2-N according to the judgment result.
Taking the thread 1 corresponding to the branch 1 as an example, when executing the statement in the branch 1, the statement type of the statement may be judged first, and if the statement is the above-mentioned SQL statement (including static SQL statement and dynamic SQL statement), the SQL statement is batched, that is, the SQL is sent to the corresponding database node for execution.
If the type of the statement is determined to be the conditional statement, a sub-branch determination is performed, and it should be understood that, when executing the sub-thread, the adjustment of the branch 1 may be performed in a blocking state, and after all n sub-branches in the branch 1 are executed, the thread 1 may be awakened.
It should be understood that the specific execution of branches 2-N and the execution that may refer to branch 1 are not described in detail in this disclosure.
In summary, in the embodiment of the present disclosure, first, data to be executed may be acquired, an execution parameter of the data to be executed may be determined, then, a determination condition corresponding to a storage process may be invoked, and a target branch of the execution parameter in the storage process may be determined based on the determination condition, so that the data to be executed may be executed through the target branch, so that the whole storage process is not required to be occupied when the data to be executed is processed, but multiple data to be executed may be executed through different branches in parallel in the storage process, thereby improving efficiency of data execution.
It will be appreciated by those skilled in the art that in the above-described method of the specific embodiments, the written order of steps is not meant to imply a strict order of execution but rather should be construed according to the function and possibly inherent logic of the steps.
Based on the same inventive concept, the embodiments of the present disclosure further provide a device for executing a storage process of a database, which corresponds to the method for executing a storage process of a database, and since the principle of solving the problem by the device in the embodiments of the present disclosure is similar to that of the method for executing the storage process of the database in the embodiments of the present disclosure, the implementation of the device may refer to the implementation of the method, and the repetition is omitted.
Referring to fig. 4, a schematic diagram of a device for executing a storage procedure of a database according to an embodiment of the disclosure is shown, where the device includes: a determining unit 41, a calling unit 42, an executing unit 43; wherein,
a determining unit 41, configured to acquire data to be executed, and determine an execution parameter of the data to be executed;
a calling unit 42, configured to call a judgment condition corresponding to a storage procedure, and determine a target branch corresponding to the execution parameter in the storage procedure based on the judgment condition;
and an execution unit 43, configured to execute the data to be executed through the target branch.
In the embodiment of the disclosure, firstly, the data to be executed can be acquired, the execution parameters of the data to be executed are determined, then, the judgment conditions corresponding to the storage process are called, and the target branch of the execution parameters in the storage process is determined based on the judgment conditions, so that the data to be executed is executed through the target branch, the whole storage process is not required to be occupied when the data to be executed is processed, and a plurality of data to be executed can be executed through different branches in the storage process in parallel, so that the efficiency of data execution is improved.
In a possible implementation, the calling unit 42 is further configured to:
judging the execution parameters based on the judging conditions to obtain a judging result;
among the plurality of execution branches, a target branch that matches the determination result is determined.
In a possible implementation manner, the target branch includes: the execution unit 43 is further configured to structure a query language SQL statement:
and when the SQL statement comprises a static SQL statement, executing the data to be executed according to the statement execution sequence indicated by the target branch.
In a possible embodiment, the execution unit 43 is further configured to:
when the SQL statement comprises a dynamic SQL statement, assigning a value to a variable in the dynamic SQL statement based on the data to be executed to obtain an assigned SQL statement;
and determining a target database for executing the data to be executed based on the assignment SQL statement, and executing the data to be executed according to the target database.
In a possible implementation manner, the target branch includes: conditional statement, execution unit 43, further for:
judging the data to be executed through the conditional statement, and determining a sub-branch matched with a judging result;
and executing the data to be executed based on the sub-branch.
In a possible embodiment, the execution unit 43 is further configured to:
in the process of executing the data to be executed, determining the thread corresponding to the target branch as a blocking state;
and ending the blocking state after all the sub-branches of the target branch are executed.
In a possible embodiment, the device is further configured to:
analyzing the storage process to obtain at least one conditional statement;
and dividing the storage process according to each conditional statement, and establishing a corresponding execution branch.
The process flow of each unit in the apparatus and the interaction flow between units may be described with reference to the related descriptions in the above method embodiments, which are not described in detail herein.
The embodiment of the present disclosure further provides a computer device 500 corresponding to the method for executing the storage procedure of the database in fig. 1, as shown in fig. 5, which is a schematic structural diagram of the computer device 500 provided in the embodiment of the present disclosure, including:
a processor 51, a memory 52, and a bus 53; memory 52 is used to store execution instructions, including memory 521 and external storage 522; the memory 521 is also referred to as an internal memory, and is used for temporarily storing operation data in the processor 51 and data exchanged with the external memory 522 such as a hard disk, and the processor 51 exchanges data with the external memory 522 through the memory 521, and when the computer device 500 is operated, the processor 51 and the memory 52 communicate with each other through the bus 53, so that the processor 51 executes the following instructions:
acquiring data to be executed, and determining execution parameters of the data to be executed;
invoking a judging condition corresponding to a storage process, and determining a target branch corresponding to the execution parameter in the storage process based on the judging condition;
and executing the data to be executed through the target branch.
The disclosed embodiments also provide a computer readable storage medium having a computer program stored thereon, which when executed by a processor performs the steps of the method for performing the storing process of the database described in the method embodiments above. Wherein the storage medium may be a volatile or nonvolatile computer readable storage medium.
The embodiments of the present disclosure further provide a computer program product, where the computer program product carries a program code, where instructions included in the program code may be used to execute steps of a method for executing a storage procedure of a database described in the foregoing method embodiments, and specifically reference may be made to the foregoing method embodiments, which are not described herein.
Wherein the above-mentioned computer program product may be realized in particular by means of hardware, software or a combination thereof. In an alternative embodiment, the computer program product is embodied as a computer storage medium, and in another alternative embodiment, the computer program product is embodied as a software product, such as a software development kit (Software Development Kit, SDK), or the like.
It will be clear to those skilled in the art that, for convenience and brevity of description, specific working procedures of the above-described system and apparatus may refer to corresponding procedures in the foregoing method embodiments, which are not described herein again. In the several embodiments provided in the present disclosure, it should be understood that the disclosed systems, devices, and methods may be implemented in other manners. The above-described apparatus embodiments are merely illustrative, for example, the division of the units is merely a logical function division, and there may be other manners of division in actual implementation, and for example, multiple units or components may be combined or integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be through some communication interface, device or unit indirect coupling or communication connection, which may be in electrical, mechanical or other form.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in each embodiment of the present disclosure may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a non-volatile computer readable storage medium executable by a processor. Based on such understanding, the technical solution of the present disclosure may be embodied in essence or a part contributing to the prior art or a part of the technical solution, or in the form of a software product stored in a storage medium, including several instructions to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in the embodiments of the present disclosure. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
Finally, it should be noted that: the foregoing examples are merely specific embodiments of the present disclosure, and are not intended to limit the scope of the disclosure, but the present disclosure is not limited thereto, and those skilled in the art will appreciate that while the foregoing examples are described in detail, it is not limited to the disclosure: any person skilled in the art, within the technical scope of the disclosure of the present disclosure, may modify or easily conceive changes to the technical solutions described in the foregoing embodiments, or make equivalent substitutions for some of the technical features thereof; such modifications, changes or substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the disclosure, and are intended to be included within the scope of the present disclosure. Therefore, the protection scope of the present disclosure shall be subject to the protection scope of the claims.

Claims (10)

1. A method for executing a storage process of a database, comprising:
acquiring data to be executed, and determining execution parameters of the data to be executed;
invoking a judging condition corresponding to a storage process, and determining a target branch corresponding to the execution parameter in the storage process based on the judging condition;
and executing the data to be executed through the target branch.
2. The method of claim 1, wherein determining a target branch for which the execution parameter corresponds in the storing based on the determination condition comprises:
judging the execution parameters based on the judging conditions to obtain a judging result;
among the plurality of execution branches, a target branch that matches the determination result is determined.
3. The method of claim 1, wherein the target branch comprises: structured query language SQL statements;
the executing the data to be executed through the target branch comprises the following steps:
and when the SQL statement comprises a static SQL statement, executing the data to be executed according to the statement execution sequence indicated by the target branch.
4. The method of claim 3, wherein the executing the data to be executed through the target branch further comprises:
when the SQL statement comprises a dynamic SQL statement, assigning a value to a variable in the dynamic SQL statement based on the data to be executed to obtain an assigned SQL statement;
and determining a target database for executing the data to be executed based on the assignment SQL statement, and executing the data to be executed according to the target database.
5. The method of claim 1, wherein the target branch comprises: a conditional statement;
the executing the data to be executed through the target branch comprises the following steps:
judging the data to be executed through the conditional statement, and determining a sub-branch matched with a judging result;
and executing the data to be executed based on the sub-branch.
6. The method of claim 5, wherein the method further comprises:
in the process of executing the data to be executed, determining the thread corresponding to the target branch as a blocking state;
and ending the blocking state after all the sub-branches of the target branch are executed.
7. The method according to claim 1, wherein the method further comprises:
analyzing the storage process to obtain at least one conditional statement;
and dividing the storage process according to each conditional statement, and establishing a corresponding execution branch.
8. A stored procedure execution apparatus of a database, comprising:
the determining unit is used for acquiring data to be executed and determining execution parameters of the data to be executed;
the calling unit is used for calling a judging condition corresponding to a storage process and determining a target branch corresponding to the execution parameter in the storage process based on the judging condition;
and the execution unit is used for executing the data to be executed through the target branch.
9. A computer device, comprising: a processor, a memory and a bus, said memory storing machine readable instructions executable by said processor, said processor and said memory communicating via the bus when the computer device is running, said machine readable instructions when executed by said processor performing the steps of the method for storing a process execution method for a database according to any of claims 1 to 7.
10. A computer-readable storage medium, characterized in that the computer-readable storage medium has stored thereon a computer program which, when executed by a processor, performs the steps of the method of storing a procedure execution method of a database according to any one of claims 1 to 7.
CN202311117631.7A 2023-08-31 2023-08-31 Method and device for executing storage process of database and computer equipment Pending CN117149770A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311117631.7A CN117149770A (en) 2023-08-31 2023-08-31 Method and device for executing storage process of database and computer equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311117631.7A CN117149770A (en) 2023-08-31 2023-08-31 Method and device for executing storage process of database and computer equipment

Publications (1)

Publication Number Publication Date
CN117149770A true CN117149770A (en) 2023-12-01

Family

ID=88883863

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311117631.7A Pending CN117149770A (en) 2023-08-31 2023-08-31 Method and device for executing storage process of database and computer equipment

Country Status (1)

Country Link
CN (1) CN117149770A (en)

Similar Documents

Publication Publication Date Title
US8209703B2 (en) Apparatus and method for dataflow execution in a distributed environment using directed acyclic graph and prioritization of sub-dataflow tasks
CN109636592B (en) High performance intelligent contract design
CN110121704B (en) Execution method, device and system for stored procedure
US11106437B2 (en) Lookup table optimization for programming languages that target synchronous digital circuits
CN110633785B (en) Method and system for calculating convolutional neural network
US20160292581A1 (en) Minimized processing of streaming changes into a semantic reasoner
CN110599341A (en) Transaction calling method and system
CN110599166A (en) Method and device for acquiring transaction dependency relationship in block chain
CN111813803B (en) Method, device, equipment and storage medium for generating statement block execution plan
WO2023093689A1 (en) Computational graph optimization method and apparatus, and device
Castro et al. Review and comparison of Apriori algorithm implementations on Hadoop-MapReduce and Spark
CN109885580A (en) A kind of hot spot account batch updating method, apparatus, server and storage medium
CN111966383A (en) Quantitative analysis method, system and medium for operating system kernel compatibility
CN117149770A (en) Method and device for executing storage process of database and computer equipment
CN114385173A (en) Compiling method, device, equipment and storage medium
CN109857832A (en) A kind of preprocess method and device of payment data
US10547565B2 (en) Automatic determination and just-in-time acquisition of data for semantic reasoning
CN114091029B (en) Training system, method, device, medium and platform for malicious file detection model
CN112287663B (en) Text parsing method, equipment, terminal and storage medium
CN113342897A (en) Data synchronization method and device
CN109002684B (en) Interval information analysis method
Carandang et al. Improving Simulations of Spiking Neural P Systems in NVIDIA CUDA GPUs: CuSNP
WO2024087844A1 (en) Graph neural network training method and system, and abnormal account identification method
CN110795076B (en) Data processing method and device for realizing basic logic algorithm
CN115034392B (en) Compiling method and device of Rete network and executing method and device of Rete algorithm

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