Database service processing method and apparatus, computer device, and storage medium

By using a vectorized execution mode to process table data in batches in the database, the problem of repetitive execution and high function call overhead in traditional OLTP engines is solved, achieving more efficient computation and resource utilization.

CN116126856BActive Publication Date: 2026-04-24JINZHUAN INFORMATION TECHNOLOGY CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
JINZHUAN INFORMATION TECHNOLOGY CO LTD
Filing Date
2022-12-28
Publication Date
2026-04-24

AI Technical Summary

Technical Problem

Traditional OLTP execution engines process one row of data at a time, resulting in a lot of repetitive execution, high function call overhead, and failure to fully utilize modern hardware resources.

Method used

The vectorized execution mode is adopted, which retrieves a preset number of table data vectors by looping through the disk and calls the target function in sequence to perform calculations, thereby reducing the number of function calls and repetitive executions.

Benefits of technology

It increases the amount of data processed in a single computation, reduces function call overhead, and improves computational efficiency and hardware resource utilization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116126856B_ABST
    Figure CN116126856B_ABST
Patent Text Reader

Abstract

The application relates to a database service processing method and device, computer equipment and a storage medium. The method comprises the following steps: when a service request initiated by a client is received, determining request information corresponding to the service request, a target function and a service execution mode; when the service execution mode is a vectorization execution mode, a table data vector corresponding to a query keyword is pulled in a loop according to the query keyword in the request information in the disk, the table data vector comprises a preset number of table data, that is, a plurality of table data is pulled out from the disk, the target function is called to calculate and process each table data vector, that is, one table data vector is calculated and processed each time, compared with the prior art, the data amount of single calculation is improved, the number of repetitive executions is reduced, and the calling overhead of the function is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a database business processing method, apparatus, computer equipment, and storage medium. Background Technology

[0002] In traditional database systems, a query processing flow generally follows a pipeline execution model, where queries are executed one record at a time (tuple). This model abstracts each operation in relational algebra into an operator, constructing an operator tree from all SQL statements. Each operator can be implemented independently without needing to concern itself with the logic of other operators. Function calls (the `next()` function) are recursively used from the root node to the leaf nodes. Because early databases were limited by hardware capabilities, I / O interfaces, memory, and CPU resources were very expensive. For example, with a large amount of data in the computation layer, memory could easily run out. Therefore, traditional OLTP execution engines used a method of calculating only one row of data at a time, greatly reducing memory usage.

[0003] Today, with the continuous development of hardware technology, the drawbacks of traditional OLTP execution engines, which process only one row of data at a time, are becoming increasingly apparent. This approach suffers from the defect of repetitive execution, resulting in significant overhead from function calls in the OLTP execution engine. Summary of the Invention

[0004] To address the aforementioned technical problems, this application provides a database business processing method, apparatus, computer equipment, and storage medium.

[0005] Firstly, this application provides a database business processing method, including:

[0006] Upon receiving a business request initiated by a client, the request information, target function, and business execution mode corresponding to the business request are determined, wherein the request information includes query keywords;

[0007] When the business execution mode is vectorized execution mode, the system iterates through the disk according to the query keywords and retrieves the table data vectors corresponding to the query keywords in turn. The table data vectors include a preset number of table data.

[0008] The target function is called sequentially to calculate and process each of the table data vectors to obtain the output vector corresponding to each of the table data vectors, wherein the output vector includes the preset number of output data;

[0009] Each of the output vectors is sent to the client in sequence.

[0010] Secondly, this application provides a database business processing apparatus, comprising:

[0011] The parsing module is used to determine the request information, target function, and business execution mode corresponding to the business request when a business request is received from a client, wherein the request information includes query keywords;

[0012] The query module is used to, when the business execution mode is vectorized execution mode, traverse the disk according to the query keywords and sequentially retrieve the table data vectors corresponding to the query keywords, wherein the table data vectors include a preset number of table data.

[0013] The processing module is used to sequentially call the target function to perform calculations on each of the table data vectors to obtain the output vector corresponding to each of the table data vectors, wherein the output vector includes the preset number of output data;

[0014] The sending module is used to sequentially send each of the output vectors to the client.

[0015] Thirdly, this application provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to perform the following steps:

[0016] Upon receiving a business request initiated by a client, the system determines the request information, target function, and business execution mode corresponding to the business request, wherein the request information includes query keywords;

