Intelligent Process Routing in Partitioned Database Management Systems

By introducing an intelligent process routing mechanism into the partitioned distributed database system, using static program analysis and classification model prediction functions, the transaction processing path is optimized, and the communication cost and resource waste caused by transaction allocation uncertainty in the existing technology is solved. Achieve higher performance and efficiency.

CN115803715BActive Publication Date: 2025-02-21ALIBABA GROUP HOLDING LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202080102917.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-08-28
Publication Date
2025-02-21
Estimated Expiration
2040-08-28

AI Technical Summary

Technical Problem

When handling distributed database transactions, existing partitioned distributed database systems are difficult to allocate transactions to specific nodes deterministically or strategically, resulting in increased communication costs and time between nodes and wasted unwanted control or coordination points. Process resources.

Method used

By introducing an intelligent process routing mechanism into the database system, using static program analysis and classification model prediction functions, the input parameter values ​​of stored procedures are determined and mapped to corresponding data shards or computing nodes, thereby optimizing the path of transaction processing.

Benefits of technology

Reduces interaction between nodes, reduces resource waste, communication costs and processing delays, and improves the performance and efficiency of the database system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115803715B_ABST
    Figure CN115803715B_ABST
Patent Text Reader

Abstract

A database system may include at least one load balancing node and multiple computing nodes. The load balancing node may receive a distributed transaction including a stored procedure, and select a prediction function for the stored procedure from multiple prediction functions. The load balancing node may extract one or more input parameters from the stored procedure, and determine a computing node from the multiple computing nodes using the prediction function based at least in part on the one or more input parameters. The load balancing node may then forward the stored procedure to the computing node for processing the stored procedure.
Need to check novelty before this filing date? Find Prior Art

Description

Background Art

[0001] As the amount of data stored in various industries continues to increase, such as company data, shopping data, personal data, etc., partitioned distributed database management systems (PDBMS) running on the cloud or a network of servers are becoming more and more popular. In a PDBM, a data table is horizontally divided into multiple parts, usually called data shards. Each data shard is a collection of rows and is independently hosted and replicated. Shards can be moved, split, or merged to improve performance and resilience.

[0002] Transactions involving data hosted on a single node (i.e., database server) are called local transactions. These transactions are essentially no different from transactions in a traditional single database management system. On the other hand, transactions involving data on multiple nodes are global transactions, which require a complex process called two-phase commit (2PC) when performing a commit operation. Therefore, global transactions are much slower than local transactions.

[0003] To achieve better performance, database administrators (DBAs) typically specify data partitioning and placement strategies so that most transactions can be performed locally. For example, a database for an e-commerce application might include a warehouse table and a customer table, among others. If most orders submitted to the e-commerce application can be fulfilled by a local warehouse, the database administrator can choose to partition the table based on geographic location so that rows representing warehouses and customers in the same location are in the same shard of their respective tables. The database administrator can also specify that the data shards of the customer table and the data shards of the warehouse table in the same location be hosted on the same node. In this way, most orders can be served by executing local transactions, resulting in better performance.

[0004] This database partitioning effort would achieve optimal performance if the PDBMS could perform computations on the data, i.e., execute transactions directly on the nodes that host or store the data. However, this has proven difficult for the following reasons: 1) transactions are best executed by a single node, and aborting the transaction and restarting it on another node is feasible but often costly; 2) it is difficult to predict the nodes where the relevant data is located before the transaction begins, especially when most transactions involve multiple queries. As a result, the node that executes the transaction typically does not host the data associated with the transaction, but instead needs to forward the query request to the actual hosting node, incurring high communication costs. Worst of all, since the transaction has been assigned to a node, the node needs to act as a control node to coordinate the execution or processing of multiple queries contained in the transaction by other nodes, send commit instructions to these other nodes to complete the 2-phase commit, and collect query results associated with the execution or processing of multiple queries from other nodes, and send the query results to the database administrator's client device for presentation or viewing, so the transmission of query results and instructions between the control node and other nodes further incurs communication costs and time. Summary of the invention

[0005] This summary introduces simplified concepts of intelligent process routing in a partitioned database management system, which are further described in the detailed description below. This summary is not intended to identify essential features of the claimed subject matter, nor is it intended to be used to limit the scope of the claimed subject matter.

[0006] The present disclosure describes an example implementation of intelligent process routing in a partitioned database management system. In an implementation, one or more computing devices may perform static program analysis on a stored procedure to determine one or more input parameters. The one or more computing devices may also obtain stored data, the stored data including multiple value sets of one or more input parameters of the stored procedure and identifiers of multiple data shards. In an implementation, the one or more computing devices may train a classification model using the multiple value sets as inputs and corresponding identifiers of the multiple data shards as outputs, and set the trained classification model as a prediction function for mapping a new value set of one or more input parameter settings of the stored procedure to the corresponding data shards. BRIEF DESCRIPTION OF THE DRAWINGS

[0007] The detailed description is set forth with reference to the accompanying drawings. In the drawings, the left-most digit(s) in a reference number identifies the drawing in which the reference number first appears. The use of the same reference numbers in different drawings indicates similar or identical items.

[0008] Figure 1 An example environment in which a database system may be used is shown.

[0009] Figure 2An example compute node is shown in greater detail.

[0010] Figure 3 An example load balancing node is shown in more detail.

[0011] Figure 4 An example monitoring node is shown in more detail.

[0012] Figure 5 An example method of determining a prediction function is shown.

[0013] Figure 6 An example method of processing distributed database transactions is shown. DETAILED DESCRIPTION

[0014] Overview

[0015] As described above, the existing partitioned distributed database system adopts a load balancing strategy, which cannot deterministically or strategically assign distributed database transactions to specific nodes, which include one or more data tables involved in the database transaction, and the node assigned with the database transaction may need to act as a control or coordination node to coordinate other nodes to process the distributed database transaction and synchronously submit the distributed database transaction, which other nodes include the data tables involved in the distributed database transaction. This not only increases the communication cost and time of data and instructions transmitted between nodes, but also wastes the processing resources of the control or coordination node that may not be needed by the distributed database transaction.

[0016] The present disclosure describes an example database system. In an implementation, the database system may include a load balancing node, a plurality of computing nodes, and a monitoring node. In an implementation, the database system may be associated with a plurality of processes that are pre-registered and stored in a distributed database associated with the database system. Each stored procedure may include one or more database queries that access data slices of one or more database tables that are located or distributed in one or more computing nodes of the database system. In an implementation, a stored procedure may include one or more input parameters that may act as placeholders to receive input values ​​from a user for performing a database transaction. In an implementation, the database system may assign a unique identifier to each stored procedure in a plurality of stored procedures.

