Database connection method and device, equipment and medium

By executing alternative connection operations and evaluating performance when a database connection is requested, dynamically selecting an appropriate connection operation implementation method solves the performance problems caused by inaccurate selection of database connection methods in the existing technology, and improves database query performance and adaptive capabilities. .

CN118733656APending Publication Date: 2024-10-01BEIJING OCEANBASE TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410947798.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-15
Publication Date
2024-10-01

AI Technical Summary

Technical Problem

Existing database connection methods lack accuracy when selecting implementation methods, resulting in poor query performance. In particular, the performance of different connection operation implementation methods varies greatly in different scenarios, and it is easy to choose inappropriate methods that lead to performance problems.

Method used

By executing alternative operations based on the execution paths of alternative connection operations when a database connection is requested, obtaining execution information to evaluate performance and resource consumption, and determining costs from multiple alternative connection operations based on this information to meet preset requirements. The target connection operation, dynamically select or switch a more suitable connection operation implementation method.

Benefits of technology

It improves the selection accuracy of database connection operation implementation methods, improves database query performance, enhances the adaptive ability of the execution engine, and ensures the performance optimization of connection operations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118733656A_ABST
    Figure CN118733656A_ABST
Patent Text Reader

Abstract

The invention provides a database connection method and device, equipment and a medium. The method comprises the following steps: in response to a database connection request, executing alternative connection operations on the basis of execution plans corresponding to the database connection request under different alternative connection operations to obtain real execution information of the different alternative connection operations, and obtaining data meeting connection conditions in a left table indicated by the database connection operations; and determining a target connection operation of which the execution cost meets a preset requirement from the plurality of alternative connection operations based on the execution information of different alternative connection operations and the data meeting the connection condition in the left table. Through the scheme provided by the specification, the connection operation implementation mode can be selected according to the current execution information after the execution plan starts to be executed, and the execution condition does not need to be estimated through an optimizer, so that the accuracy of selection of the database connection operation implementation mode is improved, and the query performance of the database is ensured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] One or more embodiments of the present specification relate to the field of database technology, and in particular, to a database connection method, device, equipment and medium. Background Art

[0002] In a database system, the join operation is one of the basic and important operations. Through the join operation, you can establish associations between different tables in the database to ensure the relevance and integrity of the data. In addition, through the join operation, you can perform complex data queries and analyses, making the use of the database more flexible and practical.

[0003] In a database system, connection operations can be implemented in a variety of ways, that is, the database connection system can support a variety of connection operation implementation methods. Different connection operation implementation methods will have different performance in different scenarios, and the execution performance of different connection operation implementation methods in different scenarios may vary greatly. Once an inappropriate connection operation implementation method is selected, it may lead to poor database query performance. Summary of the invention

[0004] In view of this, one or more embodiments of the present specification provide a database connection method, apparatus, device and medium to improve the accuracy of selecting a database connection operation implementation method, thereby ensuring the query performance of the database.

[0005] To achieve the above objectives, one or more embodiments of this specification provide the following technical solutions:

[0006] According to a first aspect of one or more embodiments of this specification, a database connection method is proposed, the method comprising:

[0007] In response to a database connection request, executing an alternative connection operation based on an execution path corresponding to the database connection request under different alternative connection operations to obtain execution information of different alternative connection operations, and obtaining data satisfying a connection condition in a left table indicated by the database connection operation, wherein the execution information is used to indicate performance and / or resource consumption of an execution process of the alternative connection operation;

[0008] Based on the execution information of different candidate connection operations and the data satisfying the connection condition in the left table, a target connection operation whose execution cost meets the preset requirement is determined from multiple candidate connection operations.

[0009] According to a second aspect of one or more embodiments of this specification, a database connection device is provided, the device comprising:

[0010] an execution module, configured to respond to a database connection request and execute an alternative connection operation based on an execution path corresponding to the database connection request under different alternative connection operations to obtain execution information of different alternative connection operations, wherein the execution information is used to indicate performance and / or resource consumption of an execution process of the alternative connection operation;

[0011] An acquisition module, used for acquiring data satisfying a connection condition in a left table indicated by the database connection operation;

[0012] The determination module is used to determine a target connection operation whose execution cost meets the preset requirements from multiple candidate connection operations based on the execution information of different candidate connection operations and the data that meets the connection conditions in the left table.

