A data processing system and method based on relational database

By introducing data calculation module and parallel request processing mechanism into relational databases, the problem of low response efficiency of databases when large-scale data requests is solved, and more efficient data processing and response are achieved.

CN118964501BInactive Publication Date: 2024-12-31FUJIAN URBAN CONSTR INTELLIGENT CONTROL TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202411449441.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-10-17
Publication Date
2024-12-31
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

Existing relational databases are inefficient in response to huge data requests and are difficult to process efficiently.

Method used

A data processing system based on a relational database is designed, including a data calculation module, a judgment module and a data acquisition module. By calculating the expected time of data request, it will be converted into a set of parallel request instructions if the threshold is exceeded, and multithreading is used to cache it from pre-cache. Get data from popular data and process execution failed instructions in the set of parallel request instructions.

Benefits of technology

It improves the database's response efficiency when facing large-scale data requests, reduces resource consumption, and ensures user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118964501B_ABST
    Figure CN118964501B_ABST
Patent Text Reader

Abstract

The present invention relates to database data processing technology, and discloses a data processing system and method based on a relational database, including: confirming target request data information according to a received data request instruction, calculating the expected time of the data request according to the target request data information, if the expected time of the data request is less than or equal to a preset threshold, obtaining the first target data according to the data request instruction and sending it to the client, otherwise converting the data request instruction into a parallel request instruction set, obtaining the second target data from the pre-cached hot data according to the parallel request instruction set, if all request instructions in the parallel request instruction set are successfully executed, then sending the second target data to the client, otherwise obtaining the execution failure instruction set, obtaining the remaining target data from the database according to the execution failure instruction set, and merging the second target data with the remaining target data into the third target data and sending it to the client. The present invention can improve the database response efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of database data processing, and in particular to a data processing system and method based on a relational database. Background Art

[0002] With the rapid development of information technology, data has become the core asset of enterprises and social operations. With the advent of the big data era, the demand for data collection, storage, processing and analysis in all walks of life is growing, especially in the fields of finance, medical care, e-commerce, logistics, etc. Efficient and accurate processing of massive data is crucial for business decision-making, service optimization and innovation. As one of the mainstream technologies for data storage and management, relational databases play an irreplaceable role in many application scenarios with their strong data consistency guarantee, transaction processing capabilities and easy-to-understand data models (such as table structures).

[0003] However, with the explosive growth of data volume, existing relational database data processing methods are difficult to respond efficiently to the huge amount of data requests and have low response efficiency. Summary of the invention

[0004] The present invention provides a data processing system and method based on a relational database, the main purpose of which is to solve the problem of low response efficiency of existing relational database data processing methods when facing a huge amount of data requests.

[0005] To achieve the above object, the present invention provides a data processing system based on a relational database, characterized in that the system includes a data calculation module, a first judgment module, a data acquisition module and a second judgment module, wherein:

[0006] The data calculation module is used to, after receiving a data request instruction from a preset client, confirm the data table information where the requested data is located according to the data request instruction, confirm the row information of the requested data in each data table according to the data request instruction, confirm the column information of the requested data in each data table according to the data request instruction, confirm the data item information of the requested data in each data table according to the data request instruction, summarize the data table information, row information, column information and data item information to obtain target request data information, and calculate the expected time of the data request according to the target request data information using the following formula: ;

[0007] in, the expected time for said data request, Indicates the number of data tables included in the target request data information, Indicates the target request data information The number of rows in the requested data table. Indicates the target request data information The number of columns in the requested data table. Indicates the target request data information The number of data items contained in the request data in the data table, K is a predetermined adjustment coefficient, B is a predetermined response time bias term, and R is a predetermined processing performance parameter;

[0008] The first judgment module is used to judge whether the expected time of the data request is greater than a preset time threshold; if the expected time of the data request is less than or equal to the preset time threshold, obtain the first target data from the database according to the data request instruction, and send the first target data to the preset client; if the expected time of the data request is greater than the time threshold, convert the data request instruction into a parallel request instruction set;

[0009] The data acquisition module is used to create multiple threads, and use the multiple threads to acquire the second target data from the pre-cached hot data according to the parallel request instruction set;

[0010] The second judgment module is used to judge whether all request instructions in the parallel request instruction set have been successfully executed. If all request instructions in the parallel request instruction set have been successfully executed, the second target data is sent to the preset client. If there are request instructions that have not been successfully executed in the parallel request instruction set, all request instructions that have not been successfully executed in the parallel request instruction set are obtained to obtain a failed execution instruction set, and the remaining target data is obtained from the database according to the failed execution instruction set using multi-threading, the second target data is merged with the remaining target data to obtain third target data, and the third target data is sent to the preset client.

[0011] Optionally, when converting the data request instruction into a parallel request instruction set, the first determination module is specifically configured to include:

[0012] Identifying a data table object in the data request instruction;

[0013] identifying a connection statement in the data request instruction;

[0014] Identifying a query condition statement in the data request instruction;

[0015] According to the data table object, the connection statement, and the query condition statement, the data request instruction is decomposed and recombined into multiple query statements for querying a single data table to obtain a parallel request instruction set.

[0016] Optionally, when the data acquisition module acquires the second target data from the pre-cached hot data according to the parallel request instruction set using multithreading, it is specifically used to:

[0017] and concurrently executing the query statements in the parallel request instructions using the hot data as the query range to obtain query statement execution results;

[0018] Obtain the query feedback and query result data contained in the execution result of each query statement;