[0017] In an implementation, a database system may include or store one or more prediction functions. In an implementation, a prediction function in the one or more prediction functions may be used for one or more stored procedures in a plurality of stored procedures. In an implementation, each prediction function may be marked with a corresponding identifier, and the database system or the load balancing node may include a first data structure (e.g., a table or a mapping) that associates or stores each prediction function in the one or more prediction functions with the corresponding identifier. In addition, the database system may also include a second data structure (e.g., a table or a mapping) that associates or stores the identifiers of the one or more stored procedures with the identifiers of the corresponding prediction functions.

[0018] In an implementation, the prediction function may be configured to predict or attempt to map a stored procedure to an identification of a data shard, the stored procedure being a stored procedure with a specific value of an input parameter, the data shard may include data corresponding to at least one query of the stored procedure. Alternatively, the prediction function may be configured to predict or attempt to map a stored procedure to an identification of a compute node, the stored procedure being a stored procedure with a specific value of an input parameter, the compute node may include data corresponding to at least one query of the stored procedure.

[0019] In an implementation, a database system may receive a stored procedure from a client device, the stored procedure having input values ​​of input parameters of the stored procedure. The database system may select or determine a prediction function for the stored procedure from one or more prediction functions based on a second data structure associating multiple stored procedures with one or more prediction functions. In an implementation, the database system may determine or extract input values ​​of one or more input parameters of the stored procedure through static program analysis, and use the selected or determined prediction function (if the prediction function outputs an identifier of a data shard, rather than an identifier of a computing node, a mapping function is also used) to determine the computing node to which the stored procedure is forwarded or assigned, and the computing node is determined based on the extracted input value.

[0020] In an implementation, one or more prediction functions may include one or more classification models, which are obtained by the database system through training based on historical data collected by multiple computing nodes. In an implementation, the historical data of the prediction function may include, but is not limited to, multiple value sets of one or more input parameters of one or more stored procedures associated with the prediction function, identifiers of data shards or computing nodes, etc. In an implementation, one or more classification models may include, but are not limited to, neural network models, deep learning models, decision tree models, etc. In an implementation, the database system may update or retrain one or more prediction functions periodically or when the prediction error reaches a predetermined error threshold.

[0021] As described above, the database system used for demonstration can receive a stored procedure with input values ​​of input parameters, and predict or determine (determine the computing node to which the stored procedure is forwarded or assigned) based on a prediction function, which computing node may store data shards of a data table involved in at least one query of the stored procedure, thereby potentially avoiding the situation where the stored procedure is sent to a computing node that does not store any data shards queried or accessed by the procedure, thereby reducing resource waste, communication costs and processing delays caused by additional demands for interaction between the computing node and other computing nodes, which store the data shards queried or accessed by the stored procedure.

[0022] In an implementation, the functions performed by the database system described herein may be performed by multiple separate units or services. Furthermore, although in the examples described herein, the database system may be implemented as a combination of software and hardware implemented and distributed in multiple devices, in other examples, the database system may be implemented and distributed as a service provided by one or more computing devices on a network and / or cloud computing architecture.

[0023] The application describes a variety of different embodiments and implementations. The following sections describe example frameworks suitable for practicing various implementations. Next, the application describes example systems, devices, and processes for implementing a database system.

[0024] Example Environment

[0025] Figure 1 An example environment 100 that can be used to implement a database system is shown. The environment 100 can include a database system 102. In an implementation, the database system 102 can include a plurality of servers or computing nodes 104-1, 104-2, ..., 104-N (collectively referred to as computing nodes 104). The computing nodes 104 can communicate data to each other via a network 106. In an implementation, the database system 102 can also include at least one load balancing node 108 for distributing workloads to the servers or computing nodes 104. In an implementation, one or more servers or computing nodes 104 can be designated or used as at least one load balancing node 108. In an implementation, the database system 102 can also include a monitoring node 110.

[0026] In an implementation, each server or computing node 104 can be implemented as any of a variety of computing devices, including but not limited to desktop computers, notebook or portable computers, handheld devices, netbooks, Internet devices, tablet computers, mobile devices (e.g., mobile phones, personal digital assistants, smart phones, etc.), server computers, etc., or a combination thereof.

[0027] The network 106 may be a wireless network or a wired network, or a combination thereof. The network 106 may be a collection of independent networks interconnected to serve as a single large network (e.g., the Internet or an intranet). Examples of such independent networks include, but are not limited to, telephone networks, cable networks, local area networks (LANs), wide area networks (WANs), and metropolitan area networks (MANs). In addition, the independent networks may be wireless networks or wired networks, or a combination thereof. A wired network may include an electrical carrier connection (e.g., a communication cable, etc.) and / or an optical carrier or connection (e.g., an optical fiber connection, etc.). A wireless network may include, for example, a WiFi network, other radio frequency networks (e.g., Bluetooth, Zigbee, etc.), and the like.

[0028] In an implementation, the environment 100 may also include a client device 112. The client device 112 may be implemented as any of a variety of computing devices, including but not limited to a desktop computer, a notebook or portable computer, a handheld device, a netbook, an Internet appliance, a tablet or tablet computer, a mobile device (e.g., a mobile phone, a personal digital assistant, a smart phone, etc.), a server computer, etc., or a combination thereof.

[0029] In an implementation, the database system 102 may receive a request for processing a distributed database transaction from a client device 112. For example, a user 114 (e.g., a database administrator, etc.) of the client device 112 may submit multiple query requests involving one or more data tables as distributed database transactions to the database system 102. In response to the received request, the database system 102 may determine, based on the routing instruction, at least one computing node that includes a data portion of the data table involved in the distributed database transaction, send the distributed database transaction to the at least one computing node for processing, and return the processing result of the distributed database transaction to the client device 112.

[0030] Sample Partitioned Database

[0031] In an implementation, the database system 102 may also include one or more databases that are partitioned or distributed among the plurality of computing nodes 104. As an example and not limitation, a partitioned or distributed database may include one or more partitioned or partitioned data tables, each of which is horizontally divided into a plurality of portions, which are referred to as data shards or simply shards. In an implementation, each shard may include a set of rows and may be independently hosted and replicated in one or more computing nodes 104. In addition, shards may be moved, split, or merged to improve the performance and resiliency of the database system 102.

[0032] In an implementation, a transaction involving data hosted on a single computing node 104 or server (e.g., a database server) may be referred to as a local transaction. Local transactions are essentially no different from transactions in a traditional monolithic DBMS. On the other hand, transactions involving data on multiple computing nodes, i.e., global transactions, need to go through a complex process called 2-phase commit (2PC) when they are committed. Therefore, the processing of global transactions is much slower than that of local transactions.

[0033] In the implementation, the data table can be partitioned horizontally based on the value of a column or the value of a combination of multiple columns. In the latter case, the values ​​from each column can form a tuple, and for the purpose of partitioning, these columns can be treated as a single logical column. Without loss of generality, for simplicity, it is assumed that the table is partitioned based on the partition column.