[0013] According to a third aspect of one or more embodiments of this specification, a computing device is provided, including:

[0014] processor;

[0015] a memory for storing processor-executable instructions;

[0016] The processor implements the database connection method as described in the first aspect above by running the executable instructions.

[0017] According to a fourth aspect of one or more embodiments of the present specification, a computer-readable storage medium is provided, on which computer instructions are stored. When the instructions are executed by a processor, the steps of the database connection method described in the first aspect are implemented.

[0018] According to a fifth aspect of one or more embodiments of the present specification, a computer program product is provided, comprising a computer program, wherein when the computer program is executed by a processor, the database connection method as described in the first aspect is implemented.

[0019] This specification responds to a database connection request and executes an alternative connection operation based on the execution plan corresponding to the database connection request under different alternative connection operations to obtain the actual execution information of different alternative connection operations, and obtains the data in the left table indicated by the database connection operation that meets the connection conditions, thereby determining the target connection operation whose execution cost meets the preset requirements from multiple alternative connection operations based on the execution information of different alternative connection operations and the data in the left table that meets the connection conditions. Through the solution provided in this specification, the connection operation implementation method can be selected according to the current execution information after the execution plan starts to execute, without the need to estimate the execution status through the optimizer, thereby ensuring the accuracy of the information based on which the connection operation implementation method selection decision is made, thereby improving the accuracy of the database connection operation implementation method selection to ensure the query performance of the database. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] Figure 1 It is a schematic diagram of an application scenario of a database connection method provided by an exemplary embodiment.

[0021] Figure 2 The invention is a flowchart of a database connection method provided by an exemplary embodiment.

[0022] Figure 3 It is a schematic diagram of an execution plan provided by an exemplary embodiment.

[0023] Figure 4 It is a schematic diagram of a process of generating an execution path corresponding to a second candidate connection operation provided by an exemplary embodiment.

[0024] Figure 5 The present invention is a schematic diagram of a process of generating a runtime filter provided by an exemplary embodiment.

[0025] Figure 6 It is a schematic structural diagram of a computing device provided by an exemplary embodiment.

[0026] Figure 7 It is a schematic diagram of a database connection device provided by an exemplary embodiment. DETAILED DESCRIPTION

[0027] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with one or more embodiments of this specification. Instead, they are merely examples of devices and methods consistent with some aspects of one or more embodiments of this specification as detailed in the appended claims.

[0028] It should be noted that: in other embodiments, the steps of the corresponding method are not necessarily performed in the order shown and described in this specification. In some other embodiments, the steps included in the method may be more or less than those described in this specification. In addition, a single step described in this specification may be decomposed into multiple steps for description in other embodiments; and multiple steps described in this specification may be combined into a single step for description in other embodiments.

[0029] The user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this manual are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.

[0030] In the related art, database connection can be realized through a variety of connection operation implementation methods, for example, database connection can be realized through a variety of connection operation implementation methods such as Hash Join, Merge Join, Nested Loop Join, etc. However, different connection operation implementation methods will have different performances in different scenarios. For example, the execution performance of Hash Join and Nested Loop Join in the same scenario will be relatively different. If an unsuitable connection operation implementation method is selected, serious performance problems will be caused due to the wrong choice. Therefore, there is an urgent need for an adaptive database connection method to dynamically realize the selection of the connection operation implementation method, and even dynamically switch to a more suitable connection operation implementation method after selecting an incorrect connection operation implementation method, thereby improving the execution engine's ability to adapt to the connection, so as to achieve the purpose of improving the database connection performance.

[0031] The database connection method provided in this specification can be used to realize the connection between data tables in a relational database. For example, the database connection method provided in this specification can be used to realize the connection between data tables in an Oracle database or a Structured Query Language (SQL) database, but is not limited thereto.

[0032] It should be noted that the above is only an illustrative description of the database types to which the database connection method provided in this specification is applicable, and does not constitute a limitation on the database connection method provided in this specification. In more possible implementations, the database connection method provided in this specification can also be used to implement connections between data tables in other types of databases.

