Data query method and related equipment
By receiving query requests and matching candidate query categories, determining and adjusting database parameters, the problem of improving the success rate of database query in the prior art is solved, and a higher query success rate and better database performance is achieved.
Patent Information
- Application Number
- CN202411448430.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-16
- Publication Date
- 2025-02-07
AI Technical Summary
In the prior art, although the success rate of database query is high, there is still room for improvement, especially in online database clusters. The reasons for the failure of query are mainly concentrated on memory usage exceeding the limit, query time exceeding the limit, and query row count/word The number of sections exceeds the limit, etc., leads to a drag on overall performance.
By receiving a query request and matching it with multiple candidate query categories, the parameters of the target database are determined based on the matching target query categories, and the parameters of the database are adjusted based on these parameters, so as to query data in the database after parameter adjustment.
It improves the success rate of database query, reduces the occurrence of failed queries, and improves the overall performance of database clusters. Especially when handling failed queries with specific patterns, it can be analyzed and optimized in a targeted manner.
Smart Images

Figure CN119396870A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to a data query method and related equipment. Background Art
[0002] In the field of computer technology, databases are usually used to store data, and data can be queried from the database based on query requests. The query success rate is one of the more important evaluation indicators of the database.
[0003] The inventors of the present disclosure have discovered that, in the related art, the query success rate is at a relatively high level, but there is still room for improvement. Summary of the invention
[0004] The present disclosure proposes a data query method and related devices to solve or partially solve the above problems.
[0005] In a first aspect, the present disclosure provides a data query method, comprising:
[0006] Receiving a query request for target data, wherein the query request is used to request to query the target data in a target database;
[0007] matching the query request with a plurality of candidate query categories;
[0008] In response to the query request matching a target query category among the plurality of candidate query categories, determining at least one target database parameter of the target database according to the target query category;
[0009] adjusting at least one database parameter of the target database based on the at least one target database parameter;
[0010] Based on the query request, the target data is queried in the target database after parameter adjustment.
[0011] In a second aspect of the present disclosure, a data query device is provided, comprising:
[0012] A receiving module is configured to: receive a query request for target data, wherein the query request is used to request to query the target data in a target database;
[0013] A matching module is configured to: match the query request with a plurality of candidate query categories;
[0014] a determination module configured to: in response to the query request matching a target query category among the plurality of candidate query categories, determine at least one target database parameter of the target database according to the target query category;
[0015] An adjustment module, configured to: adjust at least one database parameter of the target database based on the at least one target database parameter;
[0016] The query module is configured to: based on the query request, query the target data in the target database after parameter adjustment.
[0017] In a third aspect of the present disclosure, a computer device is provided, comprising one or more processors, a memory; and one or more programs, wherein the one or more programs are stored in the memory and executed by the one or more processors, and the programs include instructions for executing the method described in the first aspect.
[0018] According to a fourth aspect of the present disclosure, a non-volatile computer-readable storage medium containing a computer program is provided. When the computer program is executed by one or more processors, the processors execute the method described in the first aspect.
[0019] In a fifth aspect of the present disclosure, a computer program product is provided, comprising computer program instructions, which, when executed on a computer, cause the computer to execute the method described in the first aspect.
[0020] The data query method and related devices provided by the embodiments of the present disclosure, when receiving a query request, if the query request matches the target query category, can adjust the database parameters of the target database based on the target database parameters corresponding to the target query category, and then query data based on the target database with adjusted parameters, thereby increasing the query success rate. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In order to more clearly illustrate the technical solutions in the present disclosure or related technologies, the drawings required for use in the embodiments or related technical descriptions are briefly introduced below. Obviously, the drawings described below are only embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0022] Figure 1 A schematic diagram showing an exemplary system provided by an embodiment of the present disclosure is shown.
[0023] Figure 2A A flowchart of an exemplary method provided by an embodiment of the present disclosure is shown.
[0024] Figure 2B A schematic diagram of a process for determining database parameters according to an embodiment of the present disclosure is shown.
[0025] Figure 2CAnother schematic diagram of a process for determining database parameters according to an embodiment of the present disclosure is shown.
[0026] Figure 2D Another schematic diagram of a process for determining database parameters according to an embodiment of the present disclosure is shown.
[0027] Figure 2E A schematic diagram of a process for determining a query category according to an embodiment of the present disclosure is shown.
[0028] Figure 3 Another flowchart of an exemplary method provided by an embodiment of the present disclosure is shown.
[0029] Figure 4 A schematic diagram of an exemplary device provided by an embodiment of the present disclosure is shown.
[0030] Figure 5 A schematic diagram of the hardware structure of an exemplary computer device provided in an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0031] In order to make the objectives, technical solutions and advantages of the present disclosure more clearly understood, the present disclosure is further described in detail below in combination with specific embodiments and with reference to the accompanying drawings.
[0032] It should be noted that, unless otherwise defined, the technical terms or scientific terms used in the embodiments of the present disclosure should be understood by people with ordinary skills in the field to which the present disclosure belongs. The "first", "second" and similar words used in the embodiments of the present disclosure do not indicate any order, quantity or importance, but are only used to distinguish different components. "Including" or "comprising" and similar words mean that the elements or objects appearing before the word cover the elements or objects listed after the word and their equivalents, without excluding other elements or objects. "Connect" or "connected" and similar words are not limited to physical or mechanical connections, but can include electrical connections, whether direct or indirect. "Up", "down", "left", "right" and the like are only used to indicate relative positional relationships. When the absolute position of the described object changes, the relative positional relationship may also change accordingly.
[0033] It is understandable that before using the technical solutions of each embodiment of the present disclosure, the type, scope of use, usage scenarios, etc. of the personal information involved will be informed to the user in an appropriate manner, and the user's authorization will be obtained.
[0034] For example, in response to receiving an active request from a user, a prompt message is sent to the user to clearly remind the user that the operation requested to be performed will require obtaining and using the user's personal information. Thus, the user can independently choose whether to provide personal information to software or hardware such as an electronic device, application, server, or storage medium that performs the operation of the technical solution of the present disclosure according to the prompt message.
[0035] As an optional but non-limiting implementation, in response to receiving the user's active request, the prompt information may be sent to the user in the form of a pop-up window, in which the prompt information may be presented in text form. In addition, the pop-up window may also carry a selection control for the user to choose "agree" or "disagree" to provide personal information to the electronic device.
[0036] It is understandable that the above notification and the process of obtaining user authorization are merely illustrative and do not constitute a limitation on the implementation of the present disclosure. Other methods that meet relevant laws and regulations may also be applied to the implementation of the present disclosure.
[0037] Figure 1 A schematic diagram of an exemplary system 100 provided by an embodiment of the present disclosure is shown.
[0038] like Figure 1 As shown, the system 100 may include a terminal device 102, a terminal device 104, a server 106, and a database server 108. A medium (e.g., a network) providing a communication link may be included between the terminal device 102, the terminal device 104 and the server 106 and the database server 108. The network may include various connection types, such as wired, wireless communication links, or optical fiber cables, etc.
[0039] Exemplarily, various applications (APPs) may be installed on the terminal device 104, such as life service applications, collaborative office applications, video conferencing applications, reading applications, video applications, social applications, payment applications, web browsers, and instant messaging tools.
[0040] The terminal device 102 and the terminal device 104 here can be hardware or software. When the terminal device 102 and the terminal device 104 are hardware, they can be various electronic devices with display screens, including but not limited to smart phones, tablet computers, e-book readers, MP3 players, laptop computers (Laptops) and desktop computers (PCs), etc. When the terminal device 102 and the terminal device 104 are software, they can be installed in the electronic devices listed above. It can be implemented as multiple software or software modules (for example, to provide distributed services), or it can be implemented as a single software or software module. No specific limitation is made here.
[0041] The server 106 may be a server that provides various services, such as a background server that provides support for various applications displayed on the terminal devices 102 and 104. The database server 108 may also be a database server that provides various services. It is understood that if the server 106 can implement the relevant functions of the database server 108, the database server 108 may not be set in the system 100.
[0042] Here, the server 106 and the database server 108 can also be hardware or software. When they are hardware, they can be implemented as a distributed server cluster consisting of multiple servers, or as a single server. When they are software, they can be implemented as multiple software or software modules (for example, for providing distributed services), or as a single software or software module. No specific limitation is made here.
[0043] It should be understood that Figure 1 The number of terminal devices, users, servers and database servers in the embodiment is only for illustration. Any number of terminal devices, users, servers and database servers may be provided as required.
[0044] As an exemplary scenario, one or more database servers 108 may constitute a database for storing data and searching for corresponding data based on a query request when receiving a query request and then returning the data, etc. For example, a user 112 may use any application of a terminal device 104 to request a service, and the service needs to obtain corresponding data to return to the terminal device 104. At this time, a query request may be generated based on the request of the user 112 and sent to the database for data query. The database queries the corresponding data based on the query request and returns it to the terminal device 104.
[0045] In the related art, the user 110 (eg, database operation and maintenance personnel) can remotely debug database parameters through the terminal device 102 to maximize the query success rate. However, the manual adjustment method is inefficient.
[0046] In the related art, in an online cluster of a database (for example, a cluster composed of multiple database servers 108), although the number of failed queries is usually very small (generally in the range of 0% to 5%), even such a small number of failed queries has a great impact on the service level agreement (SLA) and the user experience. It may cause users to encounter delays, interruptions or error feedback when performing query operations, thereby reducing the user's trust and satisfaction with the database system. At the same time, for business scenarios that have strict requirements on data timeliness and accuracy, failed queries may trigger a series of chain reactions, affecting the smooth progress of the entire business process.
[0047] The inventors of the present disclosure have found that, firstly, for failed queries of the online database cluster, there is a considerable part of the reasons for the query failure, which are mainly concentrated in memory usage exceeding the limit, query time exceeding the limit, and query row number / byte number exceeding the limit. Therefore, if the relevant parameters can be set reasonably, the probability of query success can be improved to a certain extent. However, if these relevant parameters are set globally (for example, corresponding settings are made for each database parameter), it is likely to drag down the overall performance of the database cluster. Secondly, some failed queries have almost consistent structured query language (SQL) structure and semantics, and will fail repeatedly for the same reason over a long period of time. This means that for such failed queries with specific patterns, targeted analysis and optimization can be carried out.
[0048] In view of this, an embodiment of the present disclosure provides a data query method to solve or partially solve the above problems.
[0049] Figure 2A FIG. 2 is a schematic diagram of an exemplary method 200 provided by an embodiment of the present disclosure. The method 200 may be used to perform a data query based on a query request. Optionally, the method 200 may be performed by Figure 1 or, Figure 1 The system 100 is implemented as follows. Figure 2A As shown, the method 200 further includes the following steps.
[0050] In step 202, a query request for target data may be received, the query request being used to request querying the target data in the target database. Optionally, the query request may be, for example, a Structured Query Language (SQL) command, for requesting execution of a corresponding query operation.
[0051] In step 204, the query request may be matched with a plurality of candidate query categories.
[0052] Each candidate query category may correspond to a type of query, for example, a query category with consistent SQL structure and semantics.
[0053] Optionally, the candidate query category may indicate that at least one database parameter corresponding to a query request matching the candidate query category is adjustable. Thus, when a query request matches any candidate query category, the target database parameter obtained based on the candidate query category may be used to adjust the database parameter of the target database in real time.
[0054] Optionally, the candidate query category may indicate that the query success rate of the query request matching the candidate query category is lower than the success rate threshold. In this way, when the query request matches any candidate query category, the target database parameters obtained based on the candidate query category can be used to adjust the database parameters of the target database in real time, and the query success rate can be improved.
[0055] In some embodiments, the candidate query category may simultaneously indicate that at least one database parameter corresponding to the query request matching the candidate query category is adjustable and that the query success rate of the query request matching the candidate query category is lower than a success rate threshold, thereby having a better effect.
[0056] It can be understood that, in some embodiments, the method 200 may further include a step for generating candidate query categories.
[0057] like Figure 2B As shown, the method 200 may further include the following steps:
[0058] In step 222, combining Figure 3 As shown, multiple failed query requests can be obtained.
[0059] Exemplarily, historical failed query requests may be obtained during a low load peak period of each day, such as the time period from 0:00 to 6:00.
[0060] Since there are some failed queries that cannot be adjusted (for example, the gateway will truncate overlong SQL, some failed SQL is a KILL statement that cannot be adjusted, etc.), a simple rule can be used to filter the failed query requests first. Therefore, optionally, these failed query requests can be filtered to filter out failed query requests whose database parameters can be adjusted (that is, the query success rate can be improved by adjusting the database parameters, or the database parameters related to the failed query request can be adjusted). Optionally, the screening conditions may include that the query SQL is not truncated by the gateway, the query failure can be reproduced, and so on. Through such filtering operations, some SQLs that cannot be adjusted can be filtered out. In this process, some query requests that cannot be stably reproduced in the current environment may also be included. These query requests may fail to execute due to excessive load in a specific period of time, and during the low-peak load period, since the execution failure cannot be reproduced, it is also impossible to adjust the parameters for them. Therefore, these query requests can also be filtered out.
[0061] In step 224, the multiple failed query requests are converted into multiple feature vectors.
[0062] In this step, these failed query requests can be converted into feature vectors. It can be understood that there are many methods for characterization, which are not specifically limited here.
[0063] In step 226, combining Figure 3 As shown, the multiple candidate query categories can be obtained by clustering based on the multiple feature vectors.
[0064] In this step, clustering operation is performed on the multiple feature vectors to obtain the multiple candidate query categories, which are used as query request templates. Such a clustering process can classify query requests with similar features into one category, providing a basis for subsequent parameter adjustment work.
[0065] In some embodiments, the DBSCAN (Density-Based Spatial Clustering of Applications with Noise) method can be used for clustering. DBSCAN is a density-based clustering algorithm that can divide areas with sufficiently high density into clusters and identify noise points. Therefore, this method can be used to perform clustering operations while discarding the noise points.
[0066] like Figure 2B As shown, further, in step 228, at least one database parameter corresponding to each of the candidate query categories is determined, and the database parameter is used to adjust the target database when the query request matches the candidate query category.
[0067] The inventors of the present disclosure have found that those parameters that are closely related to whether a query fails can be largely regarded as Boolean parameters (values can only be 0 or 1), such as whether to turn on or off the optimization of a specific parameter. Therefore, a simple Markov decision process problem can be constructed for each candidate query category to be solved to determine at least one database parameter corresponding to each candidate query category. By determining the corresponding database parameter for each candidate query category, the best parameter combination suitable for this type of query request can be found more accurately.
[0068] Therefore, in some embodiments, Figure 2C As shown, step 228 of determining at least one database parameter corresponding to each candidate query category may further include the following steps:
[0069] In step 2282, a plurality of candidate database parameters are determined.
[0070] In this step, multiple database parameters can be selected as candidate database parameters. Optionally, database parameters that have a greater impact on the query success rate can be selected as candidate database parameters. For example, a parameter that is closely related to query success can be simply regarded as a Boolean parameter (with only 0 or 1 as the value). For example, the parameter max_bytes before_external_group_by controls whether to enable disk dump for group by. The setting of this Boolean parameter can clearly reflect the impact of two different parameter selections on the query results.
[0071] In step 2284, for each of the candidate query categories, a state-independent Markov decision process problem is constructed based on the multiple candidate database parameters.
[0072] In the process of parameter adjustment, multiple parameters can be enabled at the same time in each step (i.e., multiple parameters can be adjusted at the same time), so the adjusted parameters can also be considered as combined parameters. This means that multiple parameters related to query success can be adjusted at the same time to find the best parameter combination. By considering different values of multiple parameters at the same time, the parameter space can be explored more comprehensively, increasing the possibility of finding the optimal parameter combination.
[0073] The results of query requests can be quantified by rewards. When the query is successfully executed, the reward R = 1; when the query fails, the reward R = 0. This simple reward setting can intuitively reflect the query results and facilitate evaluation and decision-making during the parameter adjustment process.
[0074] Therefore, based on the above characteristics, a state-independent Markov decision process problem can be constructed, and the combination parameters corresponding to the candidate query categories can be obtained by solving the problem.
[0075] In the traditional Markov decision process (MDP) problem, the decision maker takes an action at each state and moves to the next state based on the transition probabilities of the environment and the reward function, and obtains a reward.
[0076] The problem constructed in this step simplifies the Markov decision process problem, which assumes that there is no state (or the state space is a single state), or the transition between states does not affect the distribution of rewards. In the state-independent Markov decision process problem, you only need to choose an action in each round (for example, choose a certain parameter) and then get a reward based on the reward distribution of the action. The core of the problem is to balance the relationship between exploration (trying new or unknown actions to better understand their reward distribution) and exploitation (selecting the action that currently looks best to maximize the reward).
[0077] Therefore, the goal of parameter adjustment is to recommend a set of parameters for the query request so that the query request has the greatest possible probability of being successfully executed. By constantly trying different parameter combinations, observing the query execution results, and making adjustments based on these results, you can gradually find a set of parameters that best suits the candidate query category, thereby improving the query success rate.
[0078] This embodiment does not enumerate all possible parameter combinations and simply executes the failed query request with the parameters added, because the inventor of the present disclosure found that:
[0079] 1. In actual situations, due to the complexity of the online environment, including the influence of multiple factors such as network conditions, server load, and dynamic changes in data distribution, the execution results of query requests have certain uncertainties. Whether a query is successful or not is not an inevitable event. Even a good parameter combination has a very small probability of failure in a complex online environment; a bad parameter combination also has a small probability of success. Therefore, it is not possible to determine whether this parameter combination is worth recommending based on the result of a single execution.
[0080] 2. The size of enumerating all parameter combinations is 2N-1, where N is the number of parameters. As the number of parameters increases, the number of possible parameter 2 combinations grows exponentially, and it is very costly to enumerate all parameter combinations and execute them multiple times.
[0081] In order to solve the above problem, a combined confidence upper bound (CUCB) algorithm can be used to solve the above state-independent Markov decision process problem.
[0082] Therefore, if Figure 2C As shown, in step 2286, the state-independent Markov decision process problem can be solved based on the combined confidence upper bound algorithm to obtain at least one database parameter corresponding to the query category.
[0083] The CUCB algorithm can repeatedly explore the execution results of combined actions to find the mean and variance of each basic action, and then infer the upper confidence interval (UCB). In this process, the algorithm will continuously try different parameter combinations, collect execution results, and update the evaluation of each parameter combination based on these results. By repeating this process many times, the algorithm can gradually and accurately estimate the performance of each parameter combination. Finally, after several rounds of exploration, the combined action with the largest UCB is taken as the recommended parameter.
[0084] In some embodiments, Figure 2D As shown, based on the combined confidence upper bound algorithm, the state-independent Markov decision process problem is solved to obtain at least one database parameter corresponding to the query category, including:
[0085] In step 22862, combine Figure 3 As shown, multiple query instances can be obtained.
[0086] The query instance includes historical query requests (including successful and failed ones) and corresponding database parameters.
[0087] In step 22864, the state-independent Markov decision process problem is solved using the multiple query instances based on a combined confidence upper bound algorithm to obtain at least one database parameter corresponding to the query category.
[0088] In this way, the state-independent Markov decision process problem is solved using query instances based on a combined confidence upper bound algorithm. After several rounds (e.g., 100 rounds), a set of better parameter combinations can be obtained as database parameters corresponding to the candidate query categories.
[0089] Combination Figure 3 As shown, in step 204, when the user 114 issues a query request, the clustering algorithm will first identify whether the query request can match any candidate query category, and perform different processing according to the actual situation.
[0090] In some embodiments, Figure 2E As shown, matching the query request with multiple candidate query categories includes:
[0091] At step 2042, the query request is converted into a target feature vector;
[0092] In step 2044, the distance between the target feature vector and the cluster center corresponding to each candidate query category is calculated;
[0093] In step 2046, in response to determining that the distance from the target feature vector to the cluster center corresponding to the first query category among the multiple candidate query categories is less than a distance threshold (e.g., an area radius (EPS) parameter of DBScan), the target query category matching the query request is determined to be the first query category.
[0094] In some embodiments, matching the query request with multiple candidate query categories further includes: in response to determining that the distance from the target feature vector to the cluster center corresponding to each of the candidate query categories is not less than a distance threshold, determining that the query request does not match any of the multiple candidate query categories.
[0095] In this way, each time an inference is performed, it is only necessary to complete the characterization of the SQL and the distance calculation of about 20 points. This calculation method makes the calculation cost relatively low and the calculation efficiency high.
[0096] In some embodiments, the method 200 may further include: in response to the query request not matching any of the multiple candidate query categories, querying the target data in the target database based on the query request. Optionally, in the corresponding DBScan clustering algorithm, unmatched query requests are classified as noise points. If the query request cannot match any candidate query category, it is likely to be a successful query or a query that does not meet the screening conditions. In this case, no further parameter adjustment operations may be performed on the database, but data may be queried directly in the target database based on the query request.
[0097] In other embodiments, Figure 2A As shown, in step 206, in response to the query request matching a target query category among the multiple candidate query categories, at least one target database parameter of the target database may be determined according to the target query category.
[0098] In this step, if the query request matches the target query category among the multiple candidate query categories, a set of target database parameters that are likely to be successfully executed can be selected based on the target query category that matches the query request. This parameter recommendation method can make full use of the existing parameter adjustment results, improve the execution success rate of new queries, and avoid the huge computational cost of independently adjusting parameters for each new query.
[0099] In some embodiments, the at least one target database parameter includes hardware parameters of the target database, for example, parameters of hardware resources of the database server 108, such as performance and capacity of a central processing unit (CPU), memory (RAM), disk, etc. In this way, the database can be better adjusted to a state where it is easier to query successfully.
[0100] At step 208 , at least one database parameter of the target database may be adjusted based on the at least one target database parameter.
[0101] In this step, the determined target database parameters corresponding to the target query category may be used to adjust the database parameters corresponding to the target database, so that the target database can improve the query success rate when executing the query request.
[0102] In step 210, the target data may be queried in the target database after parameter adjustment based on the query request.
[0103] In this way, when querying the target data in the target database after parameter adjustment based on the query request, the query success rate can be significantly improved compared to the target database without parameter adjustment.
[0104] It can be understood that in the embodiments of the present disclosure, the clustering method identifies query requests that are "at risk of execution failure." It should be clear that these identified query requests may still be successfully executed without adjusting the parameters of the database. Overall, the proportion of query requests that are identified as having a risk of failure is very small among all query requests, that is, the proportion of query requests that need to be executed with parameters is very small, so even if the process of clustering and matching query categories is added, the impact on the overall query performance is relatively small. In some embodiments, if you want to reduce the proportion of queries with parameters, you can lower the EPS parameters of the clustering, that is, the binary query index. Through such an operation, the judgment of failed queries can be made more conservative, and the impact on the overall query performance can be smaller.
[0105] It should be noted that the method of the embodiment of the present disclosure can be performed by a single device, such as a computer or a server. The method of the present embodiment can also be applied in a distributed scenario and completed by multiple devices cooperating with each other. In the case of such a distributed scenario, one of the multiple devices can only perform one or more steps in the method of the embodiment of the present disclosure, and the multiple devices will interact with each other to complete the described method.
[0106] It should be noted that the above describes some embodiments of the present disclosure. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the above embodiments and still achieve the desired results. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0107] The disclosed embodiment also provides a data query device. Figure 4 FIG. 4 is a schematic diagram of an exemplary device 400 provided by an embodiment of the present disclosure. Figure 4 As shown, the device 400 can be used to implement the method 200, and can further include the following modules.
[0108] The receiving module 402 is configured to: receive a query request for target data, wherein the query request is used to request to query the target data in a target database;
[0109] The matching module 404 is configured to: match the query request with a plurality of candidate query categories;
[0110] The determination module 406 is configured to: in response to the query request matching a target query category among the multiple candidate query categories, determine at least one target database parameter of the target database according to the target query category;
[0111] The adjustment module 408 is configured to: adjust at least one database parameter of the target database based on the at least one target database parameter;
[0112] The query module 410 is configured to query the target data in the target database after parameter adjustment based on the query request.
[0113] In some embodiments, the query module 410 is configured to: in response to the query request not matching any of the multiple candidate query categories, query the target data in the target database based on the query request.
[0114] In some embodiments, the apparatus 400 further includes a parameter determination module configured to:
[0115] Get multiple failed query requests;
[0116] Converting the multiple failed query requests into multiple feature vectors;
[0117] Based on the multiple feature vectors, clustering to obtain the multiple candidate query categories;
[0118] At least one database parameter corresponding to each of the candidate query categories is determined.
[0119] In some embodiments, the parameter determination module is configured to:
[0120] determining a plurality of candidate database parameters;
[0121] For each of the candidate query categories, constructing a state-independent Markov decision process problem based on the multiple candidate database parameters;
[0122] Based on the combined confidence upper bound algorithm, the state-independent Markov decision process problem is solved to obtain at least one database parameter corresponding to the query category.
[0123] In some embodiments, the parameter determination module is configured to:
[0124] Get multiple query instances;
[0125] The state-independent Markov decision process problem is solved by using the multiple query instances based on a combined confidence upper bound algorithm to obtain at least one database parameter corresponding to the query category.
[0126] In some embodiments, the matching module 404 is configured to:
[0127] Converting the query request into a target feature vector;
[0128] Calculating the distance between the target feature vector and the cluster center corresponding to each candidate query category;
[0129] In response to determining that the distance from the target feature vector to a cluster center corresponding to a first query category among the multiple candidate query categories is less than a distance threshold, determining that the target query category matching the query request is the first query category.
[0130] In some embodiments, the matching module 404 is configured to: in response to determining that the distance from the target feature vector to the cluster center corresponding to each of the candidate query categories is not less than a distance threshold, determine that the query request does not match the multiple candidate query categories.
[0131] In some embodiments, the candidate query category indicates at least one of the following information:
[0132] At least one database parameter corresponding to the query request matching the candidate query category is adjustable;
[0133] The query success rate of the query requests matching the candidate query category is lower than the success rate threshold.
[0134] In some embodiments, the at least one target database parameter comprises a hardware parameter of the target database.
[0135] For the convenience of description, the above device is described by dividing it into various modules according to its functions. Of course, when implementing the present disclosure, the functions of each module can be implemented in the same or multiple software and / or hardware.
[0136] The device of the above embodiment is used to implement the corresponding method 200 in any of the above embodiments, and has the beneficial effects of the corresponding method embodiment, which will not be described in detail here.
[0137] The embodiment of the present disclosure also provides a computer device for implementing the above method 200. Figure 5 FIG. 5 is a schematic diagram showing the hardware structure of an exemplary computer device 500 provided in an embodiment of the present disclosure. The computer device 500 can be used to implement Figure 1 The server 106 can also be used to implement Figure 1 In some scenarios, the computer device 500 can also be used to implement Figure 1 The database server 108.
[0138] like Figure 5 As shown, the computer device 500 may include: a processor 502, a memory 504, a network module 506, a peripheral interface 508 and a bus 510. The processor 502, the memory 504, the network module 506 and the peripheral interface 508 are connected to each other in communication within the computer device 500 through the bus 510.
[0139] Processor 502 may be a central processing unit (CPU), an image processor, a neural network processor (NPU), a microcontroller (MCU), a programmable logic device, a digital signal processor (DSP), an application specific integrated circuit (ASIC), or one or more integrated circuits. Processor 502 may be used to perform functions related to the technology described in this disclosure. In some embodiments, processor 502 may also include multiple processors integrated into a single logical component. For example, Figure 5 As shown, processor 502 may include a plurality of processors 502a, 502b, and 502c.
[0140] The memory 504 may be configured to store data (eg, instructions, computer code, etc.). Figure 5As shown, the data stored in the memory 504 may include program instructions (e.g., program instructions for implementing the method 200 of the embodiment of the present disclosure) and data to be processed (e.g., the memory may store configuration files of other modules, etc.). The processor 502 may also access the program instructions and data stored in the memory 504, and execute the program instructions to operate on the data to be processed. The memory 504 may include a volatile storage device or a non-volatile storage device. In some embodiments, the memory 504 may include a random access memory (RAM), a read-only memory (ROM), an optical disk, a magnetic disk, a hard disk, a solid-state drive (SSD), a flash memory, a memory stick, etc.
[0141] The network interface 506 can be configured to provide the computer device 500 with communication with other external devices via a network. The network can be any wired or wireless network capable of transmitting and receiving data. For example, the network can be a wired network, a local wireless network (e.g., Bluetooth, WiFi, near field communication (NFC)), a cellular network, the Internet, or a combination thereof. It is understood that the type of network is not limited to the above specific examples.
[0142] The peripheral interface 508 can be configured to connect the computer device 500 to one or more peripheral devices to achieve information input and output. For example, the peripheral devices can include input devices such as a keyboard, a mouse, a touch pad, a touch screen, a microphone, and various sensors, and output devices such as a display, a speaker, a vibrator, and an indicator light.
[0143] The bus 510 may be configured to transmit information between various components of the computer device 500 (e.g., the processor 502, the memory 504, the network interface 506, and the peripheral interface 508), such as an internal bus (e.g., a processor-memory bus), an external bus (USB port, PCI-E bus), etc.
[0144] It should be noted that, although the architecture of the above-mentioned computer device 500 only shows the processor 502, the memory 504, the network interface 506, the peripheral interface 508 and the bus 510, in the specific implementation process, the architecture of the computer device 500 may also include other components necessary for normal operation. In addition, it can be understood by those skilled in the art that the architecture of the above-mentioned computer device 500 may also only include the components necessary for implementing the embodiments of the present disclosure, and does not necessarily include all the components shown in the figure.
[0145] Based on the same inventive concept, corresponding to any of the above-mentioned embodiments, the present disclosure also provides a non-transitory computer-readable storage medium, wherein the non-transitory computer-readable storage medium stores computer instructions, and the computer instructions are used to enable the computer to execute method 200 described in any of the above embodiments.
[0146] The computer-readable medium of this embodiment includes permanent and non-permanent, removable and non-removable media, and information storage can be implemented by any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, read-only compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device.
[0147] The computer instructions stored in the storage medium of the above embodiment are used to enable the computer to execute the method 200 described in any of the above embodiments, and have the beneficial effects of the corresponding method embodiments, which will not be repeated here.
[0148] Based on the same inventive concept, corresponding to the method 200 in any of the above embodiments, the present disclosure further provides a computer program product, which includes a computer program. In some embodiments, the computer program is executable by one or more processors so that the processors execute the method 200. Corresponding to the execution subject corresponding to each step in each embodiment of the method 200, the processor that executes the corresponding step may belong to the corresponding execution subject.
[0149] The computer program product of the above embodiment is used to enable the processor to execute the method 200 described in any of the above embodiments, and has the beneficial effects of the corresponding method embodiment, which will not be described in detail here.
[0150] Those skilled in the art should understand that the discussion of any of the above embodiments is merely illustrative and is not intended to imply that the scope of the present disclosure (including the claims) is limited to these examples. Based on the concept of the present disclosure, the technical features in the above embodiments or different embodiments may be combined, the steps may be implemented in any order, and there are many other variations of the different aspects of the embodiments of the present disclosure as described above, which are not provided in detail for the sake of simplicity.
[0151] In addition, to simplify the description and discussion, and in order not to make the embodiments of the present disclosure difficult to understand, the known power / ground connections to the integrated circuit (IC) chips and other components may or may not be shown in the provided figures. In addition, the device can be shown in the form of a block diagram to avoid making the embodiments of the present disclosure difficult to understand, and this also takes into account the fact that the details of the implementation of these block diagram devices are highly dependent on the platform on which the embodiments of the present disclosure will be implemented (that is, these details should be fully within the scope of understanding of those skilled in the art). Where specific details (e.g., circuits) are set forth to describe exemplary embodiments of the present disclosure, it is apparent to those skilled in the art that the embodiments of the present disclosure can be implemented without these specific details or with changes in these specific details. Therefore, these descriptions should be considered illustrative rather than restrictive.
[0152] Although the present disclosure has been described in conjunction with specific embodiments of the present disclosure, many replacements, modifications and variations of these embodiments will be apparent to those skilled in the art from the foregoing description. For example, other memory architectures (e.g., dynamic RAM (DRAM)) may use the embodiments discussed.
[0153] The embodiments of the present disclosure are intended to cover all such substitutions, modifications and variations that fall within the broad scope of the appended claims. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the embodiments of the present disclosure should be included in the scope of protection of the present disclosure.
Claims
1. A data query method, comprising: Receiving a query request for target data, wherein the query request is used to request to query the target data in a target database; matching the query request with a plurality of candidate query categories; In response to the query request matching a target query category among the plurality of candidate query categories, determining at least one target database parameter of the target database according to the target query category; adjusting at least one database parameter of the target database based on the at least one target database parameter; Based on the query request, the target data is queried in the target database after parameter adjustment.
2. The method of claim 1, further comprising: In response to the query request not matching any of the plurality of candidate query categories, searching the target database for the target data based on the query request.
3. The method of claim 1, further comprising: Get multiple failed query requests; Converting the multiple failed query requests into multiple feature vectors; Based on the multiple feature vectors, clustering to obtain the multiple candidate query categories; At least one database parameter corresponding to each of the candidate query categories is determined.
4. The method of claim 3, wherein: Determining at least one database parameter corresponding to each of the candidate query categories includes: determining a plurality of candidate database parameters; For each of the candidate query categories, constructing a state-independent Markov decision process problem based on the multiple candidate database parameters; Based on the combined confidence upper bound algorithm, the state-independent Markov decision process problem is solved to obtain at least one database parameter corresponding to the query category.
5. The method of claim 4, wherein: Based on the combined confidence upper bound algorithm, the state-independent Markov decision process problem is solved to obtain at least one database parameter corresponding to the query category, including: Get multiple query instances; The state-independent Markov decision process problem is solved by using the multiple query instances based on a combined confidence upper bound algorithm to obtain at least one database parameter corresponding to the query category.
6. The method of claim 3, wherein: Matching the query request with a plurality of candidate query categories includes: Converting the query request into a target feature vector; Calculating the distance between the target feature vector and the cluster center corresponding to each candidate query category; In response to determining that the distance from the target feature vector to a cluster center corresponding to a first query category among the multiple candidate query categories is less than a distance threshold, determining that the target query category matching the query request is the first query category.
7. The method of claim 6, wherein: Matching the query request with a plurality of candidate query categories further includes: In response to determining that the distance from the target feature vector to the cluster center corresponding to each of the candidate query categories is not less than a distance threshold, it is determined that the query request does not match any of the multiple candidate query categories.
8. The method of claim 1, wherein: The candidate query category indicates at least one of the following information: At least one database parameter corresponding to the query request matching the candidate query category is adjustable; The query success rate of the query requests matching the candidate query category is lower than the success rate threshold.
9. The method of claim 1, wherein: The at least one target database parameter includes a hardware parameter of the target database.
10. A data query device, comprising: A receiving module is configured to: receive a query request for target data, wherein the query request is used to request to query the target data in a target database; A matching module is configured to: match the query request with a plurality of candidate query categories; a determination module configured to: in response to the query request matching a target query category among the plurality of candidate query categories, determine at least one target database parameter of the target database according to the target query category; An adjustment module, configured to: adjust at least one database parameter of the target database based on the at least one target database parameter; The query module is configured to: based on the query request, query the target data in the target database after parameter adjustment.
11. A computer device comprising one or more processors, a memory; and one or more programs, wherein the one or more programs are stored in the memory and executed by the one or more processors, and the programs include instructions for executing the method according to any one of claims 1 to 9.
12. A non-volatile computer-readable storage medium containing a computer program, which, when executed by one or more processors, causes the processors to perform the method of any one of claims 1 to 9.
13. A computer program product, comprising computer program instructions, which, when executed on a computer, cause the computer to execute the method according to any one of claims 1 to 9.