[0034] In an implementation, rows with the same value in a partitioning column may be placed in the same data segment or shard. For example, an e-commerce application may include a database with a customer table that includes columns such as street, city, state, zip code, etc. These columns may form the customer's address. A user 114 (e.g., a database administrator) may partition the customer table using only a column associated with a zip code, such that all rows in the customer table with the same zip code are placed in the same data segment or shard.

[0035] In an implementation, the database system 102 may also include or provide a partition function for each data table. table (k)→shard_id, where k is called the partition key and is the value of the partition column. In an implementation, the output of the function may be the identifier (ie, ID) of the shard that includes all rows whose partition column value is equal to the partition key (ie, k).

[0036] In an implementation, the database system 102 may allow the user 114 to specify one or more partitions and placement strategies for data stored in a partitioned database. Continuing with the example of the e-commerce application described above, a warehouse table may be included in addition to the customer table. Since most orders for this e-commerce application may need to be fulfilled from a local warehouse, the user 114 may decide to partition the database based on geographic location. In this case, the zip code of the warehouse location and the zip code of the customer address may serve as corresponding partition columns for the warehouse table and the customer table, respectively. In addition, the user 114 may instruct the database system 102 to allow rows representing warehouses and customers at the same zip code to be hosted or stored in the same node, so that most order processing can trigger local transactions. In other words, the partition columns of the warehouse and the customer table may be local nodes. warehouse (k) and part customer (k) Both functions use the postal code as the partition key and satisfy Where place(.) is the placement function.

[0037] In an implementation, the partitioning function and the placement function can be implemented by querying metadata, which includes a mapping from a partition key to a shard ID, and a mapping from a shard ID to a computing node when the corresponding shard is hosted or stored. The metadata can be replicated to some or all computing nodes 104 and / or load balancing nodes 108 in the database system 102.

[0038] In some implementations, the partition function may not exist or may be difficult to construct due to the potential large amount of data involved and the need for pre-storage. In an implementation, the database system 102 may include or provide a prediction function predict for a stored procedure proc (parameters)→shard_id, where the parameter represents the value entered by the user for the input parameter of the stored procedure. In an implementation, the output of the function may be shard_id, i.e., the identifier (i.e., ID) of the shard to which the data row to be queried or accessed by at least one query request of the stored procedure belongs. After obtaining the identifier of the shard to which the data row to be queried or accessed by at least one query request of the stored procedure may be included, the database system 102 may use the placement function as described above to obtain the identifier of the computing node to which the stored procedure may be assigned or sent.

[0039] Example compute node

[0040] Figure 2 The computing node 104 is shown in detail. In an implementation, the computing node 104 may include, but is not limited to, one or more processors 202, input / output (I / O) interfaces 204, and / or network interfaces 206, and memory 208. In an implementation, some functions of the computing node 104 may be implemented using hardware, such as an ASIC (i.e., an application specific integrated circuit), an FPGA (i.e., a field programmable gate array), and / or other hardware.

[0041] In an implementation, the processor 202 may be configured to execute instructions stored in the memory 208 and / or received from the I / O interface 204 and / or the network interface 206. In an implementation, the processor 202 may be implemented as one or more hardware processors, including, for example, a microprocessor, a dedicated instruction set processor, a physical processing unit (PPU), a central processing unit (CPU), a graphics processing unit, a digital signal processor, a tensor processor. Additionally or alternatively, the functions described herein may be performed at least in part by one or more hardware logic components. For example, but not by way of limitation, exemplary hardware logic component types that may be used include field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), system-on-chip systems (SOCs), complex programmable logic devices (CPLDs), and the like.

[0042] Memory 208 may include computer readable media, which may be in the form of volatile memory, such as random access memory (RAM), and / or non-volatile memory, such as read only memory (ROM) or flash RAM. Memory 208 is an example of a computer readable medium.

[0043] Computer readable media may include volatile or non-volatile types, removable or non-removable media, which may use any method or technology to implement information storage. The information may include computer readable instructions, data structures, program modules or other data. Examples of computer readable media include, but are not limited to, phase change 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 internal storage technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage device, magnetic tape, disk storage device, or other magnetic storage device, or any other non-transmission medium that can be used to store information accessible by a computing device. As defined herein, computer readable media does not include any transient media, such as modulated data signals and carrier waves.

[0044] Although in this example, only hardware components in the computing node 104 are described, in other cases, the computing node 104 may also include other hardware components and / or other software components, such as program units, to execute instructions stored in the memory 208 to perform various operations. For example, the computing node 104 may also include a local or partitioned database 210 for storing data tables and other program data 212. As an example and not a limitation, the computing node 104 may store data segments or shards of one or more data tables in the local or partitioned database 210. In an implementation, one or more data tables may be divided and distributed according to corresponding partition keys of different computing nodes 104.

[0045] Example load balancing node

[0046] Figure 3 The load balancing node 108 is shown in more detail. In an implementation, the load balancing node 108 may include, but is not limited to, one or more processors 302, input / output (I / O) interfaces 304, and / or network interfaces 306, and memory 308. In an implementation, some functions of the load balancing node 108 may be implemented using hardware, such as an ASIC (i.e., an application specific integrated circuit), an FPGA (i.e., a field programmable gate array), and / or other hardware.

[0047] In an implementation, the processor 302 may be configured to execute instructions stored in the memory 308 and / or received from the I / O interface 304 and / or the network interface 306. In an implementation, the processor 302 may be implemented as one or more hardware processors, including, for example, a microprocessor, a dedicated instruction set processor, a physical processing unit (PPU), a central processing unit (CPU), a graphics processing unit, a digital signal processor, a tensor processing unit. Additionally or alternatively, the functions described herein may be performed at least in part by one or more hardware logic components. For example, but not by way of limitation, exemplary hardware logic component types that may be used include field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), system-on-chip systems (SOCs), complex programmable logic devices (CPLDs), and the like.

[0048] Memory 308 may include computer readable media, which may be in the form of volatile memory, such as random access memory (RAM), and / or non-volatile memory, such as read only memory (ROM) or flash RAM. Memory 308 is an example of a computer readable medium as described above.

[0049] Although in this example, only hardware components in the load balancing node 108 are described, in other cases, the load balancing node 108 may also include other hardware components and / or other software components, such as program units, for executing instructions stored in the memory 308 to perform various operations. For example, the load balancing node 108 may also include a mapping table 310 and other program data 312. In an implementation, the mapping table 310 may include a mapping of information from a combination to a computing node, the combination being a combination of data table information and partition key information, the computing node including a data segment or shard of the data table corresponding to the partition key. As an example and not limitation, given the name of the data table and the value of the partition key, the load balancing node 108 can determine the identity or address of the computing node that includes the data segment or shard of the data table corresponding to the value of the partition key.