[0033] In addition, the database connection method provided in this manual can be used to connect data tables in a distributed database. Figure 1 , Figure 1 This is a schematic diagram of an application scenario of a database connection method provided by an exemplary embodiment. The database connection method provided in this specification can be applied in the following situations: Figure 1In the network environment shown, for example, a database connection request can be initiated to an application server through a terminal device. The database connection request is used to request a connection operation between multiple data tables in a database. After receiving the database operation request, the application server can call multiple database servers with a distributed architecture through a proxy server to achieve connection between data tables maintained by different database servers.

[0034] It should be noted that Figure 1 This is only an illustrative description of the application scenarios of the database connection method provided in this specification, and does not constitute a limitation on the application scenarios of the database connection method provided in this specification. In more possible implementations, the database connection method provided in this specification can also realize the data table connection of the database in a non-distributed (such as centralized) scenario, and this specification does not limit this.

[0035] After introducing the application scenarios of the database connection method provided in this specification, the implementation method of the database connection method provided in this specification is introduced below.

[0036] join Figure 2 , Figure 2 is a flowchart of a database connection method provided by an exemplary embodiment. Figure 2 As shown, the method includes:

[0037] Step 201, in response to a database connection request, executing an alternative connection operation based on the execution path corresponding to the database connection request under different alternative connection operations to obtain execution information of different alternative connection operations, and obtaining data satisfying a connection condition in a left table indicated by the database connection operation, wherein the execution information is used to indicate the performance and / or resource consumption of the execution process of the alternative connection operation.

[0038] The database connection request may be used to request a connection operation between multiple data tables in a database.

[0039] It should be noted that the processing of database operation requests (including but not limited to database connection requests) can be divided into a plan generation phase and a plan execution phase. In the plan generation phase, a corresponding execution plan can be generated according to the received database operation request. In the plan execution phase, corresponding operations can be performed according to the execution plan generated in the plan generation phase to realize the processing of the database operation request. Among them, the execution path corresponding to the database connection request under different alternative connection operations is generated in the plan generation phase.

[0040] It should be noted that the execution path can be used to indicate the operations to be executed included in the connection operation and the execution order of each operation to be executed, but is not limited thereto.

[0041] When executing the candidate connection operations based on the execution paths corresponding to the different candidate connection operations, real execution information generated during the execution of the different candidate connection operations may be collected.

[0042] Optionally, the execution information may be used to indicate the performance and / or resource consumption of the alternative connection operation execution process. The performance of the alternative connection operation execution process may include, but is not limited to, the execution time of the alternative connection operation; the resource consumption of the alternative connection operation execution process may include, but is not limited to, the central processing unit (CPU) processing time, memory usage, input / output (IO) operation (disk read / write) times, etc.

[0043] It should be noted that the connection condition can be a logical condition used when executing the connection of data tables, which is used to specify the association method between two data tables. Optionally, the connection condition can include a connection key, which can be a column or expression used for comparison in the connection condition. For example, for the connection condition "employee table. department number = department table. department number", "employee table. department number" and "department table. department number" are connection keys, which are used to zoom the data in the two data tables in the connection condition.

[0044] Step 202: Based on the execution information of different candidate connection operations and the data satisfying the connection condition in the left table, a target connection operation whose execution cost satisfies the preset requirement is determined from a plurality of candidate connection operations.

[0045] It should be noted that, through the execution information of different candidate connection operations and the data satisfying the connection conditions in the left table, a suitable connection operation implementation method can be adaptively selected according to the execution cost.

[0046] Through the solution provided in this specification, the connection operation implementation method can be selected according to the current execution information after the execution plan starts to be executed, without the need to estimate the execution status through the optimizer, thereby ensuring the accuracy of the information based on which the connection operation implementation method selection decision is made, thereby improving the accuracy of the database connection operation implementation method selection to ensure the query performance of the database.

[0047] After introducing the basic implementation process of the database connection method provided in this specification, various optional implementation methods of this specification are introduced below.

[0048] In some embodiments, for step 201, in response to a database connection request, executing an alternative connection operation based on an execution path corresponding to the database connection request under different alternative connection operations to obtain execution information of different alternative connection operations can be implemented by the following steps:

[0049] Step 2011: In response to a database connection request, based on the database connection request and a plurality of candidate connection operations, generate execution paths corresponding to different candidate connection operations.

[0050] In a possible implementation, an execution plan may be generated based on a database connection request, and the execution plan is at least used to indicate execution paths corresponding to different candidate connection operations, but is not limited thereto.