[0019] Summarize the query feedback contained in each execution result to obtain a query feedback set;

[0020] The query result data included in each execution result is aggregated to obtain the second target data.

[0021] Optionally, before the data acquisition module acquires the second target data from the pre-cached hot data according to the parallel request instruction set by using multiple threads, it is further configured to:

[0022] Get the number of recent accesses to each data table in the database;

[0023] Sort all data tables in the database in descending order according to the recent access times to obtain a data table sequence;

[0024] A preset number of data tables in the data table sequence are preferably selected to obtain hot data.

[0025] Optionally, when determining whether all request instructions in the parallel request instruction set have been executed successfully, the second determination module is specifically configured to:

[0026] Determine whether the query feedback set is empty;

[0027] If the query feedback set is empty, it is determined that all request instructions in the parallel request instruction set have been executed;

[0028] If the query feedback set is not empty, it is determined that there are unsuccessfully executed request instructions in the parallel request instruction set.

[0029] Optionally, when the second judgment module obtains all unsuccessfully executed request instructions in the parallel request instruction set to obtain the execution failure instruction set, it is specifically configured to:

[0030] Obtaining all query failure feedbacks in the query feedback set to obtain a query failure feedback set;

[0031] All execution failed instructions in the parallel request instruction set are confirmed according to the query failure feedback set to obtain an execution failed instruction set.

[0032] Optionally, when the second judgment module uses multithreading to obtain the remaining target data from the database according to the failed execution instruction set and merges the second target data with the remaining target data to obtain the third target data, it is specifically used to:

[0033] Utilizing multiple threads to concurrently execute the failed query instructions in the failed instruction set to obtain a query result for each failed query instruction;

[0034] Summarize the query results of each failed query command to obtain the remaining target data;

[0035] A preset order is confirmed according to the parallel request instruction set, and the second target data and the remaining target data are merged according to the preset order to obtain third target data.

[0036] In order to solve the above problems, the present invention also provides a data processing method based on a relational database, the method comprising:

[0037] After receiving the data request instruction of the preset client, confirm the data table information where the requested data is located according to the data request instruction, confirm the row information of the requested data in each data table according to the data request instruction, confirm the column information of the requested data in each data table according to the data request instruction, confirm the data item information of the requested data in each data table according to the data request instruction, summarize the data table information, row information, column information and data item information, and obtain the target requested data information;

[0038] The expected time of the data request is calculated according to the target request data information using the following formula: ;

[0039] in, the expected time for said data request, Indicates the number of data tables included in the target request data information, Indicates the target request data information The number of rows in the requested data table. Indicates the target request data information The number of columns in the requested data table. Indicates the target request data information The number of data items contained in the request data in the data table, K is a predetermined adjustment coefficient, B is a predetermined response time bias term, and R is a predetermined processing performance parameter;

[0040] Determine whether the expected time of the data request is greater than a preset time threshold;

[0041] If the expected time of the data request is less than or equal to the preset time threshold, obtaining the first target data from the database according to the data request instruction, and sending the first target data to the preset client;

[0042] If the expected time of the data request is greater than the time threshold, converting the data request instruction into a parallel request instruction set;

[0043] Creating multiple threads, and using the multiple threads to obtain the second target data from the pre-cached hot data according to the parallel request instruction set;

[0044] Determining whether all request instructions in the parallel request instruction set have been executed successfully;

[0045] If all request instructions in the parallel request instruction set have been executed successfully, sending the second target data to a preset client;

[0046] If there are unsuccessfully executed request instructions in the parallel request instruction set, all unsuccessfully executed request instructions in the parallel request instruction set are obtained to obtain a failed execution instruction set, and the remaining target data is obtained from the database according to the failed execution instruction set using multi-threading, the second target data is merged with the remaining target data to obtain third target data, and the third target data is sent to a preset client.

[0047] After receiving a data request instruction from a preset client, the embodiment of the present invention confirms target request data information according to the data request instruction, calculates the data request expected time according to the target request data information, and determines whether the data request expected time is greater than a preset time threshold. If the data request expected time is less than or equal to the preset time threshold, the first target data is obtained from the database according to the data request instruction, and the first target data is sent to the preset client. If the data request expected time is greater than the time threshold, the data request instruction is converted into a parallel request instruction set, and multiple threads are created. The multithreading is used to obtain the data from the preset client according to the parallel request instruction set. Obtain the second target data from the cached hot data, determine whether all request instructions in the parallel request instruction set have been successfully executed, if all request instructions in the parallel request instruction set have been successfully executed, then send the second target data to the preset client, if there are unsuccessful request instructions in the parallel request instruction set, then obtain all unsuccessful request instructions in the parallel request instruction set to obtain a failed execution instruction set, use multi-threading to obtain the remaining target data from the database according to the failed execution instruction set, merge the second target data with the remaining target data to obtain the third target data, and send the third target data to the preset client. Therefore, the data processing system and method based on a relational database proposed in the present invention can solve the problem of low response efficiency of existing relational database data processing methods when facing a huge amount of data requests. BRIEF DESCRIPTION OF THE DRAWINGS

[0048] Figure 1 A functional module diagram of a data processing system based on a relational database provided by one embodiment of the present invention;

[0049] Figure 2 A schematic diagram of a data processing method based on a relational database provided by an embodiment of the present invention;

[0050] Figure 3 A schematic diagram of the structure of an electronic device for implementing the data processing method based on a relational database provided by an embodiment of the present invention.