[0017] When the business execution mode is vectorized execution mode, the system iterates through the disk according to the query keywords and retrieves the table data vectors corresponding to the query keywords in sequence. The table data vectors include a preset number of table data.

[0018] The target function is called sequentially to calculate and process each of the table data vectors to obtain the output vector corresponding to each of the table data vectors, wherein the output vector includes the preset number of output data;

[0019] Each of the output vectors is sent to the client in sequence.

[0020] Fourthly, this application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, performs the following steps:

[0021] Upon receiving a business request initiated by a client, the system determines the request information, target function, and business execution mode corresponding to the business request, wherein the request information includes query keywords;

[0022] When the business execution mode is vectorized execution mode, the system iterates through the disk according to the query keywords and retrieves the table data vectors corresponding to the query keywords in sequence. The table data vectors include a preset number of table data.

[0023] The target function is called sequentially to calculate and process each of the table data vectors to obtain the output vector corresponding to each of the table data vectors, wherein the output vector includes the preset number of output data;

[0024] Each of the output vectors is sent to the client in sequence.

[0025] Based on the above database business processing method, when a business request is received from a client, the request information, target function, and business execution mode corresponding to the business request are determined. When the business execution mode is vectorized execution mode, the table data vector corresponding to the query keywords in the request information is retrieved from the disk in a loop. The table data vector includes a preset number of table data, that is, multiple table data are retrieved from the disk. Then, the target function is called to calculate and process each table data vector. In other words, the calculation and processing is performed on one table data vector at a time. Compared with the existing technology of calculating and processing a single row of data, the amount of data calculated at one time is increased, the number of repetitive executions can be reduced, and the overhead of function calls can be reduced. Attached Figure Description

[0026] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.

[0027] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0028] Figure 1 This is an application environment diagram of a database business processing method in one embodiment;

[0029] Figure 2 This is a flowchart illustrating a database business processing method in one embodiment;

[0030] Figure 3 This is a schematic diagram illustrating the time distribution of database operator execution in one embodiment;

[0031] Figure 4 This is a flowchart illustrating a database business processing method in one embodiment;

[0032] Figure 5 This is a structural block diagram of a database service processing device in one embodiment;

[0033] Figure 6 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation

[0034] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0035] Figure 1 This is an application environment diagram of a database business processing method in one embodiment. (Refer to...) Figure 1 This database business processing method is applied to a database business processing system. The system includes a client 110 and a server 120. The client 110 and server 120 are connected via a network. The client 110 can be a desktop terminal or a mobile terminal; a mobile terminal can be at least one of a mobile phone, tablet, or laptop. The server 120 can be implemented using a standalone server or a server cluster consisting of multiple servers, and the server contains a database.

[0036] In one embodiment, Figure 2 This is a flowchart illustrating a database business processing method in one embodiment, with reference to... Figure 2 This provides a database business processing method. This embodiment primarily applies this method to the aforementioned... Figure 1 Taking server-side 120 as an example, the specific steps of this database business processing method include the following:

[0037] Step S210: Upon receiving a business request initiated by client 110, determine the request information, target function, and business execution mode corresponding to the business request, wherein the request information includes query keywords.

[0038] Specifically, the database in server 120 receives business requests initiated by client 110. The business request is a business SQL statement, which contains request information. Server 120 determines the operator functions required to complete the execution of the business SQL statement based on the request information. That is, the target function includes multiple operator functions used to complete the execution of the business SQL statement. The business execution mode includes single-row data execution mode and vectorized execution mode. The single-row data execution mode is the same as the execution mode of traditional OLTP execution engines in the existing technology, that is, only one row of data is calculated at a time, that is, only one data record (tuple) is calculated and processed at a time. The vectorized execution mode calculates multiple data records in batches at a time, that is, it calculates and processes a data vector in batches. The data vector includes multiple data records. Executing the business SQL statement according to the vectorized execution mode increases the amount of data calculated at a time, which can reduce the number of repetitive executions and the number of function calls, that is, reduce function call overhead.

[0039] Step S220: When the business execution mode is vectorized execution mode, the system iterates through the disk according to the query keywords and retrieves the table data vectors corresponding to the query keywords in sequence. The table data vectors include a preset number of table data.

[0040] Specifically, refer to Figure 3 As can be seen, during the execution of SQL, traditional OLTP execution engines spend most of their time in the Scan operator function stage. This stage is precisely where CPU features such as SIMD can be used for optimization to achieve vectorized computation.