[0051] Optionally, during the plan generation phase, a query optimizer may be used to generate a tree-like execution plan, wherein the execution plan includes execution paths corresponding to multiple candidate connection operations.

[0052] Optionally, the plurality of candidate connection operations may include a first candidate connection operation and a second candidate connection operation, but is not limited thereto.

[0053] The first candidate join operation can be used to implement data table join through a hash algorithm, for example, the first candidate join operation can be a Hash Join operation, but is not limited thereto. The second candidate join operation can be used to implement data table join through a nested loop, for example, the second candidate join operation can be a Nested Loop Join operation, but is not limited thereto.

[0054] See also Figure 3 , Figure 3 is a schematic diagram of an execution plan provided by an exemplary embodiment, such as Figure 3 As shown, a tree-like execution plan including both Hash Join and Nested Loop Join can be generated. Optionally, the Hash Join operation can be implemented by table scan (Table Scan), and the Nested Loop Join operation can be implemented by index scan.

[0055] Taking the case where the first alternative connection operation is a Hash Join operation and the second alternative connection operation is a Nested Loop Join operation as an example, in the plan generation stage, when generating the execution path corresponding to the first alternative connection operation (i.e., the Hash Join path), the execution path corresponding to the second connection operation (i.e., the Nested Loop Join operation) can be found according to the connection conditions corresponding to the database connection request.

[0056] Optionally, the execution path corresponding to the second candidate connection operation may be a valid index path generated based on the right table in the connection condition of the database connection request.

[0057] Taking the case where the first candidate join operation is a Hash Join operation and the second candidate join operation is a Nested Loop Join operation as an example, in the plan generation phase, when generating a Hash Join path, a valid index path on the right side of the join that can potentially generate a Nested Loop Join operation can be found.

[0058] It should be noted that for Nested Loop Join, an index path is valid and can be a downward-pushed Nested Loop Join condition that can be quickly located using the index.

[0059] For example, for a database operation request like the following:

[0060] create table T1(c1 int primary key,c2 int,c3 int,c4 int);

[0061] create table T2(c1 int primary key,c2 int,c3 int,c4 int,index idx(c2));

[0062] select*from T1,T2 where T1.c2=T2.c2;

[0063] Among them, the connection condition is T2.c2=T1.c2, and the index path idx of T2 is valid. When generating a Hash Join path based on data tables T1 and T2, it is necessary to find the index path on the T2 side that can be used to generate a Nested Loop Join. Since the connection condition is T2.c2=T1.c2 and the index path idx of T2 is valid, the index path of T2 can be used to generate the index path of the Nested Loop Join.

[0064] See also Figure 4 , Figure 4 is a schematic diagram of a generation process of an execution path corresponding to a second candidate connection operation provided by an exemplary embodiment, such as Figure 4 As shown, when a Hash Join path is generated based on data tables T1 and T2, an index path on the T2 side that can be used to generate a Nested Loop Join can be found to implement the generation of a Nested Loop Join path (ie, an execution path corresponding to the second candidate join operation).

[0065] It should be noted that, for a database connection request, it may correspond to multiple connection conditions. For any connection condition, if the index path of the right table corresponding to the connection condition is valid, the index path of the connection condition can be used as the valid index path corresponding to the second alternative operation. Therefore, a database connection request corresponding to multiple connection conditions may be able to find multiple valid index paths.

[0066] Step 2012: Execute each candidate connection operation based on the execution paths corresponding to the different candidate connection operations to obtain execution information of different candidate connection operations.

[0067] It should be noted that, by completing the generation and execution of the execution plan in the plan generation phase, the execution of the database connection operation can be implemented according to the generated execution plan.

[0068] Optionally, analysis may be performed based on execution paths corresponding to different candidate connection operations to obtain execution operation sequences corresponding to different candidate connection operations, thereby implementing execution of the candidate connection operations based on the execution operation sequences corresponding to different candidate connection operations.

[0069] Optionally, at the beginning of the plan execution phase, the generated execution plan may be interpreted to convert the generated execution plan into an actual execution operation sequence. That is, at the beginning of the plan execution phase, the execution paths corresponding to different candidate connection operations in the generated execution plan may be interpreted respectively to convert the execution paths into an actual execution operation sequence.

[0070] The execution operation sequence may include a plurality of operations to be executed arranged in sequence from front to back, but is not limited thereto.