[0051] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0052] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.

[0053] The embodiment of the present application provides a data processing system based on a relational database. The execution subject of the data processing system based on a relational database includes but is not limited to at least one of the electronic devices such as a server, a terminal, etc. that can be configured to execute the method provided in the embodiment of the present application. In other words, the data processing system based on a relational database can be executed by software or hardware installed on a terminal device or a server device, and the software can be a blockchain platform. The server includes but is not limited to: a single server, a server cluster, a cloud server or a cloud server cluster, etc. The server can be an independent server, or it can be a cloud server that provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (Content Delivery Network, CDN), and basic cloud computing services such as big data and artificial intelligence platforms.

[0054] like Figure 1 , which is a functional module diagram of a data processing system based on a relational database provided by an embodiment of the present invention.

[0055] The data processing system 100 based on a relational database of the present invention can be arranged in a cloud server. In terms of implementation, it can be used as one or more service devices, or it can be installed as an application on the cloud (such as a server of a mobile service operator, a server cluster, etc.), or it can be developed as a website. According to the implemented functions. According to the implemented functions, the data processing system 100 based on a relational database may include a data calculation module 101, a first judgment module 102, a data acquisition module 103 and a second judgment module 104. The module of the present invention can also be referred to as a unit, which refers to a series of computer program segments that can be executed by a processor of an electronic device and can complete fixed functions, which are stored in the memory of the electronic device.

[0056] The following describes the various components and specific workflows of the cross-border distribution data analysis system based on multi-regional characteristic analysis in combination with specific embodiments:

[0057] The data calculation module 101 is used to, after receiving a data request instruction from a preset client, confirm the data table information where the requested data is located according to the data request instruction, confirm the row information of the requested data in each data table according to the data request instruction, confirm the column information of the requested data in each data table according to the data request instruction, confirm the data item information of the requested data in each data table according to the data request instruction, summarize the data table information, row information, column information and data item information to obtain target request data information, and calculate the expected time of the data request according to the target request data information using the following formula: ;

[0058] in, the expected time for said data request, Indicates the number of data tables included in the target request data information, Indicates the target request data information The number of rows in the requested data table. Indicates the target request data information The number of columns in the requested data table. Indicates the target request data information The number of data items contained in the request data in the data table, K is a predetermined adjustment coefficient, B is a predetermined response time bias term, and R is a predetermined processing performance parameter;

[0059] The first judgment module 102 is used to judge whether the expected time of the data request is greater than a preset time threshold. If the expected time of the data request is less than or equal to the preset time threshold, the first target data is obtained from the database according to the data request instruction, and the first target data is sent to the preset client. If the expected time of the data request is greater than the time threshold, the data request instruction is converted into a parallel request instruction set;

[0060] The data acquisition module 103 is used to create multiple threads, and use the multiple threads to acquire the second target data from the pre-cached hot data according to the parallel request instruction set;

[0061] The second judgment module 104 is used to judge whether all request instructions in the parallel request instruction set have been successfully executed. If all request instructions in the parallel request instruction set have been successfully executed, the second target data is sent to the preset client. If there are request instructions that have not been successfully executed in the parallel request instruction set, all request instructions that have not been successfully executed in the parallel request instruction set are obtained to obtain a failed execution instruction set, and the remaining target data is obtained from the database according to the failed execution instruction set by using multi-threading, the second target data is merged with the remaining target data to obtain third target data, and the third target data is sent to the preset client.

[0062] The data calculation module 101 is used to, after receiving a data request instruction from a preset client, confirm the data table information where the requested data is located according to the data request instruction, confirm the row information of the requested data in each data table according to the data request instruction, confirm the column information of the requested data in each data table according to the data request instruction, confirm the data item information of the requested data in each data table according to the data request instruction, summarize the data table information, row information, column information and data item information, and obtain the target requested data information.

[0063] In the embodiment of the present invention, the data request instruction generally refers to a data request instruction for a database, which may be an SQL statement.

[0064] In detail, the SQL statement is a standard programming language for storing, manipulating and retrieving data in a database, including query data statements, insert data statements, update data statements and delete data statements.

[0065] In the embodiment of the present invention, confirming the target requested data information according to the data request instruction refers to confirming the data table information, row information, column information and data item information of the requested data according to the information included in the data request instruction.

[0066] In detail, the data table is the basic unit for storing data in the database. It consists of rows and columns. Columns define the type and attributes of data. For example, in the employee table ("employees"), there may be columns such as "employee number (integer type)", "name (string type)", and "department (string type)". Rows represent specific data records. Each row contains a combination of values ​​of each column in the table. For example, an employee record contains the number, name, and department information of a certain employee.

[0067] In detail, the row is also called a record. A row is a horizontal data element in a data table, which contains the values ​​of each column in the table. For example, a row in the "employees" table may contain values ​​such as "1001 (employee number)", "Zhang San (name)", "Sales Department (department)", etc. These values ​​together describe the relevant information of an employee entity.

[0068] In detail, the column is also called a field. A column is a vertical data element in a data table, which defines the data type (such as integer, string, date, etc.), length (if applicable), whether to allow null values, default values, and other properties. For example, the "Name" column in the "Employees" table may be defined as a string type with a length of 50 characters and no null values ​​allowed.

[0069] In detail, the data item is the smallest unit in the relational database storage structure, which is the data value at the intersection of a row and a column. For example, the specific value "Zhang San" in the "Name" column of a row in the "employees" table is a data item, which represents the name information of the employee.