[0041] Therefore, in the case of a vectorized execution mode, the query operator function (Scan) is called to read related table data in batches from the disk according to the query keywords. For example, if the query keyword is "People", the table data of "People" is pulled from the disk to memory. This continues until the number of table data in memory reaches a preset number. Then, the preset number of table data is formed into a table data vector, and this table data vector is passed to the next processing node as child node data through a function call (next() function). Compared to the existing technology where each piece of table data is read from the disk and then passed to the next processing node through a function call, this reduces the overhead of function calls. The preset number can be any positive integer and can be customized according to the cache capacity. In this embodiment, the preset number is set to 1024, meaning that 1024 pieces of table data are pulled from the disk each time to form a table data vector, and these 1024 pieces of table data are passed to the next processing node through a function call. This reduces the number of function calls by 1023 compared to the existing technology where each piece of table data is passed to the next processing node through a function call.

[0042] Because there is a lot of table data on the disk, and the query operator function only passes 1024 pieces of table data to the target function each time, it is necessary to loop through the disk to read the data until all the table data related to the query keywords is retrieved from the disk.

[0043] Step S230: The target function is called sequentially to calculate and process each of the table data vectors to obtain the output vector corresponding to each of the table data vectors, wherein the output vector includes the preset number of output data.

[0044] Specifically, the query operator function is a child node of the target function. The target function performs calculations on the received table data vector according to the corresponding calculation logic to obtain the output data vector corresponding to the table data vector, that is, 1024 output data. Compared with the existing technology, which only performs calculations on one data record at a time, the target function is called once to perform calculations on 1024 table data, which reduces the number of times the target function is called.

[0045] Step S240: Send each of the output vectors to the client 110 in sequence.

[0046] Specifically, the output vector is used to indicate the database's execution result for the business SQL statement, and the output vector is returned to the client 110 to be displayed to the user. Since the calculation and processing are performed on a table data vector each time, compared to the existing technology of calculating and processing a single row of data, the amount of data calculated at one time is increased, which can reduce the number of repetitive executions and reduce the overhead of function calls.

[0047] The idea behind vectorized execution mode is to amortize overhead: assuming the overhead of executing a row of data to generate the corresponding result each time through the operator tree in the database is C, the total overhead of the traditional OLTP execution engine's computation framework is C*N, where N is the total number of rows involved in the computation. If the computation engine is changed from executing a row of data each time to executing a batch of data each time, since the overhead of each call is relatively constant, the total overhead of the execution engine can be reduced to C*N / M, where M is the number of rows in each batch of data. In this way, the overhead of each row is reduced to 1 / M of the original. When M is relatively large, the overhead of batch execution of the computation framework will not become a system bottleneck.

[0048] In one embodiment, upon receiving a service request initiated by client 110, determining the service execution mode corresponding to the service request includes:

[0049] Upon receiving a service request initiated by client 110, the service execution mode corresponding to the service request is determined based on the data volume of the service request; or,

[0050] Upon receiving a service request initiated by client 110, the service execution mode corresponding to the service request is determined based on the on / off state of the vectorized execution mode.

[0051] Specifically, the business execution mode can be automatically determined based on the amount of data in the business request. For business requests with a large amount of data, the vectorized execution mode is selected as the business execution mode, while for business requests with a small amount of data, the single-line data execution mode is selected as the business execution mode. Alternatively, the business execution mode can be determined based on the on / off status of the vectorized execution mode.

[0052] The final business execution mode can also be determined by combining the two methods mentioned above. Each method has a corresponding execution priority. For example, the execution priority of the business execution mode can be determined as the first priority based on the amount of data requested, and as the second priority based on the on / off state of the vectorized execution mode. If the first priority is higher than the second priority, it is determined whether the amount of data requested is large. If the amount of data requested is large, the on / off state of the vectorized execution mode is automatically updated. If the on / off state of the vectorized execution mode supports the execution of business SQL statements, the business SQL statements are executed according to the vectorized execution mode. If the amount of data requested is small, the on / off state of the vectorized execution mode is not updated, and the single-row data execution mode is used as the business execution mode.

[0053] If the first priority is lower than the second priority, then only when the vectorized execution mode is enabled and supports the execution of business SQL statements in the vectorized execution mode will the decision on whether to execute the business request in the vectorized execution mode be further made based on the amount of data in the business request. That is, when the vectorized execution mode is enabled and the amount of data in the business request is large, the vectorized execution mode will be used as the business execution mode for the business request.