[0071] It should be noted that, since the above process is performed in the plan execution phase, the actual execution information of the execution operation sequence, that is, the real execution information of the alternative connection operation, can be collected, so that subsequent processing can be implemented based on the real execution information of the alternative connection operation.

[0072] In some embodiments, after the execution plan is interpreted as a corresponding execution operation sequence, the execution of the execution operation sequence can be implemented according to the execution manner of the alternative connection operation.

[0073] In some embodiments, during the plan execution phase, step 201 may be used to obtain data in the left table indicated by the database connection operation that meets the connection condition.

[0074] Taking the first alternative connection operation as a Hash Join operation as an example, in the plan execution stage, according to the execution method of Hash Join, all data in the left table can be read first and a Hash table can be built. Optionally, after the Hash table is built, the data in the left table that meets the connection conditions indicated by the database connection operation can be obtained based on the connection conditions of the database connection request.

[0075] In a possible implementation, data satisfying the connection condition in the left table indicated by the database connection operation may be obtained based on the connection key included in the connection condition.

[0076] In some embodiments, when obtaining data satisfying the connection conditions in the left table indicated by the database connection operation, a runtime filter can be generated based on the connection conditions of the database connection request, and the runtime filter is used to store the data satisfying the connection conditions in the left table corresponding to the database connection request.

[0077] In a possible implementation, the runtime filter may be generated based on the connection key included in the connection condition.

[0078] It should be noted that Runtime Filter is an optimization technology that can dynamically generate filter conditions based on the processed data during the execution of the plan. For example, in Hash Join, when the data of one table has been processed and a hash table or index has been generated, this information can be used to dynamically filter the data of another table, thereby reducing unnecessary data transmission and processing.

[0079] Optionally, the runtime filter may be a collection filter (In Filter) to ensure that the runtime filter can achieve accurate filtering of data.

[0080] Optionally, the constructed runtime filter can be pushed down to the right table so that the right table process can be filtered in advance based on the runtime filter to reduce the cost of detecting the left table Hash table based on the right table and the network transmission cost of the right table in a distributed scenario.

[0081] Still like Figure 4 For example, see Figure 5 , Figure 5 is a schematic diagram of a generation process of a runtime filter provided by an exemplary embodiment, such as Figure 5 As shown, the In Filter of T1.c2 can be constructed, and the constructed In Filter can be pushed down to T2, so that T2 can perform early filtering based on the In Filter.

[0082] It should be noted that after the runtime filter is generated, the generated runtime filter can be used to adaptively select whether to take the scan path corresponding to the first candidate connection operation or the scan path corresponding to the second candidate connection operation according to the cost during the plan execution phase.

[0083] In some embodiments, for step 203, based on the execution information of different candidate connection operations and the data satisfying the connection condition in the left table, when determining the target connection operation whose execution cost meets the preset requirements from multiple candidate connection operations, the following steps can be used to implement it:

[0084] Step 2031: Determine execution costs of different candidate connection operations based on execution information of different candidate connection operations and runtime filters.

[0085] Optionally, the execution information may include table size, index status of connection keys, index coverage, memory and disk usage, data distribution, system load, cache utilization, etc., but is not limited thereto.

[0086] Among them, the data table size can be the size of the data table to be scanned, that is, how many rows of data are there in the data table to be scanned; the index status of the connection key can be used to indicate whether the connection key has an index; the index coverage can be used to indicate whether the index contains all the columns required for the query; the memory and disk usage can be used to indicate the remaining available memory and / or the remaining available capacity of the disk; the data distribution can be used to indicate whether the data distribution of the connection key is uniform; the system load may include the central processing unit (CPU) usage rate, memory occupancy, disk input / output (I / O), etc., but is not limited to this; the cache utilization can be used to indicate whether the indexed data can be completely placed in the cache.

[0087] Optionally, the multiple alternative connection operations may include a first alternative connection operation and a second alternative connection operation, and the execution cost of the first alternative connection operation may be determined based on the execution information and the runtime filter of the first alternative connection operation, and the execution cost of the second alternative connection operation may be determined based on the execution information and the runtime filter of the second alternative connection operation. The introduction of the first alternative connection operation and the second alternative connection operation may refer to the above embodiment, which will not be repeated here.