[0070] In detail, the data table information includes the number of the data table where the requested data is located, the row information includes the number of rows where the requested data is located, the column information includes the number of columns where the requested data is located, and the information includes the number of data items of the requested data.

[0071] In the embodiment of the present invention, after receiving the data request instruction of the preset client, the target request data information is confirmed according to the data request instruction, thereby improving the efficiency of the subsequent calculation of the expected time of the request.

[0072] The data calculation module 101 is used to calculate the expected time of the data request using the following formula: ;

[0073] in, the expected time for said data request, Indicates the number of data tables included in the target request data information, Indicates the target request data information The number of rows in the requested data table. Indicates the target request data information The number of columns in the requested data table. Indicates the target request data information The number of data items contained in the request data in the data table, K is a predetermined adjustment coefficient, B is a predetermined response time bias item, and R is a predetermined processing performance parameter.

[0074] In the embodiment of the present invention, the calculation of the expected data request time according to the target request data information is to confirm the data volume of the request data according to the target request data information, and then calculate the expected time of a request response time according to the data volume.

[0075] In the embodiment of the present invention, when the data calculation module 101 calculates the expected time of the data request according to the target request data information, it is specifically used to:

[0076] In detail, the predetermined processing performance parameter is a coefficient reflecting the efficiency of the database in processing data, which needs to be obtained through measurement. The larger the processing performance parameter is, the shorter the expected time of the data request is.

[0077] In detail, the predetermined adjustment coefficient is a coefficient used to adjust the expected time size of the data request.

[0078] In detail, the predetermined response time offset item refers to a fixed response time that exists when the database processes a data request.

[0079] In the embodiment of the present invention, by calculating the expected time of the data request according to the target request data information, the efficiency of the subsequent determination of whether the expected time of the data request is greater than a preset time threshold is improved.

[0080] The first determination module 102 is configured to determine whether the expected time of the data request is greater than a preset time threshold.

[0081] If the expected time of the data request is less than or equal to the preset time threshold, the first target data is obtained from the database according to the data request instruction, and the first target data is sent to the preset client.

[0082] In the embodiment of the present invention, the preset time threshold is a threshold used to measure the speed of data request response time.

[0083] In an embodiment of the present invention, when the expected time of the data request is less than or equal to the preset time threshold, it means that the expected time of the data request is relatively short and meets the requirements. Therefore, the first target data is directly obtained from the database according to the data request instruction, and the first target data is sent to the preset client, which can ensure user experience and reduce computing resource consumption.

[0084] In the embodiment of the present invention, acquiring the first target data from the database according to the data request instruction refers to directly executing the data request instruction to request data from the database.

[0085] In an embodiment of the present invention, when the expected time of the data request is less than or equal to a preset time threshold, the first target data is obtained from the database according to the data request instruction and sent to a preset client, thereby reducing resource consumption while ensuring user experience.

[0086] If the expected time of the data request is greater than the time threshold, the data request instruction is converted into a parallel request instruction set.

[0087] In the embodiment of the present invention, converting the data request instruction into a set of parallel request instructions refers to converting the data request instruction into multiple instructions for requesting a single data table.

[0088] In the embodiment of the present invention, when the expected time of the data request is greater than the time threshold, it indicates that the expected time of the data request is too long. Therefore, using a conventional data request method to obtain data will cause the database response time to be too long, affecting the user experience.

[0089] In the embodiment of the present invention, when the first determination module 102 converts the data request instruction into a parallel request instruction set, it is specifically used to include:

[0090] Identifying a data table object in the data request instruction;

[0091] identifying a connection statement in the data request instruction;

[0092] Identifying a query condition statement in the data request instruction;

[0093] According to the data table object, the connection statement, and the query condition statement, the data request instruction is decomposed and recombined into multiple query statements for querying a single data table to obtain a parallel request instruction set.

[0094] In detail, the identifying of the data table object in the data request instruction is to confirm the data table object by identifying a keyword in a query statement, for example, the word "FROM" in the query statement is usually followed by the table name of the data table.

[0095] In detail, the identifying the connection statement in the data request instruction refers to identifying the connection statement used by the query statement to query multiple data tables, such as "INNER JOIN", "LEFT JOIN" and "LEFT OUTER JOIN".

[0096] In detail, the data request instruction is decomposed according to the data table object, the connection statement, and the query condition statement, and then recombined into multiple query statements for querying a single data table to obtain a parallel request instruction set. This means that the number of query statements that need to be converted is confirmed according to the connection statement and the data table object, and the query condition statement and the corresponding data table object are combined into a new query statement, and finally a parallel request instruction set is obtained for subsequent parallel processing.

[0097] In the embodiment of the present invention, when the expected time of the data request is greater than the time threshold, the efficiency of subsequent data requests is improved by converting the data request instruction into a parallel request instruction set.

[0098] The data acquisition module 103 is used to create multiple threads, and utilize the multiple threads to acquire the second target data from the pre-cached hot data according to the parallel request instruction set.

[0099] In the embodiment of the present invention, the creation of multiple threads is achieved by managing a thread pool, and different database systems have different creation methods.

[0100] In the embodiment of the present invention, the pre-cached hot data refers to confirming recent hot data according to the number of data accesses and then pre-caching the hot data. Since the amount of hot data is relatively small compared to the total amount of database data, the query efficiency can be improved to a certain extent.