[0054] In one embodiment, determining the business execution mode corresponding to the business request based on the data volume of the business request includes:

[0055] If the data volume of the service request is greater than or equal to a data volume threshold, the service execution mode corresponding to the service request is determined to be a vectorized execution mode; or,

[0056] If the data volume of the business request is less than the data volume threshold, the business execution mode corresponding to the business request is determined to be the single-line data execution mode.

[0057] Specifically, the data volume threshold is a standard value indicating whether the data volume of a business request is too large. The data volume threshold can be customized according to the application scenario requirements. If the data volume of a business request is greater than the data volume threshold, it means that the number of repetitive executions required to execute the business request is large, so vectorized batch execution of the business request is required. Therefore, the vectorized execution mode is used as the business execution mode. If the data volume of a business request is less than the data volume threshold, it means that the number of repetitive executions required to execute the business request is small, so batch execution of the business request is not required. Therefore, the single-row data execution mode is used as the business execution mode.

[0058] In one embodiment, determining the business execution mode corresponding to the business request based on the on / off state of the vectorized execution mode includes:

[0059] When the vectorized execution mode is enabled, the service execution mode corresponding to the service request is determined to be the vectorized execution mode; or,

[0060] When the vectorized execution mode is turned off, the business execution mode corresponding to the business request is determined to be the single-line data execution mode.

[0061] Specifically, when the vectorized execution mode is enabled, it means that business requests can be executed in batches according to the vectorized execution mode, so the vectorized execution mode is used as the business execution mode; when the vectorized execution mode is disabled, it means that business requests cannot be executed in batches according to the vectorized execution mode, and can only be executed one data record at a time according to the single-row data execution mode, so the single-row data execution mode is used as the business execution mode.

[0062] In one embodiment, the request information further includes a first filtering condition, a second filtering condition, and a target expression. The target function includes a first type of operator function and a second type of operator function. The step of sequentially calling the target function to calculate and process each of the table data vectors to obtain the output vector corresponding to each of the table data vectors includes:

[0063] The first type of operator function is called to perform row filtering on the table data vector according to the first filtering condition to obtain the first filtering vector corresponding to the table data vector, wherein the first filtering vector includes the preset number of first filtering data;

[0064] The second type of operator function is called to perform column filtering on the first filtering vector according to the second filtering condition to obtain the second filtering vector corresponding to the first filtering vector, wherein the second filtering vector includes the preset number of second filtering data;

[0065] The second filtered data is processed according to the target expression to obtain the output data corresponding to the second filtered data.

[0066] Specifically, such as Figure 4 As shown, the first type of operator function is denoted as select. The query operator function is a child node of the first type of operator function. The first type of operator function is called by calling the function. The first type of operator function performs row filtering processing on the table data vector according to the first filtering condition. The first filtering condition is used to perform horizontal splitting processing on the table data. Data in each table data that meets the first filtering condition is used as the first filtering data. For example, if the first filtering condition is Age>30, then the data in each table data with Age>30 will be filtered. That is, the rows of data in the table data with age greater than 30 are used as the first filtering data. The 1024 first filtering data are formed into a first filtering vector and passed to the next processing node by calling the function.

[0067] The second type of operator function is denoted as Project. The first type of operator function is a child node of the second type of operator function. That is, the first type of operator function passes the first filtering vector to the second type of operator function. The second type of operator function performs column filtering processing on each first filtering data in the first filtering vector according to the second filtering condition. In other words, the second type of operator function performs vertical partitioning processing on the first filtering vector according to the second filtering condition, and takes the first filtering data in the first filtering vector that meets the second filtering condition as the second filtering data. The second filtering condition includes multiple filtering dimensions. To facilitate vectorized calculation, the second filtering vector is transformed into a structure containing multiple tuples (data records), which is represented by VectorTableSlot. It is not actually a simple combination of elements, but a vertical partitioning of the data, with each column of data placed together. Data in the same column organized together is called a column vector, represented by ColumnVector.