[0050] In an implementation, the load balancing node 108 may obtain the mapping table 310 in advance, for example, by receiving broadcast information from multiple computing nodes 104. In an implementation, the broadcast information of each computing node 104 may include, but is not limited to, information about data segments or shards of a data table corresponding to a specific value of a partition key included or stored in the corresponding computing node 104.

[0051] Additionally or alternatively, in some implementations, the load balancing node 108 may be associated with a mapping device (which may be a server or computing device provided in the database system 102). The mapping device may collect information about data segments or shards of a data table corresponding to a specific value of a partition key included or stored in each computing node 104 from a plurality of computing nodes 104, for example, by broadcasting information from a plurality of computing nodes 104 as described above. In this case, the load balancing node 108 may send the partition key information (e.g., value) and the data table information (e.g., name) obtained from the distributed database transaction to the mapping device, and the mapping device maps the data table information and the partition key information to information (e.g., identification or address) of a computing node, which includes the data segment or shard of the data table corresponding to the partition key. The load balancing node 108 may then receive the information of the computing node from the mapping device, thereby reducing the workload and complexity of the load balancing node while enabling the load balancing node to continuously process the load balancing of incoming requests or data packets.

[0052] In an implementation, the load balancing node 108 may include one or more predetermined load balancing strategies. As an example and not a limitation, the one or more predetermined load balancing strategies may include: randomly assigning distributed database transactions received (e.g., from the client device 112) to computing nodes, assigning distributed database transactions to computing nodes in a round-robin manner, assigning distributed database transactions to computing nodes with the smallest current workload, or assigning distributed database transactions to computing nodes based on a mapping relationship between an IP address of a client device and a computing node, etc.

[0053] In an implementation, the load balancing node 108 may further include an identification database 314. The identification database 314 may include or store, for example, a unique identification (e.g., a unique name, etc.) of a stored procedure registered and stored in the database 102, a unique identification of a prediction function, etc. In an implementation, the load balancing node 108 may further include a relationship database 316. The relationship database 316 may include or store, for example, a relationship between a unique identification of a stored procedure and a unique identification of a prediction function, etc. In an implementation, the load balancing node 108 may further include a predictor database 318. The predictor database 318 may include or store a plurality of prediction functions, which may be queried or called, for example, by identification of the prediction function.

[0054] Example Monitoring Node

[0055] Figure 4 The monitoring node 110 is shown in more detail. In an implementation, the monitoring node 110 may include, but is not limited to, one or more processors 402, input / output (I / O) interfaces 404, and / or network interfaces 406, and memory 408. In an implementation, some functions of the monitoring node 110 may be implemented using hardware, such as an ASIC (i.e., application specific integrated circuit), an FPGA (i.e., a field programmable gate array), and / or other hardware.

[0056] In an implementation, the processor 402 may be configured to execute instructions stored in the memory 408 and / or received from the I / O interface 404 and / or the network interface 306. In an implementation, the processor 402 may be implemented as one or more hardware processors, including, for example, a microprocessor, a dedicated instruction set processor, a physical processing unit (PPU), a central processing unit (CPU), a graphics processing unit, a digital signal processor, a tensor processing unit. Additionally or alternatively, the functions described herein may be performed at least in part by one or more hardware logic components. For example, but not by way of limitation, the types of hardware logic components that may be used include field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), system-on-chip systems (SOCs), complex programmable logic devices (CPLDs), and the like.

[0057] Memory 408 may include computer readable media, which may be in the form of volatile memory, such as random access memory (RAM), and / or non-volatile memory, such as read only memory (ROM) or flash RAM. Memory 408 is an example of a computer readable medium as described above.

[0058] Although in this example, only the hardware components in the monitoring node 110 are described, in other cases, the monitoring node 110 may also include other hardware components and / or other software components, such as program units, to execute instructions stored in the memory 408 to perform various operations. For example, the monitoring node 110 may also include an information database 410 and other program data 412. In an implementation, the information database 410 may store data received from multiple computing nodes 104 and load balancing nodes 108, which may include but is not limited to the following information: the corresponding number of times each stored procedure from the load balancing node 108 is individually called or used by a user, the identification of the missed process from each computing node 104 and the corresponding number of missed processes, the corresponding input and output data sets (including multiple value sets of one or more input parameters of the stored procedure and the identification of multiple data slices of each prediction function in the multiple prediction functions), etc.

[0059] Example Method

[0060] Figure 5 A schematic diagram depicting an example method of determining a prediction function is shown. Figure 6 A schematic diagram depicting an example method of processing distributed database transactions is shown. Figure 5 and Figure 6 The method can but does not have to be Figure 1 In an environment and using Figures 2 to 4 The computing nodes, load balancing nodes, and monitoring nodes in the system are implemented. For ease of explanation, refer to Figures 1 to 3Method 500 and method 600 are described. However, methods 500 and 600 may alternatively be implemented in other environments and / or using other systems.

[0061] Method 500 and method 600 are described in the general context of computer executable instructions. Typically, computer executable instructions may include routines, programs, objects, components, data structures, processes, modules, functions, etc. that perform specific functions or implement specific abstract data types. In addition, each of the example methods is illustrated as a collection of blocks in a logical flow chart, which represents a sequence of operations that can be implemented in hardware, software, firmware, or a combination thereof. The order in which the method is described is not intended to be interpreted as a limitation, and any number of the described method blocks can be combined in any order to implement the method or an alternative method. In addition, without departing from the spirit and scope of the subject matter described herein, a separate block in the method may be omitted. In the context of software, a block represents a computer instruction that, when executed by one or more processors, performs the operation. In the context of hardware, some or all of the blocks may represent an application specific integrated circuit (ASIC) or other physical components that perform the operation.

[0062] Return to reference Figure 5 , at block 502 , the monitoring node 110 may select a stored procedure.

[0063] In an implementation, the database system 102 may include a plurality of procedures stored in the database system 102. These procedures are written in a query language (e.g., SQL language) and are registered in the database system 102 for user invocation. In an implementation, a stored procedure may include one or more query requests that access or update data of one or more data shards of one or more database tables in one or more computing nodes of the database system 102. In an implementation, a query request of a stored procedure may include a partition key and an input parameter, and the input value received by the input parameter comes from a user using the stored procedure. In an implementation, a stored procedure may include a parameter list of input parameters, which may be used as a placeholder to receive input values ​​of the input parameters of the stored procedure from the user. In other implementations, a stored procedure may not include a parameter list of input parameters, and the input parameters are distributed in the stored procedure that needs to be searched.