[0088] It should be noted that, when the first candidate connection operation is used to implement the database connection, the database connection can be implemented by scanning the main table, so the execution cost of the first candidate connection operation can be determined by evaluating the path cost of the main table scan corresponding to the first candidate connection operation. Taking the first candidate connection operation as a Hash Join operation as an example, the path cost of the main table scan corresponding to the Hash Join can be evaluated to obtain the execution cost of the Hash Join operation.

[0089] In a possible implementation, when determining the execution cost of the first alternative connection operation based on the runtime filter and the execution information of the first execution operation sequence, the execution cost of the first alternative connection operation can be evaluated based on the runtime filter, the size of the main table (that is, how many rows of data are contained in the main table), the index status of the connection key, the usage of memory and disk, the data distribution, and the system load.

[0090] In one possible implementation, when determining the execution cost of the second alternative connection operation based on the runtime filter and the execution information of the second execution operation sequence, the execution cost of the second alternative connection operation can be determined based on the runtime filter, the execution information of the second execution operation sequence and the metadata information of the data table corresponding to the database connection request.

[0091] Optionally, the execution cost of the second alternative connection operation can be evaluated based on runtime filters, the size of the two data tables involved in the connection (i.e., how many rows of data each of the two data tables involved in the connection contains), the index status of the connection key, the index coverage, the data distribution, the system load, the cache utilization and the metadata information.

[0092] The metadata information may be information maintained by the storage layer, which may include some information related to the indexed metadata. By implementing execution cost evaluation based on the metadata information, lightweight cost evaluation may be implemented, thereby improving the speed and efficiency of cost evaluation.

[0093] Through the above embodiments, the execution cost can be evaluated according to the current execution information during execution without relying on the optimizer, thereby improving the accuracy of the execution cost evaluation and providing more accurate reference information for the subsequent database connection operation implementation method selection decision process.

[0094] Step 2032: Based on the execution costs of different first candidate connection operations, determine a target connection operation whose execution cost meets the requirements from multiple candidate connection operations.

[0095] In a possible implementation, based on the execution costs of different first candidate connection operations, the candidate connection operation with the smallest execution cost among multiple candidate connection operations may be determined as the target connection operation.

[0096] For example, the multiple alternative connection operations include a first alternative connection operation and a second alternative connection operation. Based on the execution cost of the first alternative connection operation and the execution cost of the second alternative connection operation, the alternative connection operation with a smaller execution cost of the first alternative connection operation and the second alternative connection operation can be determined as the target connection operation.

[0097] Through the solution provided in the present application, it is possible to decide whether to use Nested Loop Join or Hash Join based on the current execution information during execution without relying on the optimizer. The information during execution is more accurate than the information of the optimizer, thereby enhancing the robustness of the database connection operation selection method to ensure that the selected database connection operation implementation method is more in line with the current actual execution situation, thereby achieving the purpose of improving connection performance.

[0098] Corresponding to the aforementioned method embodiments, this specification also provides corresponding equipment embodiments and device embodiments.

[0099] Figure 6 is a schematic structural diagram of a computing device provided by an exemplary embodiment. Figure 6 At the hardware level, the computing device includes a processor 602, an internal bus 604, a network interface 606, a memory 608, and a non-volatile memory 610, and may also include hardware required for other tasks. One or more embodiments of this specification may be implemented based on software, such as the processor 602 reading the corresponding computer program from the non-volatile memory 610 into the memory 608 and then running it. Of course, in addition to the software implementation, one or more embodiments of this specification do not exclude other implementations, such as logic devices or a combination of software and hardware, etc., that is, the execution subject of the following processing flow is not limited to each logic unit, but may also be hardware or logic devices.

[0100] This manual also provides a database connection device, please refer to Figure 7 , Figure 7 is a schematic diagram of a database connection device provided by an exemplary embodiment. The database connection device can be applied to Figure 6 In the computing device shown in the figure, the technical solution of this specification is implemented. Among them, the database connection device may include:

[0101] An execution module 701 is used to respond to a database connection request and execute an alternative connection operation based on an execution path corresponding to the database connection request under different alternative connection operations to obtain execution information of different alternative connection operations, where the execution information is used to indicate performance and / or resource consumption of an execution process of the alternative connection operation;

[0102] An acquisition module 702 is used to acquire data satisfying a connection condition in a left table indicated by a database connection operation;