[0068] For example, the second filtering conditions include tag ID, name, and age. Multiple columns of second-filter data are selected from the first filtering vector according to these filtering dimensions. Second-filter data with the same column are called column vectors. The second-filter data is then substituted into the target expression for calculation. Before this, the expression execution engine needs to be adjusted to match the calculation function corresponding to the expression. Simple calculation functions can be explicitly vectorized using SIMD. The expression execution engine calculates the output data corresponding to the second-filter data according to the target expression. For example, if the target expression is Bonus = (Age - 30) * 50, then the second-filter data with age as the filtering dimension is substituted into the target expression to calculate the corresponding output data. The second type of operator function performs batch filtering on multiple first-filter data and calculates the target expression, forming an output vector of 1024 output data and returning it to the client 110. In this process, the number of function calls for both the filtering and calculation processes is less than the number of function calls in existing technologies. Therefore, the above process reduces the execution overhead of business SQL statements compared to existing technologies.

[0069] In one embodiment, after calling the first type of operator function to perform row filtering processing on the table data vector according to the first filtering condition to obtain the first filtered vector corresponding to the table data vector, the method further includes:

[0070] Determine the support status of the second type of operator function for the vectorized execution mode;

[0071] When the support status is "supported", the step of calling the second type of operator function to perform column filtering on the first filtering vector according to the second filtering condition is executed to obtain the second filtering vector corresponding to the first filtering vector; or,

[0072] If the support status is not supported, the vector transformer is called to convert the first filter vector into a first filter record indicating single row data, and the first filter record is used as the first filter vector to perform column filtering processing on the first filter vector according to the second filter condition to obtain the second filter data corresponding to the first filter vector.

[0073] Specifically, different operator functions in the database may have different levels of support for vectorized execution mode. The support status of an operator function for vectorized execution mode includes "support" and "no support". "Support" means that the operator function can batch execute multiple rows of data records, while "no support" means that the operator function cannot batch execute multiple rows of data records and can only execute a single row of data records at a time. Therefore, before calling the operator function corresponding to the next processing node by calling the function, it is necessary to first check the support status of the operator function corresponding to the next processing node for vectorized execution mode. That is, before calling the second type of operator function, it is necessary to determine the support status of the second type of operator function for vectorized execution mode. If the support status is "support", it means that the second type of operator function supports batch data execution and can receive data vectors. Then, the step of calling the second type of operator function to perform batch column filtering processing on the first filter vector according to the second filtering condition to obtain the second filter vector corresponding to the first filter vector is executed. If the support status is "not supported," it means that the second type of operator function cannot perform batch data execution and cannot receive data vectors; it only supports single-row data execution. In this case, the first type of operator function cannot directly pass the first filtering vector to the second type of operator function by calling the function. It needs to call the vector converter (VectorConvert) to transform the first filtering vector to generate the first filtering record indicating single-row data. Then, the first filtering record is passed to the second type of operator function. The second type of operator function performs column filtering on the first filtering record according to the second filtering condition to obtain the second filtering data corresponding to the first filtering record. In addition, the second type of operator function also calculates and processes the second filtering data according to the target expression to obtain the output data corresponding to the second filtering data. That is, when the second type of operator function does not support batch data execution, it processes the data in the manner of single-row data execution.

[0074] Similarly, before calling the first type of operator function, it is necessary to determine its support status for vectorized execution mode. If the first type of operator function supports vectorized execution mode, it is called to perform batch data processing. If it does not support vectorized execution mode, a vector converter is called to convert the data vector into a data record indicating a single row of data before the first type of operator function is called to execute the single row of data. Neither the execution of a single row of data nor the batch execution of multiple rows interferes with the business logic of the operator function; the only difference lies in the size of the data processed in a single execution.

[0075] Data is batch-cached using data vectors and then distributed to vectorized execution operators at each layer. These vectorized operators process the data, improving efficiency. A vector transformer enables the SQL execution engine to automatically switch between vectorized and single-row data processing. The overall process is similar to traditional OLTP execution engines, but the main difference lies in the execution granularity, which changes from a single tuple (data record) to a vector (multiple data records). This significantly reduces the number of function calls, and compiler optimizations can be used to improve CPU efficiency when performing loop calculations on a vector.

[0076] In one embodiment, the step of calculating and processing the second filtered data according to the target expression to obtain the output data corresponding to the second filtered data includes:

[0077] The preset amount of second-filtered data is evenly distributed among multiple calculation threads;

[0078] Each of the aforementioned calculation threads performs calculations on the allocated second-filtered data according to the target expression to obtain the output data corresponding to the second-filtered data.