[0064] In an implementation, the monitoring node 110 may obtain one or more stored procedures newly added or registered in the database system 102, and there is no prediction function for these stored procedures, or the prediction function has not been trained for these stored procedures. The monitoring node 110 may select a stored procedure from one or more stored procedures newly added or registered in the database system 102. In an implementation, the monitoring node 110 may select a newly added or registered stored procedure after the stored procedure has been used or called by a user of the database system 102 for a predetermined number of times (e.g., 1,000 times, 10,000 times, etc.) and / or a predetermined period of time (e.g., one week, two weeks, etc.). This allows a sufficient amount of training data to be available for training a prediction function for a stored procedure.

[0065] Additionally or alternatively, the monitoring node 110 may select a stored procedure from a plurality of stored procedures associated with the prediction function to retrain periodically (e.g., every week, every two weeks, every month, etc.). In an implementation, the frequency of selecting a certain stored procedure may depend on the frequency of calling or using the stored procedure by a user in the database system 102. As an example and not a limitation, the higher the frequency of calling or using a stored procedure, the higher the frequency of selecting the stored procedure for retraining.

[0066] Additionally or optionally, the monitoring node 110 may monitor the performance of multiple stored procedures in the database system 102, and determine whether to update or retrain the stored procedures based on the performance of the stored procedures. In an implementation, the performance of the stored procedures may include, but is not limited to, the error rate of the prediction function used to map the stored procedures, etc. For example, the load balancing node 108 may count the number of times each stored procedure is used or called by a user within a preset time interval (e.g., every week, every two weeks, etc.), and store the identifier of each stored procedure and the corresponding number of uses or calls in a data structure (e.g., a table, etc.). In addition, each computing node 104 may track one or more stored procedures assigned to the computing node that encounter a miss in the corresponding computing node 104 (i.e., one or more stored procedures requesting access or updating data do not exist in the computing node 104). Each computing node 104 may store the identifier of such a stored procedure and the corresponding number of misses of the stored procedure in a specific data structure (e.g., a list, etc.) within a preset time interval.

[0067] In an implementation, the monitoring node 110 may receive information about the corresponding number of times a stored procedure is called or used by a user individually from the load balancing node 108, and further collect the identifier of the missed procedure and the corresponding number of missed procedures from each computing node 104. Then, the monitoring node 110 may determine the corresponding error rate of each stored procedure (e.g., determine the proportion of stored procedures that are used or called and result in missed procedures). The monitoring node 110 may compare the error rate of each stored procedure with a predetermined error threshold, and select the prediction function of the stored procedure with the highest error rate and an error rate higher than the predetermined error threshold for updating or retraining.

[0068] At block 504 , the monitoring node 110 may determine one or more input parameters for training a prediction function associated with the stored procedure.

[0069] In an implementation, when selecting a stored procedure, the monitoring node 110 may determine one or more input parameters that may be used to train a prediction function for the stored procedure. In an implementation, the stored procedure may include a parameter list that includes at least one input parameter, and the monitoring node 110 may use at least one input parameter included in the parameter list as a candidate input parameter for training a prediction function for the stored procedure.

[0070] Additionally or optionally, monitoring node 110 can perform static program analysis to extract one or more candidate input parameters from the stored procedure.Static program analysis can also be referred to as compile-time analysis, which is an algorithm that analyzes program code before the program code runs to predict the runtime behavior of the program code.Monitoring node 110 can adopt static program analysis to determine which input parameters determine or affect data sharding, and one or more query requests in the stored procedure can operate (for example, access or update) on this data slice.In implementation, monitoring node 110 can identify one or more variables used as one or more partition keys in the stored procedure.For example, for the SELECT query request in the stored procedure, monitoring node 110 can find distributed tables in the FROM clause, and identify the variables that can be used to compare with each partition column of these distributed tables.Similar methods can also be used for UPDATE, INSERT and DELETE query requests.

[0071] For example, a stored procedure, such as payment_proc, can be represented as follows. In this example, the first UPDATE is used to update the target table, the warehouse table, and the variable in_w_zip is compared with the corresponding partition column, warehouse_zip.

[0072]

[0073] In an implementation, monitoring node 110 can calculate the transitive closure of all variables of the value of the partition key in one or more query requests that may affect the stored procedure. As described above, monitoring node 110 can use data flow analysis to estimate the possible values ​​of the variables of the data flow between the program points that can be reached according to the control flow graph. In order to locate all variables whose values ​​may affect the partition key of the query request in the stored procedure, monitoring node 110 can take the partition key of the query request as the starting point, and reversely track the values ​​of the variables of the data flow until all links that can be reached from the starting point are traversed. In an implementation, monitoring node 110 can use a graph traversal algorithm to perform such an operation. In an implementation, monitoring node 110 can set these variables as candidate input parameters after obtaining the variables whose values ​​may affect the partition key of the query request. Monitoring node 110 can repeat the above operation for all partition keys of all query requests in the stored procedure, thereby obtaining a candidate input parameter set of the partition key of all query requests that may affect the stored procedure. In an implementation, the monitoring node 110 may set the candidate input parameters of the partition key that may affect the query request of the stored procedure as one or more input parameters for training the prediction function associated with the stored procedure.

[0074] At block 506 , the monitoring node 110 may obtain historical data including multiple value sets for one or more input parameters of the stored procedure and identification of multiple data shards.

[0075] In an implementation, the monitoring node 110 may obtain historical data from the plurality of computing nodes 104 and the load balancing node 108. In an implementation, the historical data may include, but is not limited to, multiple value sets of one or more input parameters of the stored procedure and identification of multiple data shards. In an implementation, each of the multiple data shards may include a corresponding data segment evaluated by the stored procedure when the one or more input parameters adopt a corresponding value set of the multiple value sets.

[0076] At block 508 , the monitoring node 110 may train a classification model using the plurality of value sets as input and corresponding identifications of the plurality of data shards as output.

[0077] In an implementation, the monitoring node 110 may train a classification model based on historical data, and the lightning protection model is used to learn or imitate the behavior of the prediction function of the stored process. In an implementation, the monitoring node 110 may use supervised training to train and obtain the classification model. In an implementation, the classification model may include but is not limited to a neural network model, a deep learning model, a decision tree model, etc.

[0078] As an example and not limitation, in one example, a neural network model is used as a classification model to learn or imitate the behavior of a prediction function of a stored procedure. In this example, one or more input parameters of the stored procedure obtained or determined in block 504 can be used as inputs (or input features) of the neural network model, and the historical values ​​(or value sets) of the one or more parameters are training values ​​of the input features. In an implementation, each stored procedure may include one or more query requests, and operations (e.g., access, update, etc.) may be performed on one or more data slices of one or more database tables. In this case, the monitoring node 110 may select the most frequently operated data slices from one or more data slices of one or more database tables. In an implementation, the most frequently operated data slices of the stored procedure may include, but are not limited to, the data slices with the largest number of rows accessed or affected by the query requests in the stored procedure, etc. In an implementation, the monitoring node 110 may regard the most frequently operated data slices as the corresponding outputs (or labels) of the neural network model. In an implementation, such feature-label pairs may be obtained by monitoring the execution of the stored procedure, recording the respective input parameters, the corresponding data slices accessed, and the corresponding number of rows accessed or affected, etc. The monitoring node 110 may then train the neural network model using conventional training or learning algorithms.