[0103] The determination module 703 is used to determine a target connection operation whose execution cost meets the preset requirement from multiple candidate connection operations based on the execution information of different candidate connection operations and the data that meets the connection condition in the left table.

[0104] In some embodiments, the execution module 701, when used to execute the alternative connection operation based on the execution path corresponding to the database connection request under different alternative connection operations to obtain execution information of different alternative connection operations, is used to:

[0105] In response to a database connection request, generating execution paths corresponding to different candidate connection operations based on the database connection request and a plurality of candidate connection operations;

[0106] Each candidate connection operation is executed based on the execution path corresponding to the different candidate connection operations to obtain execution information of different candidate connection operations.

[0107] In some embodiments, the execution module 701, when used to generate execution paths corresponding to different candidate connection operations based on a database connection request and multiple candidate connection operations, is used to:

[0108] An execution plan is generated based on the database connection request, where the execution plan is at least used to indicate execution paths corresponding to different candidate connection operations.

[0109] In some embodiments, the plurality of alternative connection operations include at least a first alternative connection operation and a second alternative connection operation, the first alternative connection operation is used to implement data table connection through a hash algorithm, and the second alternative connection operation is used to implement data table connection through a nested loop;

[0110] The execution path corresponding to the second candidate connection operation is a valid index path generated based on the right table in the connection condition of the database connection request.

[0111] In some embodiments, the first candidate join operation is a Hash Join operation, and the second candidate join operation is a Nested Loop Join operation.

[0112] In some embodiments, the acquisition module 702, when used to acquire data satisfying the connection condition in the left table indicated by the database connection operation, is used to:

[0113] Based on the connection condition of the database connection request, a runtime filter is generated, and the runtime filter is used to store the data that meets the connection condition in the left table corresponding to the database connection request.

[0114] In some embodiments, the determination module 703, when used to determine a target connection operation whose execution cost meets a preset requirement from a plurality of candidate connection operations based on execution information of different candidate connection operations and data satisfying the connection condition in the left table, is used to:

[0115] Determine execution costs of different candidate connection operations based on execution information of different candidate connection operations and runtime filters;

[0116] Based on the execution costs of different first candidate connection operations, a target connection operation whose execution cost meets the requirement is determined from a plurality of candidate connection operations.

[0117] In some embodiments, the plurality of candidate join operations include at least a second candidate join operation, and the second candidate join operation is used to implement data table joining by means of a nested loop;

[0118] The determination module 703, when used to determine the execution costs of different candidate connection operations based on the execution information of different candidate connection operations and the runtime filter, is at least used to:

[0119] An execution cost of the second candidate connection operation is determined based on the runtime filter, the execution information of the second candidate connection operation, and the metadata information of the data table corresponding to the database connection request.

[0120] In some embodiments, the determination module 703, when used to determine a target connection operation whose execution cost meets the requirement from a plurality of candidate connection operations based on the execution costs of different first candidate connection operations, is used to:

[0121] Based on the execution costs of different first candidate connection operations, a candidate connection operation with the smallest execution cost among the multiple candidate connection operations is determined as the target connection operation.

[0122] In some embodiments, the runtime filter is a collection filter In Filter.

[0123] The devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer, which may be in the form of a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email transceiver, a game console, a tablet computer, a wearable device, or a combination of any of these devices.

[0124] In a typical configuration, a computer includes one or more processors (Central Processing Unit, CPU), input / output interface, network interface and memory.

[0125] Memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.

[0126] Computer readable media include permanent and non-permanent, removable and non-removable media that can be used to store information by any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase change random access memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, disk storage, quantum memory, graphene-based storage media or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. According to the definition in this article, computer-readable media does not include temporary computer-readable media (transitory media), such as modulated data signals and carrier waves.

[0127] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.

[0128] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0129] The terms used in one or more embodiments of this specification are only for the purpose of describing specific embodiments, and are not intended to limit one or more embodiments of this specification. The singular forms of "a", "said" and "the" used in one or more embodiments of this specification and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items.

[0130] It should be understood that although the terms first, second, third, etc. may be used to describe various information in one or more embodiments of this specification, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of one or more embodiments of this specification, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".

[0131] The above description is merely a preferred embodiment of one or more embodiments of the present specification and is not intended to limit one or more embodiments of the present specification. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of one or more embodiments of the present specification shall be included in the scope of protection of one or more embodiments of the present specification.