[0079] Specifically, when processing the second filtered data according to the target expression, since the server 120 contains a multi-core processor, each core processor corresponds to a computing thread. The preset number of second filtered data in the second filtered vector is evenly distributed to each computing thread, allowing multiple computing threads to simultaneously process the received second filtered data according to the target expression. This speeds up the calculation process and obtains the output data corresponding to each second filtered data. Compared to relying on a single computing thread to pipeline and sequentially calculate the output data corresponding to each second filtered data, this improves the calculation efficiency.

[0080] In one specific embodiment, the first type of operator function includes a variety of different operator functions, and the hash list operator function is one type of first type operator function. This will be illustrated using the vectorized computation of the hash list operator function as an example:

[0081] 1. Call the query operator function to obtain the query inner table (Scan inner table) and query outer table (Scan outer table), construct the vector hash function (MultiExecVectorHash(HashState*node)), and use this vector hash function to perform batch hash calculation on the tuple vector in the query inner table to obtain the hash value and hash bucket value corresponding to each tuple.

[0082] 2. Construct a hash table based on the hash values ​​corresponding to each tuple in the query table.

[0083] 3. Similarly, use the vector hash function to perform batch hash calculation on the query table to obtain the hash value and hash bucket value corresponding to each tuple in the query table, and construct a hash table based on the hash value corresponding to each tuple in the query table.

[0084] 4. Perform a batch matching operation between the hash table corresponding to the query outer table and the hash table corresponding to the query inner table. Mark the tuples whose hash values ​​match in both hash tables to obtain the hash values ​​corresponding to multiple marked tuples.

[0085] 5. If the second type of operator function does not support vectorized execution mode, the vector transformer is called to convert the hash values ​​corresponding to multiple tag tuples into tuple data indicating single row data according to the tag array. Then, the tuple data is passed to the second type of operator function (Project) for corresponding operations and output to the client 110 (User).

[0086] Embedding a vectorized execution engine within a traditional OLTP execution engine, and enabling vectorized execution mode, allows for dynamic switching via the on / off state of the vectorized execution engine. This achieves compatibility with the original single-row data execution engine of traditional databases and enables...

[0087] To achieve complete transparency to the business, the execution results of 5 are consistent regardless of whether it is single-row data execution or vectorized batch execution, and will not interfere with or affect the business layer.

[0088] Figure 2 and Figure 4 This is a flowchart illustrating a database business processing method in one embodiment. It should be understood that, although... Figure 2 and Figure 4 The steps in the flowchart are shown sequentially according to the arrows, but these steps are not necessarily executed in the order indicated by the arrows.

[0089] Unless otherwise specified herein, there is no strict order in which these steps are performed; they can be performed in any other order. Figure 2 and Figure 4 at least part of

[0090] A step may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but may be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but may be executed in turn or alternately with other steps or at least a portion of the sub-steps or stages of other steps.

[0091] 5. In one embodiment, such as Figure 5 As shown, a database business processing device is provided.

[0092] include:

[0093] The parsing module 310 is used to determine the request information, target function, and business execution mode corresponding to the business request upon receiving a business request initiated by the client 110.

[0094] In the request information, the query keywords are included;

[0095] Query module 320 is used when the business execution mode is vectorized execution mode.

[0096] Next, according to the query keywords, the disk is traversed in a loop, and the table data vectors corresponding to the query keywords are retrieved in sequence, wherein the table data vectors include a preset number of table data;

[0097] Processing module 330 is used to sequentially call the target function to perform calculations on each of the table data vectors to obtain the output vectors corresponding to each of the table data vectors, wherein the output vectors include the preset number of output data;

[0098] The sending module 340 is used to sequentially send each of the output vectors to the client 110.

[0099] In one embodiment, the parsing module 310 is further configured to:

[0100] Upon receiving a service request initiated by client 110, the service execution mode corresponding to the service request is determined based on the data volume of the service request; or,

[0101] Upon receiving a service request initiated by client 110, the service execution mode corresponding to the service request is determined based on the on / off state of the vectorized execution mode.

[0102] In one embodiment, the parsing module 310 is further configured to:

[0103] If the data volume of the service request is greater than or equal to a data volume threshold, the service execution mode corresponding to the service request is determined to be a vectorized execution mode; or,

[0104] If the data volume of the business request is less than the data volume threshold, the business execution mode corresponding to the business request is determined to be the single-line data execution mode.

[0105] In one embodiment, the parsing module 310 is further configured to:

[0106] When the vectorized execution mode is enabled, the service execution mode corresponding to the service request is determined to be the vectorized execution mode; or,