[0079] At block 510 , the monitoring node 110 may set the trained classification model as a prediction function for mapping a new value set of one or more input parameters of the stored procedure to a corresponding data shard.

[0080] In an implementation, after completing the training of the classification model, the monitoring node 110 may use the trained classification model as a prediction function of the stored procedure. In an implementation, the monitoring node 110 may send the prediction function to the load balancing node 108, so that the load balancing node 108 may use the prediction function to map the stored procedure with any new input value set for one or more input parameters to a corresponding data shard (e.g., an identifier of the data shard), which may store data that will be accessed or updated by at least one query request of the stored procedure.

[0081] In an implementation, the monitoring node 110 may continue to receive new data and identification of data slices, the new data being associated with a new value set for one or more input parameters of each stored procedure, the data slices respectively including corresponding data segments evaluated by each stored procedure when the one or more input parameters adopt the new value set, the new value set being periodically obtained from the plurality of computing nodes 104 and the load balancing node 108. The monitoring node 110 may select a stored procedure and retrain the prediction function for the stored procedure based on the new data and the previously stored data according to the operations described in blocks 502 to 510.

[0082] Although in the above operations, the prediction function is described as being trained for and associated with each stored procedure, in some cases, the prediction function may be trained for and associated with a set of stored procedures. In this case, the input (i.e., input parameters) of the prediction function may include a combination of candidate input parameters obtained from each stored procedure in the set of stored procedures as described in block 504, and the output of the predictor may include an identification of a data shard that may store or include data to be queried or updated by the corresponding stored procedure. In an implementation, the monitoring node 110 may automatically group stored procedures with similar candidate input parameters, or group stored procedures according to a user's request.

[0083] Return to reference Figure 6 At block 602, the load balancing node 108 may receive a distributed database transaction including at least one query process.

[0084] In an implementation, the database system 102 or the load balancing node 108 of the database system 102 may receive a distributed database transaction including at least one query process from the client device 112. In an implementation, the at least one query process may include one or more query requests that access or operate data of one or more data shards of one or more database tables located in one or more computing nodes (e.g., computing node 104) of the database system 102.

[0085] At block 604, the load balancing node 108 may determine whether the at least one query procedure is a pre-stored procedure.

[0086] In an implementation, the query process may be a process (i.e., a stored process) pre-registered and stored in the database system 102, or a process that is not registered in the database system 102 but is written in a certain query language (e.g., SQL language) by the user 114 according to his / her needs. If the query process is a registered stored process, the values ​​of one or more input parameters of the stored process may be further provided by the user 114 when the stored process is sent to the database system 102. In an implementation, the one or more input parameters may include one or more potential partition key values ​​associated with one or more query requests included in the stored process.

[0087] In an implementation, multiple stored procedures may be registered and stored in the database system 102 and may be called by the user 114. In order to distinguish different stored procedures, each stored procedure may be assigned a unique identifier, which may uniquely represent the corresponding stored procedure. The unique identifier of the stored procedure may include, but is not limited to, the unique name of the stored procedure, the unique index of the stored procedure, etc. In an implementation, the stored procedure may include one or more input parameters or objects, and the user 114 may provide input values ​​to the stored procedure through the input parameters or objects. For example, in the above example (payment_proc) stored procedure, the stored procedure may be associated with a unique name, namely payment_proc, which unique name may uniquely identify the stored procedure and distinguish the stored procedure from other stored procedures in the database system 102. For example, the stored procedure may also include a parameter list, which includes multiple input parameters provided or input by the user 114 (i.e., in_w_idinteger, in_w_zip integer, in_c_idinteger, in_c_zip integer, in_payment_amountdecimal)

[0088] In an implementation, the load balancing node 10 determines whether the received query process is a registered stored process. The load balancing node 10 determines whether the query process is a stored process by judging whether the received query process is associated with an identifier (e.g., a name, etc.) and the identifier is registered or found in a data structure (e.g., a table or a list, etc.) storing identifiers of stored processes registered in the database system 102. Continuing with the above example, the load balancing node 108 can determine whether the received query process is associated with a name (e.g., payment_proc). If so, it is further determined whether the name is registered or found in a data structure storing identifiers of stored processes registered in the database system 102. If it is determined that the name is registered or found, the load balancing node 108 can determine that the received query process is a registered stored process. Alternatively, if the received query process is not associated with any name, or the name associated with the received query process is not registered or found in a data structure storing identifiers of stored processes registered in the database system 102, the load balancing node 108 can determine that the received query process is not a registered stored process.

[0089] At block 606 , the load balancing node 108 may employ a predetermined load balancing strategy to distribute the distributed database transactions to the computing nodes in response to determining that the received query procedure is not a registered stored procedure.

[0090] In an implementation, if it is determined that the received query process is not a registered stored procedure, the load balancing node 108 may use a predetermined load balancing strategy to distribute the distributed database transaction to a computing node in the plurality of computing nodes 104 included in the database system 102. As an example and not a limitation, the predetermined load balancing strategy may include: randomly distributing the distributed database transaction to the computing node, distributing the distributed database transaction to the computing node in a round-robin manner, distributing the distributed database transaction to the computing node with the smallest current workload, or distributing the distributed database transaction to the computing node based on the IP address of the client device from which the distributed database transaction comes, etc.

[0091] At block 608 , in response to determining that the received query procedure is a registered stored procedure, the load balancing node 108 may determine or select a prediction function for the stored procedure from a plurality of prediction functions.

[0092] In an implementation, after determining that the received query process is a registered stored procedure, the load balancing node 108 may determine or select a prediction function for the stored procedure. In an implementation, the database system 102 may include or store multiple prediction functions, and each prediction function may be configured to perform prediction or mapping on one or more stored procedures. In an implementation, the load balancing node 108 may determine or select a prediction function for a stored procedure based at least in part on an identifier (e.g., name or index) of the stored procedure.

[0093] In an implementation, the load balancing node 108 or the database system 102 may include or store a data structure (e.g., a table, etc.), which includes a mapping relationship between multiple stored procedures and multiple prediction functions, such as a mapping relationship between identifiers of multiple stored procedures and identifiers of multiple prediction functions, or a mapping relationship between identifiers of multiple stored procedures and storage locations of multiple prediction functions, etc. The load balancing node 108 may determine or select a prediction function for a stored procedure from the data structure including the mapping relationship between multiple stored procedures and multiple prediction functions based at least in part on the identifier of the stored procedure.