[0101] In the embodiment of the present invention, the method of obtaining the second target data from the pre-cached hot data according to the parallel request instruction set using multiple threads is to obtain the second target data by executing the query statement in the request instruction set in the hot data.

[0102] In the embodiment of the present invention, when the data acquisition module 103 acquires the second target data from the pre-cached hot data according to the parallel request instruction set using multithreading, it is specifically used to:

[0103] and concurrently executing the query statements in the parallel request instructions using the hot data as the query range to obtain query statement execution results;

[0104] Obtain the query feedback and query result data contained in the execution result of each query statement;

[0105] Summarize the query feedback contained in each execution result to obtain a query feedback set;

[0106] The query result data included in each execution result is aggregated to obtain the second target data.

[0107] In the embodiment of the present invention, since the data queried by the query statements in the parallel request instruction set does not necessarily exist in the hot data, there may be a situation where some query statements fail to successfully query data and the query result data is empty.

[0108] In the embodiment of the present invention, the query feedback is data information including whether the query statement successfully finds data.

[0109] In the embodiment of the present invention, multiple threads are created and utilized to obtain the second target data from the pre-cached hot data according to the parallel request instruction set.

[0110] In the embodiment of the present invention, before the data acquisition module 103 acquires the second target data from the pre-cached hot data according to the parallel request instruction set by using multithreading, it is further used to:

[0111] Get the number of recent accesses to each data table in the database;

[0112] Sort all data tables in the database in descending order according to the recent access times to obtain a data table sequence;

[0113] A preset number of data tables in the data table sequence are preferably selected to obtain hot data.

[0114] In the embodiment of the present invention, by creating multiple threads, the second target data is obtained from the pre-cached hot data according to the parallel request instruction set using the multiple threads, thereby improving the efficiency of data query.

[0115] The second judgment module 104 is used to judge whether all request instructions in the parallel request instruction set have been successfully executed. If all request instructions in the parallel request instruction set have been successfully executed, the second target data is sent to the preset client. If there are request instructions that have not been successfully executed in the parallel request instruction set, all request instructions that have not been successfully executed in the parallel request instruction set are obtained to obtain a failed execution instruction set, and the remaining target data is obtained from the database according to the failed execution instruction set by using multi-threading, the second target data is merged with the remaining target data to obtain third target data, and the third target data is sent to the preset client.

[0116] In the embodiment of the present invention, the determination of whether all request instructions in the parallel request instruction set have been successfully executed is based on whether the query feedback set is empty.

[0117] In the embodiment of the present invention, when determining whether all request instructions in the parallel request instruction set have been successfully executed, the second determination module 104 is specifically configured to:

[0118] Determine whether the query feedback set is empty;

[0119] If the query feedback set is empty, it is determined that all request instructions in the parallel request instruction set have been executed;

[0120] If the query feedback set is not empty, it is determined that there are unsuccessfully executed request instructions in the parallel request instruction set.

[0121] In an embodiment of the present invention, when it is determined whether all request instructions in the parallel request instruction set have been executed successfully, it means that the data requested by all request instructions in the parallel request instruction set are included in the hot data, so the second target data can be directly sent to the preset client.

[0122] In the embodiment of the present invention, when all request instructions in the parallel request instruction set have been executed successfully, the response efficiency of the database is improved by sending the second target data to the preset client.

[0123] In an embodiment of the present invention, when there are unsuccessfully executed request instructions in the parallel request instruction set, it means that the hot data does not contain all the data requested by all the request instructions in the parallel request instruction set, and therefore further data requests are required based on the unsuccessfully executed instructions.

[0124] In the embodiment of the present invention, when the second judgment module 104 obtains all unsuccessfully executed request instructions in the parallel request instruction set to obtain the execution failure instruction set, it is specifically used to:

[0125] Obtaining all query failure feedbacks in the query feedback set to obtain a query failure feedback set;

[0126] All execution failed instructions in the parallel request instruction set are confirmed according to the query failure feedback set to obtain an execution failed instruction set.

[0127] In the embodiment of the present invention, when the second judgment module 104 uses multithreading to obtain the remaining target data from the database according to the failed execution instruction set and merges the second target data with the remaining target data to obtain the third target data, it is specifically used to:

[0128] Utilizing multiple threads to concurrently execute the failed query instructions in the failed instruction set to obtain a query result for each failed query instruction;

[0129] Summarize the query results of each failed query command to obtain the remaining target data;

[0130] A preset order is confirmed according to the parallel request instruction set, and the second target data and the remaining target data are merged according to the preset order to obtain third target data.

[0131] In an embodiment of the present invention, when there are request instructions that have not been successfully executed in the parallel request instruction set, a failed execution instruction set is obtained by obtaining all the unsuccessful request instructions in the parallel request instruction set, thereby improving the efficiency of obtaining the remaining target data, and using multi-threading to obtain the remaining target data from the database according to the failed execution instruction set, the second target data is merged with the remaining target data to obtain the third target data, and the third target data is sent to a preset client, thereby improving the response efficiency of the database.

[0132] Reference Figure 2 FIG. 1 is a flow chart of a data processing method based on a relational database provided by an embodiment of the present invention. In this embodiment, the data processing method based on a relational database includes:

[0133] S1. After receiving the data request instruction from the preset client, confirm the data table information where the requested data is located according to the data request instruction, confirm the row information of the requested data in each data table according to the data request instruction, confirm the column information of the requested data in each data table according to the data request instruction, confirm the data item information of the requested data in each data table according to the data request instruction, summarize the data table information, row information, column information and data item information, and obtain the target request data information. S2. Calculate the expected time of the data request according to the target request data information.

[0134] S3. Determine whether the expected time of the data request is greater than a preset time threshold.

[0135] If the expected time of the data request is less than or equal to the preset time threshold, execute S4, obtain the first target data from the database according to the data request instruction, and send the first target data to the preset client.

[0136] If the expected time of the data request is greater than the time threshold, S5 is executed to convert the data request instruction into a parallel request instruction set.

[0137] S6. Create multiple threads, and use the multiple threads to obtain the second target data from the pre-cached hot data according to the parallel request instruction set.

[0138] S7. Determine whether all request instructions in the parallel request instruction set have been executed successfully.

[0139] If all request instructions in the parallel request instruction set have been executed successfully, then S8 is executed to send the second target data to a preset client.

[0140] If there are unsuccessfully executed request instructions in the parallel request instruction set, execute S9, obtain all unsuccessfully executed request instructions in the parallel request instruction set, obtain a failed execution instruction set, use multi-threading to obtain the remaining target data from the database according to the failed execution instruction set, merge the second target data with the remaining target data to obtain the third target data, and send the third target data to the preset client.

[0141] like Figure 3 , which is a schematic diagram of the structure of an electronic device of a data processing method based on a relational database provided by an embodiment of the present invention.

[0142] The electronic device 1 may include a processor 10, a memory 11, a communication bus 12, and a communication interface 13, and may also include a computer program stored in the memory 11 and executable on the processor 10, such as a data processing program based on a relational database.

[0143] In some embodiments, the processor 10 may be composed of an integrated circuit, for example, a single packaged integrated circuit, or a plurality of packaged integrated circuits with the same or different functions, including one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and combinations of various control chips. The processor 10 is the control core (ControlUnit) of the electronic device, and uses various interfaces and lines to connect various components of the entire electronic device, and executes or executes programs or modules (such as data processing programs based on relational databases, etc.) stored in the memory 11, and calls data stored in the memory 11 to execute various functions of the electronic device and process data.

[0144] The memory 11 includes at least one type of readable storage medium, and the readable storage medium includes a flash memory, a mobile hard disk, a multimedia card, a card-type memory (for example, an SD or DX memory, etc.), a magnetic memory, a disk, an optical disk, etc. In some embodiments, the memory 11 may be an internal storage unit of an electronic device, such as a mobile hard disk of the electronic device. In other embodiments, the memory 11 may also be an external storage device of an electronic device, such as a plug-in mobile hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the electronic device. Further, the memory 11 may also include both an internal storage unit of the electronic device and an external storage device. The memory 11 can not only be used to store application software and various types of data installed in the electronic device, such as the code of a data processing program based on a relational database, but also be used to temporarily store data that has been output or is to be output.

[0145] The communication bus 12 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. The bus is configured to realize connection and communication between the memory 11 and at least one processor 10, etc.

[0146] The communication interface 13 is used for communication between the above-mentioned electronic device and other devices, including a network interface and a user interface. Optionally, the network interface may include a wired interface and / or a wireless interface (such as a WI-FI interface, a Bluetooth interface, etc.), which is generally used to establish a communication connection between the electronic device and other electronic devices. The user interface may be a display (Display), an input unit (such as a keyboard (Keyboard)), and optionally, the user interface may also be a standard wired interface, a wireless interface. Optionally, in this embodiment, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, and an OLED (Organic Light-Emitting Diode, organic light-emitting diode) touch device, etc. Among them, the display may also be appropriately referred to as a display screen or a display unit, which is used to display information processed in the electronic device and to display a visual user interface.

[0147] The figure only shows an electronic device with components. Those skilled in the art will understand that the structure shown in the figure does not constitute a limitation on the electronic device, and may include fewer or more components than shown in the figure, or combine certain components, or arrange the components differently.

[0148] For example, although not shown, the electronic device may also include a power source (such as a battery) for supplying power to various components. Preferably, the power source may be logically connected to the at least one processor 10 through a power management device, so that the power management device can realize functions such as charging management, discharging management, and power consumption management. The power source may also include one or more DC or AC power sources, recharging devices, power failure detection circuits, power converters or inverters, power status indicators, and other arbitrary components. The electronic device may also include a variety of sensors, Bluetooth modules, Wi-Fi modules, etc., which will not be repeated here.

[0149] It should be understood that the embodiment is for illustration only and the scope of the patent application is not limited to this structure.

[0150] The data processing program based on the relational database stored in the memory 11 of the electronic device 1 is a combination of multiple instructions. When running in the processor 10, it can achieve:

[0151] After receiving the data request instruction from the preset client, confirming the target request data information according to the data request instruction;

[0152] Calculate the expected time of data request according to the target request data information;

[0153] Determine whether the expected time of the data request is greater than a preset time threshold;

[0154] If the expected time of the data request is less than or equal to the preset time threshold, obtaining the first target data from the database according to the data request instruction, and sending the first target data to the preset client;

[0155] If the expected time of the data request is greater than the time threshold, converting the data request instruction into a parallel request instruction set;

[0156] Creating multiple threads, and using the multiple threads to obtain the second target data from the pre-cached hot data according to the parallel request instruction set;

[0157] Determining whether all request instructions in the parallel request instruction set have been executed successfully;