[0107] When the vectorized execution mode is turned off, the business execution mode corresponding to the business request is determined to be the single-line data execution mode.

[0108] In one embodiment, the processing module 330 is further configured to:

[0109] The first type of operator function is called to perform row filtering on the table data vector according to the first filtering condition to obtain the first filtering vector corresponding to the table data vector, wherein the first filtering vector includes the preset number of first filtering data;

[0110] The second type of operator function is called to perform column filtering on the first filtering vector according to the second filtering condition to obtain the second filtering vector corresponding to the first filtering vector, wherein the second filtering vector includes the preset number of second filtering data;

[0111] The second filtered data is processed according to the target expression to obtain the output data corresponding to the second filtered data.

[0112] In one embodiment, the processing module 330 is further configured to:

[0113] Determine the support status of the second type of operator function for the vectorized execution mode;

[0114] When the support status is "supported", the step of calling the second type of operator function to perform column filtering on the first filtering vector according to the second filtering condition is executed to obtain the second filtering vector corresponding to the first filtering vector; or,

[0115] If the support status is not supported, the vector transformer is called to convert the first filter vector into a first filter record indicating single row data, and the first filter record is used as the first filter vector to perform column filtering processing on the first filter vector according to the second filter condition to obtain the second filter data corresponding to the first filter vector.

[0116] In one embodiment, the processing module 330 is further configured to:

[0117] The preset amount of second-filtered data is evenly distributed among multiple calculation threads;

[0118] Each of the aforementioned calculation threads performs calculations on the allocated second-filtered data according to the target expression to obtain the output data corresponding to the second-filtered data.

[0119] Figure 6An internal structural diagram of a computer device in one embodiment is shown. Specifically, this computer device may be... Figure 1 Server 120 in the middle. For example... Figure 6 As shown, the computer device includes a processor, memory, network interface, input device, and display screen connected via a system bus. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and may also store computer programs. When executed by the processor, these computer programs enable the processor to perform database business processing methods. The internal memory may also store computer programs, which, when executed by the processor, enable the processor to perform database business processing methods. The display screen can be an LCD screen or an e-ink screen. The input device can be a touch layer covering the display screen, buttons, a trackball, or a touchpad mounted on the computer device's casing, or an external keyboard, touchpad, or mouse.

[0120] Those skilled in the art will understand that Figure 6 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0121] In one embodiment, the database service processing apparatus provided in this application can be implemented as a computer program, and the computer program can be implemented in the form of, for example, Figure 6 It runs on the computer device shown. The computer device's memory can store the various program modules that make up the database business processing device, for example, Figure 5 The parsing module 310, query module 320, processing module 330, and sending module 340 are shown. The computer program comprised of these modules causes the processor to execute the steps of the database business processing methods in the various embodiments of this application described in this specification.

[0122] Figure 6 The computer equipment shown can be used as follows Figure 5In the database business processing device shown, the parsing module 310, upon receiving a business request initiated by the client 110, determines the request information, objective function, and business execution mode corresponding to the business request. The request information includes query keywords. The computer device, through the query module 320, when the business execution mode is vectorized execution mode, iterates through the disk according to the query keywords, sequentially retrieving table data vectors corresponding to the query keywords. Each table data vector includes a preset number of table data. The computer device, through the processing module 330, sequentially calls the objective function to calculate and process each table data vector, obtaining an output vector corresponding to each table data vector. Each output vector includes the preset number of output data. The computer device, through the sending module 340, sequentially sends each output vector to the client 110.

[0123] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the method described in any of the above embodiments.

[0124] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the method described in any of the above embodiments.

[0125] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double-rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and RAMbus dynamic RAM (RDRAM), etc.

[0126] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0127] The above description is merely a specific embodiment of the present invention, enabling those skilled in the art to understand or implement the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the present invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features claimed herein.

Claims