[0094] As an example but not limitation, the load balancing node 108 may determine or obtain an identifier of a stored procedure, obtain an identifier of a prediction function based on the identifier of the stored procedure and a mapping relationship, and select a prediction function from multiple prediction functions based on the identifier of the prediction function.

[0095] In an implementation, each prediction function may include a classification model, which is trained based on multiple partition key values ​​and corresponding identifiers of multiple shards, the multiple shards include data segments corresponding to the multiple partition key values ​​in the database table, and the multiple shards may be stored in multiple computing nodes respectively. As an example and not limitation, the classification model may include a neural network model.

[0096] At block 610 , the load balancing node 108 may extract or determine input values ​​for one or more input parameters of the stored procedure.

[0097] In an implementation, a stored procedure may include a parameter list through which a user 114 may input values ​​of one or more input parameters of the stored procedure. The load balancing node 108 may extract or determine input values ​​of the one or more input parameters of the stored procedure from the parameter list. In an implementation, the load balancing node 108 may use static program analysis to extract or determine input values ​​of the one or more input parameters of the stored procedure.

[0098] At block 612 , the load balancing node 108 may determine a compute node to which the stored procedure is to be sent or assigned based at least in part on the prediction function and input values ​​of one or more input parameters of the stored procedure.

[0099] In an implementation, after determining the input values ​​of the prediction function and one or more input parameters of the stored procedure, the load balancing node 108 may determine the computing node to which the stored procedure is sent or assigned. In an implementation, the load balancing node 108 may apply the prediction function to the input values ​​of the one or more input parameters of the stored procedure to generate the output of the prediction function. In an implementation, the output of the prediction function may be a label associated with the location of data that is potentially or possibly accessed or queried by at least one query request of the stored procedure. In an implementation, the label may include an identification of a data shard of a database table that includes or stores data that is potentially or possibly accessed or queried by at least one query request of the stored procedure. In an implementation, the load balancing node 108 may then employ a placement function to map the identification of the data shard to the identification of the computing node that includes or stores the data shard.

[0100] In an implementation, each prediction function in the plurality of prediction functions may be combined with a partition function to form a corresponding combined prediction-partition function, and be assigned the same identifier as the corresponding prediction function. In this case, the load balancing node 108 may directly use the combined prediction-partition function to obtain the identifier of the computing node to which the stored procedure is assigned.

[0101] At block 614, the load balancing node may send the stored procedure to the compute node.

[0102] After determining the identifier of the computing node, the load balancing node may send the stored procedure to the computing node to allow the computing node to process the stored procedure, and / or coordinate and manage the processing of the stored procedure as a control node.

[0103] Although the above method blocks are described as being performed in a particular order, in some implementations, some or all of these method blocks may be performed in other orders or in parallel.

[0104] in conclusion

[0105] Although the implementation has been described in language specific to structural features and / or methodological actions, it should be understood that the claims are not necessarily limited to the specific features or actions described. Instead, the specific features and actions are disclosed as exemplary forms of implementing the claimed subject matter. Additionally or alternatively, some or all of the operations may be implemented by one or more ASICs, FPGAs, or other hardware.

[0106] The present disclosure may be further understood using the following terms.

[0107] Clause 1: A method implemented by a load balancing node, the method comprising: receiving a distributed transaction including a stored procedure; selecting a prediction function for the stored procedure from a plurality of prediction functions; extracting one or more input parameters from the stored procedure; determining a computing node using the prediction function at least in part based on the one or more input parameters; and forwarding the stored procedure to the computing node for processing the stored procedure.

[0108] Clause 2: The method of clause 1, wherein the one or more input parameters include one or more partition key values ​​associated with one or more query requests included in the stored procedure.

[0109] Clause 3: The method described in Clause 1, wherein selecting the prediction function for the stored procedure from the multiple prediction functions includes: determining an identifier of the stored procedure; obtaining the identifier of the prediction function based on the identifier of the stored procedure and a mapping relationship; and selecting the prediction function from the multiple prediction functions based on the identifier of the prediction function.

[0110] Clause 4: The method described in Clause 1, wherein extracting the one or more input parameters from the stored procedure comprises: extracting the one or more input parameters from a parameter list of the stored procedure or extracting the one or more input parameters from the stored procedure using static program analysis.

[0111] Clause 5: The method of clause 1, wherein the stored procedure comprises a stored procedure pre-registered and stored in a database system before being called.

[0112] Clause 6: The method described in Clause 1, wherein determining the computing node based at least in part on the one or more input parameters includes: determining an identification of a data shard associated with at least one query request included in the storage process based on the one or more input parameters using the prediction function; and determining an identification of the computing node storing the data shard using a placement function based on the identification of the data shard.

[0113] Clause 7: The method described in Clause 1, wherein the prediction function includes a classification model, the classification model is trained based on corresponding identifiers of multiple partition key values ​​and multiple shards, the multiple shards include respective data segments in a database table corresponding to the multiple partition key values, and the multiple shards are separately stored in multiple computing nodes.

[0114] Clause 8: The method described in Clause 7, wherein the classification model includes a neural network model.

[0115] Clause 9: A computer-readable medium storing executable instructions which, when executed by one or more processors, cause the one or more processors to perform the following actions: perform static program analysis on a stored procedure to determine one or more input parameters; obtain stored data, the stored data comprising multiple value sets of the one or more input parameters of the stored procedure, and identifiers of multiple data shards; train a classification model using the multiple value sets as input and the corresponding identifiers of the multiple data shards as output; and set the trained classification model as a prediction function, the prediction function being used to map new value sets of the one or more input parameters of the stored procedure to corresponding data shards.

[0116] Clause 10: The computer-readable medium of clause 9, wherein each of the plurality of data shards comprises a corresponding data segment evaluated by the stored procedure when the one or more input parameters assume a corresponding value set of the plurality of value sets.

[0117] Clause 11: The computer-readable medium of Clause 9, wherein performing the static program analysis on the stored procedure to determine the one or more input parameters comprises: identifying a variable representing a partition key in at least one query request included in the stored procedure; and determining one or more input parameters of the variable using a graph traversal algorithm.

[0118] Clause 12: The computer-readable medium of clause 9, wherein the classification model comprises a neural network model.

[0119] Clause 13: The computer-readable medium of clause 9, further comprising: sending the classification model to a load balancing node.

[0120] Clause 14: The computer-readable medium described in Clause 9 also includes: receiving new data associated with a new value set of the one or more input parameters of the stored procedure from multiple computing nodes, and an identification of a data shard, wherein the data shard includes corresponding data segments evaluated by the stored procedure when the one or more input parameters adopt the new value set.

[0121] Clause 15: The computer-readable medium of clause 14, further comprising: retraining the classification model based at least in part on the stored data and the new data.