[0158] If all request instructions in the parallel request instruction set have been executed successfully, sending the second target data to a preset client;

[0159] If there are unsuccessfully executed request instructions in the parallel request instruction set, all unsuccessfully executed request instructions in the parallel request instruction set are obtained to obtain a failed execution instruction set, and the remaining target data is obtained from the database according to the failed execution instruction set using multi-threading, the second target data is merged with the remaining target data to obtain third target data, and the third target data is sent to a preset client.

[0160] Specifically, the specific implementation method of the processor 10 for the above instructions can refer to the description of the relevant steps in the corresponding embodiment of the accompanying drawings, which will not be repeated here.

[0161] Furthermore, if the module / unit integrated in the electronic device 1 is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. The computer-readable storage medium can be volatile or non-volatile. For example, the computer-readable medium can include: any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a mobile hard disk, a magnetic disk, an optical disk, a computer memory, and a read-only memory (ROM).

[0162] The present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor of an electronic device, the computer program can implement:

[0163] After receiving the data request instruction of the preset client, confirm the data table information where the requested data is located according to the data request instruction, confirm the row information of the requested data in each data table according to the data request instruction, confirm the column information of the requested data in each data table according to the data request instruction, confirm the data item information of the requested data in each data table according to the data request instruction, summarize the data table information, row information, column information and data item information, and obtain the target requested data information;

[0164] The expected time of the data request is calculated according to the target request data information using the following formula: ;

[0165] in, the expected time for said data request, Indicates the number of data tables included in the target request data information, Indicates the target request data information The number of rows in the requested data table. Indicates the target request data information The number of columns in the requested data table. Indicates the target request data information The number of data items contained in the request data in the data table, K is a predetermined adjustment coefficient, B is a predetermined response time bias term, and R is a predetermined processing performance parameter;

[0166] Determine whether the expected time of the data request is greater than a preset time threshold;

[0167] If the expected time of the data request is less than or equal to the preset time threshold, obtaining the first target data from the database according to the data request instruction, and sending the first target data to the preset client;

[0168] If the expected time of the data request is greater than the time threshold, converting the data request instruction into a parallel request instruction set;

[0169] Creating multiple threads, and using the multiple threads to obtain the second target data from the pre-cached hot data according to the parallel request instruction set;

[0170] Determining whether all request instructions in the parallel request instruction set have been executed successfully;

[0171] If all request instructions in the parallel request instruction set have been executed successfully, sending the second target data to a preset client;

[0172] If there are unsuccessfully executed request instructions in the parallel request instruction set, all unsuccessfully executed request instructions in the parallel request instruction set are obtained to obtain a failed execution instruction set, and the remaining target data is obtained from the database according to the failed execution instruction set using multi-threading, the second target data is merged with the remaining target data to obtain third target data, and the third target data is sent to a preset client.

[0173] In the embodiments provided by the present invention, it should be understood that the disclosed devices, systems and methods can be implemented in other ways. For example, the system embodiments described above are only schematic, for example, the division of the modules is only a logical function division, and there may be other division methods in actual implementation.

[0174] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0175] In addition, each functional module in each embodiment of the present invention may be integrated into one processing unit, each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional modules.

[0176] It is obvious to those skilled in the art that the present invention is not limited to the details of the above exemplary embodiments, and that the present invention can be implemented in other specific forms without departing from the spirit or essential characteristics of the present invention.

[0177] Therefore, no matter from which point of view, the embodiments should be regarded as illustrative and non-restrictive, and the scope of the present invention is limited by the appended claims rather than the above description, so it is intended that all changes falling within the meaning and scope of the equivalent elements of the claims are included in the present invention. Any attached figure mark in the claims should not be regarded as limiting the claims involved.

[0178] The embodiments of the present application can acquire and process relevant data based on artificial intelligence technology. Artificial Intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.

[0179] In addition, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices stated in the system claim can also be implemented by one unit or device through software or hardware. The words first, second, etc. are used to indicate names, and do not indicate any particular order.

[0180] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solution of the present invention can be modified or replaced by equivalents without departing from the spirit and scope of the technical solution of the present invention.

Claims

1. A data processing system based on a relational database, characterized in that: The system includes a data calculation module, a first judgment module, a data acquisition module and a second judgment module, wherein: The data calculation module is used to confirm the data table information where the requested data is located according to the data request instruction after receiving the data request instruction of the preset client, confirm the row information of the requested data in each data table according to the data request instruction, confirm the column information of the requested data in each data table according to the data request instruction, confirm the data item information of the requested data in each data table according to the data request instruction, summarize the data table information, row information, column information and data item information to obtain the target request data information, and calculate the expected time of the data request according to the target request data information using the following formula: ; in, the expected time for said data request, Indicates the number of data tables included in the target request data information, Indicates the target request data information The number of rows in the requested data table. Indicates the target request data information The number of columns in the requested data table. Indicates the target request data information The number of data items contained in the requested data in the data table, is a predetermined adjustment coefficient, B is a predetermined response time bias term, and R is a predetermined processing performance parameter; The first judgment module is used to judge whether the expected time of the data request is greater than a preset time threshold; if the expected time of the data request is less than or equal to the preset time threshold, obtain the first target data from the database according to the data request instruction, and send the first target data to the preset client; if the expected time of the data request is greater than the time threshold, convert the data request instruction into a parallel request instruction set; The data acquisition module is used to create multiple threads, and use the multiple threads to acquire the second target data from the pre-cached hot data according to the parallel request instruction set; The second judgment module is used to judge whether all request instructions in the parallel request instruction set have been successfully executed. If all request instructions in the parallel request instruction set have been successfully executed, the second target data is sent to the preset client. If there are request instructions that have not been successfully executed in the parallel request instruction set, all request instructions that have not been successfully executed in the parallel request instruction set are obtained to obtain a failed execution instruction set, and the remaining target data is obtained from the database according to the failed execution instruction set using multi-threading, the second target data is merged with the remaining target data to obtain third target data, and the third target data is sent to the preset client.