Claims

1. A database connection method, the method comprising: In response to a database connection request, executing an alternative connection operation based on an execution path corresponding to the database connection request under different alternative connection operations to obtain execution information of different alternative connection operations, and obtaining data satisfying a connection condition in a left table indicated by the database connection operation, wherein the execution information is used to indicate performance and / or resource consumption of an execution process of the alternative connection operation; Based on the execution information of different candidate connection operations and the data satisfying the connection condition in the left table, a target connection operation whose execution cost meets the preset requirement is determined from multiple candidate connection operations.

2. The method according to claim 1, wherein in response to a database connection request, executing an alternative connection operation based on execution paths corresponding to the database connection request under different alternative connection operations to obtain execution information of different alternative connection operations comprises: In response to the database connection request, generating execution paths corresponding to different candidate connection operations based on the database connection request and multiple candidate connection operations; Each candidate connection operation is executed based on the execution path corresponding to the different candidate connection operations to obtain execution information of different candidate connection operations.

3. The method according to claim 2, wherein generating execution paths corresponding to different candidate connection operations based on the database connection request and multiple candidate connection operations comprises: An execution plan is generated based on the database connection request, where the execution plan is at least used to indicate execution paths corresponding to different candidate connection operations.

4. The method according to claim 1, wherein the plurality of alternative connection operations include at least a first alternative connection operation and a second alternative connection operation, wherein the first alternative connection operation is used to implement data table connection through a hash algorithm, and the second alternative connection operation is used to implement data table connection through a nested loop; in, The execution path corresponding to the second candidate connection operation is a valid index path generated based on the right table in the connection condition of the database connection request.

5. According to the method of claim 4, the first candidate join operation is a Hash Join operation, and the second candidate join operation is a Nested Loop Join operation.

6. According to the method of claim 1, the step of obtaining data satisfying a connection condition in the left table indicated by the database connection operation comprises: A runtime filter is generated based on the connection condition of the database connection request, and the runtime filter is used to store data in the left table corresponding to the database connection request that meets the connection condition.

7. The method according to claim 6, wherein the step of determining a target connection operation whose execution cost meets a preset requirement from a plurality of candidate connection operations based on the execution information of different candidate connection operations and the data satisfying the connection condition in the left table comprises: Determining execution costs of different candidate connection operations based on execution information of different candidate connection operations and the runtime filter; Based on the execution costs of different first candidate connection operations, a target connection operation whose execution cost meets the requirement is determined from the multiple candidate connection operations.

8. The method according to claim 7, wherein the plurality of candidate connection operations at least comprises a second candidate connection operation, and the second candidate connection operation is used to implement data table connection in a nested loop manner; Determining execution costs of different candidate connection operations based on execution information of different candidate connection operations and the runtime filter at least includes: An execution cost of the second candidate connection operation is determined based on the runtime filter, the execution information of the second candidate connection operation, and the metadata information of the data table corresponding to the database connection request.

9. The method according to claim 7, wherein determining a target connection operation whose execution cost meets the requirement from the plurality of candidate connection operations based on the execution costs of different first candidate connection operations comprises: Based on the execution costs of different first candidate connection operations, the candidate connection operation with the smallest execution cost among the multiple candidate connection operations is determined as the target connection operation.

10. The method according to claim 6, wherein the runtime filter is a collection filter In Filter.

11. A database connection device, comprising: an execution module, configured to respond to a database connection request and execute an alternative connection operation based on an execution path corresponding to the database connection request under different alternative connection operations to obtain execution information of different alternative connection operations, wherein the execution information is used to indicate performance and / or resource consumption of an execution process of the alternative connection operation; An acquisition module, used for acquiring data satisfying a connection condition in a left table indicated by the database connection operation; The determination module is used to determine a target connection operation whose execution cost meets the preset requirements from multiple candidate connection operations based on the execution information of different candidate connection operations and the data that meets the connection conditions in the left table.

12. A computing device comprising: processor; a memory for storing processor-executable instructions; The processor implements the method according to any one of claims 1 to 10 by running the executable instructions.

13. A computer-readable storage medium having computer instructions stored thereon, which, when executed by a processor, implement the steps of the method according to any one of claims 1 to 10.