[0122] Clause 16: A system comprising: one or more processors; and a memory storing executable instructions, which, when executed by the one or more processors, cause the one or more processors to perform the following actions: perform static program analysis on a stored procedure to determine one or more input parameters; obtain stored data, the stored data comprising multiple value sets of the one or more input parameters of the stored procedure, and identifiers of multiple data shards; train a classification model using the multiple value sets as input and the corresponding identifiers of the multiple data shards as output; and set the trained classification model as a prediction function, the prediction function being used to map new value sets of the one or more input parameters of the stored procedure to corresponding data shards.

[0123] Clause 17: The system of clause 16, wherein each data shard of the plurality of data shards comprises a corresponding data segment evaluated by the stored procedure when the one or more input parameters assume a corresponding value set of the plurality of value sets.

[0124] Clause 18: The system of Clause 16, wherein performing the static program analysis on the stored procedure to determine the one or more input parameters includes: identifying a variable representing a partition key in at least one query request included in the stored procedure; and determining one or more input parameters of the variable using a graph traversal algorithm.

[0125] Clause 19: The system of Clause 16, wherein the classification model comprises a neural network model.

[0126] Clause 20: The system of Clause 16, wherein the action further comprises: receiving new data associated with a new set of values ​​for the one or more input parameters of the stored procedure, and identification of data shards from a plurality of computing nodes, the data shards respectively comprising corresponding data segments evaluated by the stored procedure when the one or more input parameters adopt the new set of values; and retraining the classification model based at least in part on the stored data and the new data.

Claims

1. A method implemented by a load balancing node, the method comprising: Accept distributed transactions including stored procedures; Selecting a prediction function for the stored procedure from a plurality of prediction functions, wherein the prediction function is configured to predict or attempt to map the stored procedure to an identifier of a computing node; extracting one or more input parameters from the stored procedure; determining, using the prediction function, a compute node based at least in part on the one or more input parameters, wherein the compute node includes data corresponding to at least one query of a stored procedure; and The stored procedure is forwarded to the computing node for processing the stored procedure, wherein the computing node and / or as a control node coordinates and manages the processing of the stored procedure.

2. The method according to claim 1, wherein: The one or more input parameters include one or more partition key values ​​associated with one or more queries included in the stored procedure.

3. The method according to claim 1, wherein: Selecting the prediction function for the stored procedure from the plurality of prediction functions comprises: determining an identifier of the stored procedure; Obtaining an identifier of the prediction function according to the identifier of the stored procedure and the mapping relationship; and The prediction function is selected from the plurality of prediction functions based on the identification of the prediction function.

4. The method according to claim 1, wherein: Extracting the one or more input parameters from the stored procedure includes: The one or more input parameters are extracted from a parameter list of the stored procedure, or the one or more input parameters are extracted from the stored procedure using static program analysis.

5. The method according to claim 1, wherein: The stored procedures include procedures that are pre-registered and stored in a database system before being called.

6. The method according to claim 1, wherein: Determining the computing node based at least in part on the one or more input parameters using the prediction function includes: Determining, using the prediction function, an identification of a data shard associated with at least one query included in the stored procedure based on the one or more input parameters; and Based on the identification of the data shard, an identification of the computing node is determined using a placement function, and the computing node stores the data shard.

7. The method according to claim 1, wherein: The prediction function includes a classification model, which is trained based on multiple partition key values ​​and corresponding identifiers of multiple shards. The multiple shards include corresponding data segments in a database table corresponding to the multiple partition key values, and the multiple shards are respectively stored in multiple computing nodes.

8. The method according to claim 7, wherein: The classification model includes a neural network model.

9. A computer-readable medium storing executable instructions, wherein: When the executable instructions are executed by one or more processors, the one or more processors are caused to perform the following actions: performing static program analysis on the stored procedure to determine one or more input parameters; Obtaining stored data, the stored data comprising multiple value sets of the one or more input parameters of the stored procedure and identifiers of multiple data shards; Training a classification model using the multiple value sets as input and the corresponding identifiers of the multiple data shards as output; as well as The trained classification model is set as a prediction function, wherein the prediction function is used to map a new value set of the one or more input parameters of the stored procedure to a corresponding data shard.

10. The computer-readable medium of claim 9, wherein: Each data shard of the plurality of data shards includes a corresponding data segment that is evaluated by the stored procedure when the one or more input parameters assume a corresponding value set of the plurality of value sets.

11. The computer-readable medium of claim 9, wherein: Performing static program analysis on a stored procedure to determine one or more input parameters includes: identifying a variable representing a partition key in at least one query included in the stored procedure; and One or more input parameters of the variable are determined using a graph traversal algorithm.

12. The computer-readable medium of claim 9, wherein: The classification model includes a neural network model.

13. The computer-readable medium of claim 9, further comprising: The classification model is sent to a load balancing node.

14. The computer-readable medium of claim 9, further comprising: New data associated with a new set of values ​​for the one or more input parameters of the stored procedure and identifications of data shards are received from a plurality of computing nodes, the data shards respectively comprising corresponding data segments evaluated by the stored procedure when the one or more input parameters assume the new set of values.

15. The computer-readable medium of claim 14, further comprising: The classification model is retrained based at least in part on the stored data and the new data.

16. A system comprising: one or more processors; as well as A memory storing executable instructions, which, when executed by the one or more processors, cause the one or more processors to perform the following actions: performing static program analysis on the stored procedure to determine one or more input parameters; Obtaining stored data, the stored data comprising multiple value sets of the one or more input parameters of the stored procedure and identifiers of multiple data shards; Training a classification model using the multiple value sets as input and the corresponding identifiers of the multiple data shards as output; as well as The trained classification model is set as a prediction function, wherein the prediction function is used to map a new value set of the one or more input parameters of the stored procedure to a corresponding data shard.

17. The system of claim 16, wherein: Each data shard of the plurality of data shards includes a corresponding data segment that is evaluated by the stored procedure when the one or more input parameters assume a corresponding value set of the plurality of value sets.

18. The system according to claim 16, characterized in that Performing static program analysis on a stored procedure to determine one or more input parameters includes: identifying a variable representing a partition key in at least one query included in the stored procedure; and One or more input parameters of the variable are determined using a graph traversal algorithm.

19. The system of claim 16, wherein: The classification model includes a neural network model.

20. The system of claim 16, wherein: The actions also include: receiving, from a plurality of computing nodes, new data associated with a new set of values ​​for the one or more input parameters of the stored procedure and identifications of data shards, the data shards respectively comprising corresponding data segments evaluated by the stored procedure when the one or more input parameters assume the new set of values; and The classification model is retrained based at least in part on the stored data and the new data.

Citation Information

Patent Citations

  • Data query method, device and equipment

    CN110321214A