2. The data processing system based on a relational database according to claim 1, characterized in that: When the first determination module converts the data request instruction into a parallel request instruction set, it is specifically used to include: Identifying a data table object in the data request instruction; Identifying a connection statement in the data request instruction; Identifying a query condition statement in the data request instruction; According to the data table object, the connection statement, and the query condition statement, the data request instruction is decomposed and recombined into multiple query statements for querying a single data table to obtain a parallel request instruction set.

3. The data processing system based on a relational database according to claim 1, characterized in that: When the data acquisition module acquires the second target data from the pre-cached hot data according to the parallel request instruction set by using multiple threads, it is specifically used to: and concurrently executing the query statements in the parallel request instructions using the hot data as the query range to obtain query statement execution results; Obtain the query feedback and query result data contained in the execution result of each query statement; Summarize the query feedback contained in each execution result to obtain a query feedback set; The query result data included in each execution result is aggregated to obtain the second target data.

4. The data processing system based on a relational database according to claim 1, characterized in that: Before the data acquisition module acquires the second target data from the pre-cached hot data according to the parallel request instruction set by using multiple threads, the data acquisition module is further used to: Get the number of recent accesses to each data table in the database; Sort all data tables in the database in descending order according to the recent access times to obtain a data table sequence; A preset number of data tables in the data table sequence are preferably selected to obtain hot data.

5. The data processing system based on relational database according to claim 3, characterized in that: When determining whether all request instructions in the parallel request instruction set have been executed successfully, the second determination module is specifically used to: Determine whether the query feedback set is empty; If the query feedback set is empty, it is determined that all request instructions in the parallel request instruction set have been executed; If the query feedback set is not empty, it is determined that there are unsuccessfully executed request instructions in the parallel request instruction set.

6. The data processing system based on relational database according to claim 3, characterized in that: When the second judgment module obtains all unsuccessfully executed request instructions in the parallel request instruction set to obtain the execution failure instruction set, it is specifically used to: Obtaining all query failure feedbacks in the query feedback set to obtain a query failure feedback set; All execution failed instructions in the parallel request instruction set are confirmed according to the query failure feedback set to obtain an execution failed instruction set.

7. The data processing system based on a relational database as claimed in claim 6, characterized in that: When the second judgment module uses multithreading to obtain the remaining target data from the database according to the failed execution instruction set and merges the second target data with the remaining target data to obtain the third target data, it is specifically used to: Utilizing multiple threads to concurrently execute the failed query instructions in the failed instruction set to obtain a query result for each failed query instruction; Summarize the query results of each failed query command to obtain the remaining target data; A preset order is confirmed according to the parallel request instruction set, and the second target data and the remaining target data are merged according to the preset order to obtain third target data.

8. A data processing method based on a relational database, characterized in that: The method comprises: After receiving the data request instruction of the preset client, confirm the data table information where the requested data is located according to the data request instruction, confirm the row information of the requested data in each data table according to the data request instruction, confirm the column information of the requested data in each data table according to the data request instruction, confirm the data item information of the requested data in each data table according to the data request instruction, summarize the data table information, row information, column information and data item information, and obtain the target requested data information; The expected time of the data request is calculated according to the target request data information using the following formula: ; in, the expected time for said data request, Indicates the number of data tables included in the target request data information, Indicates the target request data information The number of rows in the requested data table. Indicates the target request data information The number of columns in the requested data table. Indicates the target request data information The number of data items contained in the request data in the data table, K is a predetermined adjustment coefficient, B is a predetermined response time bias term, and R is a predetermined processing performance parameter; Determine whether the expected time of the data request is greater than a preset time threshold; If the expected time of the data request is less than or equal to the preset time threshold, obtaining the first target data from the database according to the data request instruction, and sending the first target data to the preset client; If the expected time of the data request is greater than the time threshold, converting the data request instruction into a parallel request instruction set; Creating multiple threads, and using the multiple threads to obtain the second target data from the pre-cached hot data according to the parallel request instruction set; Determining whether all request instructions in the parallel request instruction set have been executed successfully; If all request instructions in the parallel request instruction set have been executed successfully, sending the second target data to a preset client; If there are unsuccessfully executed request instructions in the parallel request instruction set, all unsuccessfully executed request instructions in the parallel request instruction set are obtained to obtain a failed execution instruction set, and the remaining target data is obtained from the database according to the failed execution instruction set using multi-threading, the second target data is merged with the remaining target data to obtain third target data, and the third target data is sent to a preset client.

Citation Information

Patent Citations

  • Big-data-based query method and device, computer device and storage medium

    CN109033123A

  • Data query method and device

    CN113779060A

  • Query method and device, electronic equipment and computer readable storage medium

    CN117708163A

  • Generation method and device of slow query log, equipment and medium

    CN117971887A

  • Determining Records Generated by a Processing Task of a Query

    US20190258635A1