1. A database business processing method, characterized in that, The method includes: Upon receiving a business request initiated by a client, the request information, target function, and business execution mode corresponding to the business request are determined, wherein the request information includes query keywords; When the business execution mode is vectorized execution mode, the system iterates through the disk according to the query keywords and retrieves the table data vectors corresponding to the query keywords in turn. The table data vectors include a preset number of table data. The target function is called sequentially to calculate and process each of the table data vectors to obtain the output vector corresponding to each of the table data vectors, wherein the output vector includes the preset number of output data; Each of the output vectors is sent to the client in sequence; The request information also includes a first filtering condition, a second filtering condition, and a target expression. The target function includes a first type of operator function and a second type of operator function. The step of sequentially calling the target function to calculate and process each of the table data vectors to obtain the output vector corresponding to each of the table data vectors includes: The first type of operator function is called to perform row filtering on the table data vector according to the first filtering condition to obtain the first filtering vector corresponding to the table data vector, wherein the first filtering vector includes the preset number of first filtering data; The second type of operator function is called to perform column filtering on the first filtering vector according to the second filtering condition to obtain the second filtering vector corresponding to the first filtering vector, wherein the second filtering vector includes the preset number of second filtering data; The second filtered data is processed according to the target expression to obtain the output data corresponding to the second filtered data.

2. The method according to claim 1, characterized in that, Upon receiving a business request from a client, determine the business execution mode corresponding to the business request, including: Upon receiving a business request from a client, the business execution mode corresponding to the business request is determined based on the data volume of the business request; or, Upon receiving a business request initiated by a client, the business execution mode corresponding to the business request is determined based on the on / off state of the vectorized execution mode.

3. The method according to claim 2, characterized in that, Determining the business execution mode corresponding to the business request based on the data volume of the business request includes: If the data volume of the service request is greater than or equal to a data volume threshold, the service execution mode corresponding to the service request is determined to be a vectorized execution mode; or, If the data volume of the business request is less than the data volume threshold, the business execution mode corresponding to the business request is determined to be the single-line data execution mode.

4. The method according to claim 2, characterized in that, Determining the business execution mode corresponding to the business request based on the on / off state of the vectorized execution mode includes: When the vectorized execution mode is enabled, the service execution mode corresponding to the service request is determined to be the vectorized execution mode; or, When the vectorized execution mode is turned off, the business execution mode corresponding to the business request is determined to be the single-line data execution mode.

5. The method according to claim 1, characterized in that, After calling the first type of operator function to perform row filtering on the table data vector according to the first filtering condition to obtain the first filtering vector corresponding to the table data vector, the method further includes: Determine the support status of the second type of operator function for the vectorized execution mode; When the support status is "supported", the step of calling the second type of operator function to perform column filtering on the first filtering vector according to the second filtering condition is executed to obtain the second filtering vector corresponding to the first filtering vector; or, If the support status is not supported, the vector transformer is called to convert the first filter vector into a first filter record indicating single row data, and the first filter record is used as the first filter vector to perform column filtering processing on the first filter vector according to the second filter condition to obtain the second filter data corresponding to the first filter vector.

6. The method according to claim 1, characterized in that, The step of calculating and processing the second filtered data according to the target expression to obtain the output data corresponding to the second filtered data includes: The preset amount of second-filtered data is evenly distributed among multiple calculation threads; Each of the aforementioned calculation threads performs calculations on the allocated second-filtered data according to the target expression to obtain the output data corresponding to the second-filtered data.

7. A database business processing device, characterized in that, The device includes: The parsing module is used to determine the request information, target function, and business execution mode corresponding to the business request when a business request is received from a client, wherein the request information includes query keywords; The query module is used to, when the business execution mode is vectorized execution mode, traverse the disk according to the query keywords and sequentially retrieve the table data vectors corresponding to the query keywords, wherein the table data vectors include a preset number of table data. The processing module is used to sequentially call the target function to perform calculations on each of the table data vectors to obtain the output vector corresponding to each of the table data vectors, wherein the output vector includes the preset number of output data; The sending module is used to sequentially send each of the output vectors to the client; The request information also includes a first filtering condition, a second filtering condition, and a target expression. The target function includes a first type of operator function and a second type of operator function. The step of sequentially calling the target function to calculate and process each of the table data vectors to obtain the output vector corresponding to each of the table data vectors includes: The first type of operator function is called to perform row filtering on the table data vector according to the first filtering condition to obtain the first filtering vector corresponding to the table data vector, wherein the first filtering vector includes the preset number of first filtering data; The second type of operator function is called to perform column filtering on the first filtering vector according to the second filtering condition to obtain the second filtering vector corresponding to the first filtering vector, wherein the second filtering vector includes the preset number of second filtering data; The second filtered data is processed according to the target expression to obtain the output data corresponding to the second filtered data.

8. A computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 6.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Data processing method and device, storage medium and server

    CN110378680A