Query request processing method and device

By judging the similarity between the query request and the uncached query results before processing it, and directly using or processing the uncached query results, the problem of repeated processing in the existing technology is solved, and the processing efficiency of the query request is improved.

CN118733614APending Publication Date: 2024-10-01BEIJING GRIDSUM TECH CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202310326227.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-03-30
Publication Date
2024-10-01

AI Technical Summary

Technical Problem

When processing a query request, the existing technology cannot effectively determine the query request being processed and the query request that has been processed but not stored in the cache table, resulting in repeated processing and reducing the processing efficiency of the query request.

Method used

Before processing the query request, determine whether the target query request is the same as the uncached query result. If they are the same, the uncached query results will be used directly. If they are different, they will be processed according to the preset rules to avoid repeated processing.

Benefits of technology

It reduces the number and time-consuming processing of query requests, improves the processing efficiency of query requests, and avoids repeated processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118733614A_ABST
    Figure CN118733614A_ABST
Patent Text Reader

Abstract

The invention provides a query request processing method and device, and relates to the technical field of data processing. The query request processing method comprises the steps of obtaining a target query request which is not matched with a query result in a cache, judging whether the target query request is the same as a query request of which the query result is not cached or not according to query content in the target query request, if yes, determining a first query result as a query result corresponding to the target query request, and if not, determining a second query result as the query result corresponding to the target query request. And if not, processing the target query request according to a preset rule, and outputting a corresponding second query result. According to the technical scheme, before the query request is processed, the query request storing the query result and the query request not caching the query result in the cache table can be judged, so that the situation of repeated processing does not exist when the query request is processed, the processing frequency of the query request is reduced, the processing time of the query request is shortened, and the processing efficiency is improved. And the processing efficiency of the query request is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data processing, and in particular to a method and device for processing a query request. Background Art

[0002] With the rapid development of computer information technology, a large amount of data information will be derived, such as web browsing information, consumption record information, and travel record information. A large amount of data information can be stored in a database with a large storage space. When data information is needed, the database can be queried to obtain the required data information. The query of the database needs to be implemented by processing the query request.

[0003] In the prior art, the query request is processed as follows: when a query request is received, the query request is processed, and the processed query request and the corresponding query result are stored in a cache table. When a query request is received again, it is determined whether the query request is the same as the query request that has been processed in the cache table. If so, the query result corresponding to the same processed query request in the cache table is determined as the query result of the query request. If not, the query request is processed and the processed query result is stored in the cache table.

[0004] The problem with the above-mentioned prior art is that when processing a received query request, only the query requests in the cache table are judged whether there are query requests that are the same as the received query request, but the cache table does not store the query request being processed and the query request that has been processed but not stored in the cache table. The prior art cannot judge the query request being processed and the query request that has been processed and not stored in the cache table, which still leads to repeated processing when processing the query request, which increases the number of query request processing times and the query request processing time, resulting in low query request processing efficiency. Summary of the invention

[0005] The purpose of the embodiments of the present application is to provide a method and device for processing a query request to solve the problem of low query request processing efficiency.

[0006] In order to solve the above technical problems, the embodiments of the present application provide the following technical solutions:

[0007] The first aspect of the present application provides a method for processing a query request, the method comprising:

[0008] Get the target query request that is not matched with the query result in the cache;

[0009] Determining, according to the query content in the target query request, whether the target query request is the same as a query request for which the query result is not cached;

[0010] If so, determining a first query result as the query result corresponding to the target query request, the first query result being the query result output by the query request for the uncached query result;

[0011] If not, the target query request is processed according to a preset rule, and a corresponding second query result is output.

[0012] A second aspect of the present application provides a query request processing device, the device comprising:

[0013] An acquisition module is used to acquire a target query request that is not matched with a query result in the cache;

[0014] A judgment module, used to judge whether the target query request is the same as a query request for which the query result is not cached, according to the query content in the target query request;

[0015] a determination module, configured to, if yes, determine a first query result as the query result corresponding to the target query request, the first query result being the query result output by the query request for the uncached query result;

[0016] The processing module is used to process the target query request according to a preset rule if no, and output a corresponding second query result.

[0017] The third aspect of the present application provides an electronic device, which includes: at least one processor; and at least one memory and a bus connected to the processor; wherein the processor and the memory communicate with each other through the bus; the processor is used to call program instructions in the memory to execute the query request processing method of the above-mentioned first aspect or any optional embodiment of the first aspect.

[0018] A fourth aspect of the present application provides a computer-readable storage medium, the storage medium including a stored program, wherein when the program is running, the device where the storage medium is located is controlled to execute the query request processing method of the above-mentioned first aspect or any optional embodiment of the first aspect.

[0019] Compared with the prior art, the query request processing method and device provided in the present application need to judge the target query request that does not match the query result in the cache, and judge whether the target query request is the same as the query request outside the cache, that is, whether it is the same as the query request for the uncached query result. When the target query request is the same as the query request for the uncached query result, the query result of the query request with the uncached query result is determined as the query result of the target query request, and the target query request does not need to be processed. In this way, before processing the query request, the query request with the query result stored in the cache table and the query request with the uncached query result can be judged, so that there is no repeated processing when processing the query request, the number of query request processing times is reduced, the query request processing time is shortened, and the query request processing efficiency is improved.

[0020] The query request processing device provided in the second aspect of the present application has the same beneficial effects as the query request processing method provided in the first aspect of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] By reading the detailed description below with reference to the accompanying drawings, the above and other purposes, features and advantages of the exemplary embodiments of the present application will become easy to understand. In the accompanying drawings, several embodiments of the present application are shown in an exemplary and non-limiting manner, and the same or corresponding reference numerals represent the same or corresponding parts, wherein:

[0022] Figure 1 A flowchart schematically shows a method for processing a query request;

[0023] Figure 2 A flowchart for determining a target query request is schematically shown;

[0024] Figure 3 Schematically shows the structure of the query request processing device Figure 1 ;

[0025] Figure 4 Schematically shows the structure of the query request processing device Figure 2 ;

[0026] Figure 5 The structure diagram of an electronic device is schematically shown. DETAILED DESCRIPTION

[0027] The exemplary embodiments of the present application will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present application are shown in the accompanying drawings, it should be understood that the present application can be implemented in various forms and should not be limited by the embodiments described herein. On the contrary, these embodiments are provided to enable a more thorough understanding of the present application and to fully convey the scope of the present application to those skilled in the art.

[0028] It should be noted that, unless otherwise specified, the technical terms or scientific terms used in this application should have the common meanings understood by technicians in the field to which this application belongs.

[0029] Regarding the processing of query requests, the prior art is to judge whether there is a query request identical to the received query request only for the query request with query results stored in the cache table when processing the received query request. Since the cache table of the prior art does not store the query request being processed and the query request that has been processed but not stored in the cache table, it is not possible to judge the query request being processed and the query request that has been processed and not stored in the cache table, which will lead to repeated processing when processing the query request, increasing the number of query request processing times and the time consumption of query request processing, resulting in low query request processing efficiency. Therefore, the present invention takes into account that when processing the received query request, it is not possible to judge the query request being processed and the query request that has been processed and not stored in the cache table, and needs a method that can judge and process the query request being processed and the query request that has been processed and not stored in the cache table, replacing the method of the prior art that only judges and processes the query request with query results stored in the cache table. To this end, the present invention can select query requests with query results stored in the cache table, query requests being processed, and query requests that have been processed but not stored in the cache table to judge, so that there is no repeated processing when processing query requests, the number of query request processing times is reduced, the query request processing time is shortened, and the query request processing efficiency is improved. The main idea of ​​the present invention is to judge whether the target query request that does not match the query result in the cache is the same as the query request without the cached query result before processing the target query request. When the target query request is the same as the query request without the cached query result, it is only necessary to determine the query result of the query request without the cached query result as the query result corresponding to the target query request, and there is no need to repeatedly process the target query request.

[0030] The method in the embodiment of the present invention is described in detail below.

[0031] Figure 1 A flowchart schematically shows a method for processing a query request in an embodiment of the present invention, see Figure 1 As shown, the method may include:

[0032] S101: Obtain a target query request that is not matched with a query result in the cache.

[0033] Specifically, the query request may include unprocessed query requests, query requests with cached query results, and query requests with uncached query results. The query requests with uncached query results include query requests being processed and query requests with processed uncached query results.

[0034] Processed query requests, i.e., query requests for cached query results, will be stored in the cache. In other words, query requests for cached query results are stored in the cache, and unprocessed query requests, query requests being processed, and query requests for processed but uncached query results are not stored in the cache. When an unprocessed query request is received, it is necessary to first determine whether the unprocessed query request is the same as the query request for the cached query result in the cache. If they are the same, the query result corresponding to the query request for the cached query result is determined as the query result corresponding to the unprocessed query request. If they are not the same, the target query request that does not match the query result in the cache is obtained. The target query request is a query request among the unprocessed query requests.

[0035] Exemplarily, the query requests for which cached query results are stored in the cache are query request a, query request b, and query request c, the query result corresponding to query request a is aa, the query result corresponding to query request b is bb, and the query result corresponding to query request c is cc, and the unprocessed query requests are query request d and query request e, query request d is the same as query request a and can be matched to query result aa, query request e is different from query request a, query request b, and query request c, and cannot be matched to the query result, and it is necessary to obtain the target query request e that has not matched the query result in the cache.

[0036] S102: Determine, based on the query content in the target query request, whether the target query request is the same as a query request for which the query result is not cached.

[0037] Specifically, based on the query content in the target query request obtained in step S101, it is determined whether the target query request is the same as the query request for which the query result is not cached.

[0038] The query content may be a query condition and a query field in the structured query language content. The query request for which the query result is not cached includes the query request being processed and the query request for which the query result is not cached.

[0039] The present application can be applied to business intelligence product (Business Intelligence, BI) scenarios. Since there are many identical query requests in this scenario, in order to avoid repeated processing of query requests, before processing the query request, it is necessary to determine whether the target query request is the same as the query request for uncached query results based on the query content in the target query request.

[0040] Continuing with the example of step S101, the query requests for which the query results are not cached are query request f and query request g. It is necessary to determine whether the target query request e is the same as query request f and query request g based on the query content E in the target query request e.

[0041] According to the query content in the target query request, it is determined whether the target query request is the same as the query request for which the query result is not cached. If so, step S103 is executed; if not, step S104 is executed.

[0042] S103: Determine the first query result as the query result corresponding to the target query request.

[0043] The first query result is a query result output by a query request for which a query result is not cached.

[0044] Specifically, when the target query request determined in step S102 is the same as the query request for which the query result is not cached, the query result output by the query request for which the query result is not cached is determined as the query result corresponding to the target query request.

[0045] Continuing with the example of step S102, the query result corresponding to query request f is ff, and the query result corresponding to query request g is gg. According to the query content E in the target query request e, when it is determined that the target query request e is the same as the query request f, the query result of the target query request e is determined to be the query result gg.

[0046] S104: Process the target query request according to preset rules, and output a corresponding second query result.

[0047] Specifically, when the target query request determined in step S102 is different from the query request for which the query result is not cached, the target query request is processed according to a preset rule, and a corresponding second query result is output.

[0048] Continuing with the example of step S102, the query result corresponding to the target query request e is ee. According to the query content E in the target query request e, when it is determined that the target query request e is different from both the query request f and the query request g, the target query request e is processed according to the preset rules and the query result ee is output.

[0049] Based on the above Figure 1It can be seen from the implementation method that the embodiment of the present invention determines whether the target query request is the same as the query request for the uncached query result by using the query content in the target query request that has not matched the query result in the cache, so as to achieve the purpose of processing the target query request. Before processing the target query request, the target query request can be determined as a query request that is the same as or different from the query request for the uncached query result based on the query content in the target query request. For the query request that is the same as the query request for the uncached query result, the query result output by the query request for the uncached query result is directly determined as the query result corresponding to the target query request. There is no need to process the query request that is the same as the query request for the uncached query result again, so that there is no repeated processing when processing the query request, so that the number of query request processing times is reduced, the query request processing time is shortened, and the query request processing efficiency is improved.

[0050] Furthermore, as a Figure 1 In step S102, i.e., the refinement and expansion of the operation method of judging whether the target query request is the same as the query request of the uncached query result according to the query content in the target query request, the existing structured query language content (i.e., comparing the query conditions and query fields one by one) is used to judge whether the target query request is the same as the query request of the uncached query result. This one-by-one judgment requires judging the query conditions and query fields multiple times, and the judgment is relatively slow. Therefore, a faster judgment method is needed. The query conditions and query fields in the structured query language content in the target query request and the query conditions and query fields in the structured query language content in the query request of the uncached query result can be extracted, and a complete statement is generated for each. By judging one statement, it is possible to judge only once, so that the judgment time is shorter, thereby improving the judgment time. Figure 2 For a flowchart of determining a target query request in an embodiment of the present application, see Figure 2 As shown, the above step S102 may include:

[0051] Step S1021: Generate a first statement according to the first query condition and the first query field.

[0052] The query content in the target query request includes a first query condition and a first query field in the structured query language content.

[0053] Specifically, a first statement is generated according to the query condition and query field of the query language content in the target query request. The generated first statement is a statement corresponding to the target query request, and the first statement is a complete statement.

[0054] The query condition is the value assigned to the query field, and the query condition can be the value assigned to one or more query fields. For example, if the query fields are name, height, and weight, the query condition can be name Zhang San or name Zhang San and height greater than 160cm.

[0055] The first statement may be generated by extracting query conditions and query fields from the query language content in the target query request, generating the extracted query conditions and query fields into a text statement, setting a label for the target query request, and storing the generated text statement in the label.

[0056] Exemplarily, the query conditions of the query language content in the target query request are name Zhang San and height greater than 160cm, and the query fields of the query language content in the target query request are name, age, height and weight. The first sentence generated can be: name Zhang San and height greater than 160cm, corresponding to name, age, height and weight.

[0057] Step S1022: Generate a second statement according to the second query condition and the second query field.

[0058] The second query condition is a query condition of the structured query language content in the query request of the uncached query result, and the second query field is a query field of the structured query language content in the query request of the uncached query result.

[0059] Specifically, a second statement is generated according to the query condition and query field of the structured query language content in the query request of the uncached query result. The generated second statement is a statement corresponding to the query request of the uncached query result, and the second statement is a complete statement.

[0060] The second statement may be generated by extracting query conditions and query fields of the query language content in the query request for the uncached query result, generating the extracted query conditions and query fields as a text statement, setting a label for the query request for the uncached query result, and storing the generated text statement in the label.

[0061] Exemplarily, the query conditions of the structured query language content in the query request of the uncached query results are height greater than 160cm and name Zhang San, and the query fields of the structured query language content in the query request of the uncached query results are weight, height, name and age. The generated second statement can be: name is Zhang San and height greater than 160cm, corresponding to name, age, height and weight.

[0062] Step S1023: when the first statement is identical to the second statement, determining that the query request is identical to a query request for an uncached query result.

[0063] Specifically, when the first statement generated in step S1021 is the same as the second statement generated in step S1022, it is determined that the query request is the same as the query request for the uncached query result.

[0064] When the first statement is different from the second statement, it is determined that the query request is different from the query request for which the query result is not cached. Accordingly, the target query request is processed according to a preset rule, and a corresponding second query result is output.

[0065] Furthermore, the target query request can be divided into at least one first target query request according to the data source of the query content in the target query request, so that each first target query request after division corresponds to a different data source, so as to prepare for the subsequent determination of the data source, and the determination of the data source can narrow the scope of the query. Specifically, after step S102 (obtaining the target query request that does not match the query result in the cache), it can also include:

[0066] According to a data source in the target query request, the target query request is divided into at least one first target query request.

[0067] The data source is a table in the database where the query result corresponding to the target query request is located.

[0068] Specifically, since the query results corresponding to the target query request may be in one table or in multiple tables in the database, that is, the data sources in the target query request may be the same or different, the target query request can be divided into at least one first target query request according to the data source in the target query request.

[0069] When the data sources in the target query request are the same, that is, when the query results corresponding to the target query request are in one table in the database, there is only one target query request. When the data sources in the target query request are different, that is, when the query results corresponding to the target query request are in multiple tables in the database, the target query request is divided into multiple first target query requests. The number of divided first target query requests is the same as the number of tables in the database where the query results corresponding to the target query request are located.

[0070] A different number may be assigned to each of the divided first target query requests, so that the corresponding first target query request can be quickly found by number.

[0071] Exemplarily, the query results corresponding to the target query request a are query result aa and query result AA. The tables in the database where the query result aa and the query result AA are located are Table 1 and Table 2, respectively. That is, the data sources in the target query request are data source 1 and data source 2. The target query request is divided into two first target query requests, namely the first target query request a1 and the first target query request a2.

[0072] Further, as a refinement and extension of the above-mentioned step S104, when determining whether the comparison content in the first target query request is included in the comparison content in the query request of the uncached query result, the first target query request can be processed only in the query result corresponding to the query request of the uncached query result, that is, the result required by the first target query request is found. In this way, there is no need to process the first target query request in the entire database of a larger scope, that is, there is no need to find the result required by the first target query request in all the data in the database of a larger scope, thereby reducing the scope of processing the first target query request and improving the efficiency of processing the first target query request.

[0073] Specifically, the above step S104 may include:

[0074] Step A1: Determine whether the comparison content in the first target query request is included in the comparison content in the query request of the uncached query result.

[0075] The comparison content includes data source, query conditions and query fields.

[0076] Determine whether the comparison content in the first target query request is included in the comparison content in the query request of the uncached query result, or in other words, determine whether the comparison content in the first target query request is a subset of the comparison content in the query request of the uncached query result.

[0077] It is determined whether the comparison content in the first target query request is included in the comparison content in the query request of the uncached query result. If so, step A2 is executed; if not, step A3 is executed.

[0078] Step A2: Processing the first target query request in the query results output by the query request for which the query results are not cached.

[0079] Specifically, when the comparison content in the first target query request determined in step A1 is included in the comparison content in the query request of the uncached query result, the first target query request is processed in the query result output by the query request of the uncached query result.

[0080] In the query results output by the query request without cached query results, the first target query request is processed, and after the processing is completed, the query result corresponding to the first target query request is output, and the query result of the first target query request does not need to be determined in the entire database.

[0081] Step A3: Process the first target query request in the database.

[0082] Specifically, when the comparison content in the first target query request determined in step A1 is not included in the comparison content in the query request for which the query result is not cached, the first target query request is processed in the database.

[0083] Processing the first target query request in the database, and outputting the query result corresponding to the first target query request after the processing is completed,

[0084] Furthermore, as a refinement and extension of the above-mentioned step A1, when the target query request is different from the query request of the uncached query result, by respectively judging whether the data source and query conditions of the first target query request are included in the data source and query conditions corresponding to the query request of the uncached result, the scope of determining whether the first target query request is similar can be narrowed by judging the data source and query conditions. The first target query request can be processed through the query results corresponding to similar query requests. In this way, there is no need to process the first target query request in a large range of the entire database, so that the scope of processing the first target query request is reduced, thereby improving the efficiency of processing the first target query request.

[0085] Specifically, the above step A1 may include:

[0086] Step A11: Determine whether the data source of the first target query request is the same as the data source of the query request for the uncached result.

[0087] The data source can be used to determine the table where the query results corresponding to the first target query request are located. The data source can be used to first determine a relatively large range, that is, to determine whether the query results corresponding to the first target query request are in a table. Only in a table can the comparison content in the first target query request be included in the comparison content in the query request of the uncached query result. If they are not in the same table, the first target query requests are different.

[0088] Determine whether the data source of the first target query request is the same as the data source of the query request of the uncached result. If not, execute step A12; if so, execute step A13.

[0089] Step A12: If the data sources are different, the comparison content in the first target query request is not included in the comparison content in the query request for which the query result is not cached.

[0090] Specifically, when the data source of the first target query request determined in step A11 is different from the data source of the query request of the uncached result, the comparison content in the first target query request is determined to be not included in the comparison content in the query request of the uncached query result.

[0091] The comparison content in the first target query request is not included in the comparison content in the query request without cached query results. In other words, the comparison content in the first target query request is a subset of the comparison content in the query request without cached query results.

[0092] Exemplarily, the first target query request is request a, the data source of request a is source 1, the query request for uncached results is request b, the data source of request b is source 2, then source 1 is different from source 2.

[0093] Step A13: If the data sources are the same, determine whether the third query condition is included in the second query condition. When the third query condition is not included in the second query condition, determine that the comparison content in the first target query request is not included in the comparison content in the query request of the uncached query result.

[0094] The third query condition is the query condition of the first target query request.

[0095] The second query condition is a query condition of the structured query language content in the query request of the uncached query result.

[0096] Specifically, when the data source of the first target query request determined in step A11 is the same as the data source of the query request for the uncached result, it is determined whether the query conditions of the first target query request are included in the query conditions of the query request for the uncached query result. When the query conditions of the first target query request are not included in the query conditions of the query request for the uncached query result, it is determined that the comparison content in the first target query request is not included in the comparison content in the query request for the uncached query result.

[0097] Determining whether the query condition of the first target query request is included in the query condition of the query request of the uncached query result, or in other words, determining whether the query condition of the first target query request is a subset of the query condition of the query request of the uncached query result.

[0098] Exemplarily, the first target query request is request a, the data source of request a is source 1, the query request for uncached results is request b, the data source of request b is source 1, then the data source of request a is the same as the data source of request b. The third query condition is that the name is Zhang San and the height is greater than 150cm, and the second query condition is that the name is Zhang San, the height is greater than 160cm, and the weight is greater than 50kg. It can be seen that the name is Zhang San, the height is greater than 150cm, and the weight is greater than 50kg are not included in the name is Zhang San and the height is greater than 160cm, that is, the third query condition is not included in the second query condition.

[0099] Furthermore, when the target query request is different from the query request of the uncached query result, it is possible to determine whether the data source and query conditions of the first target query request are included in the data source and query conditions corresponding to the query request of the uncached result, and it is also possible to determine whether the query field of the first target query request is included in the query field corresponding to the query request of the uncached result. If included, the first target query request can be processed only in the query result corresponding to the query request of the uncached query result. In this way, there is no need to process the first target query request in a large range of the entire database, which reduces the scope of processing the first target query request and improves the efficiency of processing the first target query request.

[0100] Specifically, after step A13 (when the third query condition is not included in the second query condition, determining that the comparison content in the first target query request is not included in the comparison content in the query request for which the query result is not cached), that is, the following may also be included:

[0101] Step A14: When the third query condition is included in the second query condition, determine whether the third query field is included in the second query field. If the third query field is not included in the second query field, the comparison content in the first target query request is not included in the comparison content in the query request of the uncached query result.

[0102] The third query field is the query field of the first target query request.

[0103] The second query field is a query field of the structured query language content in the query request of the uncached query result.

[0104] Specifically, when the query conditions of the first target query request are included in the query conditions of the query request of the uncached query result, it is determined whether the query field of the first target query request is included in the query field in the query request of the uncached query result. If the query field of the first target query request is not included in the query field in the query request of the uncached query result, the comparison content in the first target query request is not included in the comparison content in the query request of the uncached query result.

[0105] Determine whether the query field of the first target query request is included in the query field of the query request of the uncached query result, or in other words, determine whether the query field of the first target query request is a subset of the query field of the query request of the uncached query result.

[0106] The comparison content in the first target query request and the comparison content in the query request of the uncached query result may appear only when the query condition of the first target query request is included in the query condition of the query request of the uncached query result.

[0107] For example, the third query condition is that the name is Zhang San and the height is greater than 170cm, and the second query condition is that the name is Zhang San and the height is greater than 160cm. It can be seen that the name is Zhang San and the height is greater than 170cm is included in the name is Zhang San and the height is greater than 160cm, that is, the third query condition is included in the second query condition. The third query field is name, height and age, and the second query field is name, height and weight. It can be seen that name, height and age are not included in name, height and weight, that is, the third query field is not included in the second query field.

[0108] Step A15: If the third query field is included in the second query field, the comparison content in the first target query request is included in the comparison content in the query request of the uncached query result.

[0109] Specifically, if the query field of the first target query request is included in the query field in the query request of the uncached query result, the comparison content in the first target query request is included in the comparison content in the query request of the uncached query result.

[0110] Only when the query field of the first target query request is included in the query field of the query request of the uncached query result, it is possible that the first target query request is similar to the query request of the uncached query result, that is, the query result of the first target query request may appear in the query result of the query request of the uncached query result.

[0111] Exemplarily, the third query field is name and height, and the second query field is name, height and weight. It can be seen that name and height are included in name, height and weight, that is, the third query field is included in the second query field.

[0112] When the data source of the first target query request is the same as the query request of the uncached query result, the query condition of the first target query request is included in the query condition of the uncached query result, and the query field of the first target query request is included in the query field of the query request of the uncached query result, determine the comparison content in the first target query request, the comparison content included in the query request of the uncached query result, and process the first target query request in the query result output by the query request of the uncached query result.

[0113] Furthermore, as a refinement and extension of the above-mentioned step S103, by monitoring whether the query requests being processed in the uncached query results have been processed, a warning message can be given for the query requests being processed whose processing time is greater than the preset time, and it is determined that there is a problem with the query request, which can facilitate subsequent troubleshooting of the query information and smooth processing of the query information with this problem.

[0114] Specifically, the above step S103 may include:

[0115] Step B1: Determine whether the query request being processed is completed.

[0116] Query requests for which query results are not cached include query requests that are being processed.

[0117] When the target query request is the same as the query request of the uncached query result, it is necessary to determine whether the query request being processed is completed.

[0118] Determine whether the query request being processed has been completed. If so, execute step B2; if not, execute step B3.

[0119] Step B2: Determine the third query result as the query result corresponding to the target query request.

[0120] The third query result is the query result output by the query request being processed.

[0121] Specifically, when the query request being processed as determined in step B1 is completed, the query result output by the query request being processed is determined as the query result corresponding to the target query request.

[0122] Step B3: When the processing time of the query request being processed is greater than the preset time, a warning message of timeout processing is output.

[0123] Specifically, when the query request being processed as determined in step B1 is not completely processed, and when the processing time of the query request being processed is greater than a preset time, a warning message of timeout processing is output.

[0124] The preset time may be 3 minutes or 4 minutes. There may be multiple preset times, which are not limited here.

[0125] The warning message of timeout processing can be a voice alarm, a text prompt, a flashing red light, a combination of text prompt and voice alarm, or a combination of text prompt, voice alarm and flashing red light. There can be multiple types of alarm information, which are not limited here.

[0126] The reason for the output timeout warning message may be that the server load is relatively heavy or there is a problem with the network. After the output timeout warning message is output, the processing of the query request being processed by the output timeout warning message can be suspended to determine whether the problem causing the output warning message is the heavy load or the network problem. After determining the specific problem, the problem is processed to ensure that the query request being processed by the output timeout warning message can be processed normally, and then the processing of the query request being processed by the output timeout warning message can be started.

[0127] The query request for the uncached query result also includes the query request for the processed uncached query result.

[0128] When the target query request is the same as the query request of the uncached query result, that is, when the target query request is the same as the query request being processed or the query request of the processed uncached query result, it is not necessary to repeatedly process the same target query request received within the processing time period as the query request being processed, and it is only necessary to determine the query result output when the query request being processed is completed as the query result corresponding to the target query request, so that there is no repeated processing when processing the query request, so that the number of query request processing times is reduced, the query request processing time is shortened, and the query request processing efficiency is improved, and the query result just output when the query request being processed is completed is used as the query result of the target query request, which can ensure the real-time query result of the target query request. It is not necessary to repeatedly process the same query request as the query request of the processed uncached query result, and it is only necessary to determine the query result of the query request of the processed uncached query result as the query result corresponding to the target query request, so that there is no repeated processing when processing the query request, so that the number of query request processing times is reduced, the query request processing time is shortened, and the query request processing efficiency is improved.

[0129] Based on the same inventive concept, as an implementation of the above-mentioned query request processing method, an embodiment of the present invention further provides a query request processing device. Figure 3 The structure of the device in the embodiment of the present invention is Figure 1 , see Figure 3 As shown, the device may include:

[0130] An acquisition module 301 is used to acquire a target query request that is not matched with a query result in the cache;

[0131] A judgment module 302 is used to judge whether the target query request obtained by the acquisition module 301 is the same as a query request for which the query result is not cached, according to the query content in the target query request;

[0132] A determination module 303 is configured to determine a first query result as a query result corresponding to the target query request if the target query request determined by the determination module 302 is the same as the query request for the uncached query result, wherein the first query result is a query result output by the query request for the uncached query result;

[0133] The processing module 304 is configured to process the target query request according to a preset rule and output a corresponding second query result if the target query request determined by the determination module 302 is different from the query request for which the query result is not cached.

[0134] exist Figure 3 Based on the present invention, another embodiment of the device is provided, see Figure 4 As shown, Figure 4 The structure of the device in the embodiment of the present invention is Figure 2 , the device may include:

[0135] The judgment module 302 includes:

[0136] A first generating unit 3021 is configured to generate a first statement according to the first query condition and the first query field, wherein the query content in the target query request includes the first query condition and the first query field in the structured query language content;

[0137] A second generating unit 3022 is configured to generate a second statement according to a second query condition and a second query field, wherein the second query condition is a query condition of the structured query language content in the query request of the uncached query result, and the second query field is a query field of the structured query language content in the query request of the uncached query result;

[0138] The determining unit 3023 is configured to determine that the query request is the same as the query request of the uncached query result when the first statement generated by the first generating unit 3021 is the same as the second statement generated by the second generating unit 3022.

[0139] Furthermore, the device also includes:

[0140] The division module 305 is used to divide the target query request into at least one first target query request according to the data source in the target query request after obtaining the target query request that does not match the query result in the cache, and the data source is the table in the database where the query result corresponding to the target query request is located.

[0141] Furthermore, the processing module 304 includes:

[0142] The first determination unit 3041 is used to determine whether the comparison content in the first target query request is included in the comparison content in the query request of the uncached query result;

[0143] The first processing unit 3042 is configured to process the first target query request in the query result output by the query request of the uncached query result if the comparison content in the first target query request determined by the first determination unit 3041 is included in the comparison content in the query request of the uncached query result;

[0144] The second processing unit 3043 is used to process the first target query request in the database if the comparison content in the first target query request determined by the first judgment unit 3041 is not included in the comparison content in the query request of the uncached query result.

[0145] Furthermore, the first judgment unit 3041 is specifically used to determine whether the data source of the first target query request is the same as the data source of the query request of the uncached result; if the data sources are not the same, the comparison content in the first target query request is not included in the comparison content in the query request of the uncached query result; if the data sources are the same, it is determined whether the third query condition is included in the second query condition. When the third query condition is not included in the second query condition, it is determined that the comparison content in the first target query request is not included in the comparison content in the query request of the uncached query result, and the third query condition is the query condition of the first target query request.

[0146] Further, the second judgment unit 3044 is specifically used to determine, when the third query condition is not included in the second query condition, that the comparison content in the first target query request is not included in the comparison content in the query request of the uncached query result, and then, when the third query condition is included in the second query condition, determine whether the third query field is included in the second query field; if the third query field is not included in the second query field, then the comparison content in the first target query request is not included in the comparison content in the query request of the uncached query result, and the third query field is the query field of the first target query request; if the third query field is included in the second query field, then the comparison content in the first target query request is included in the comparison content in the query request of the uncached query result.

[0147] Further, the determination module 303 is specifically used to determine whether the query request being processed has been completed, and the query request for the uncached query result includes the query request being processed; if so, the third query result is determined as the query result corresponding to the target query request, and the third query result is the query result output by the query request being processed; if not, when the processing time of the query request being processed is greater than the preset time, a warning message of timeout processing is output.

[0148] Based on the same inventive concept, an embodiment of the present invention further provides an electronic device. Figure 5 is a structural diagram of an electronic device in an embodiment of the present invention, see Figure 5 As shown, the electronic device 50 may include: at least one processor 501; and at least one memory 502 and a bus 503 connected to the processor 501; wherein the processor 501 and the memory 502 communicate with each other via the bus 503; the processor 501 is used to call the program instructions in the memory 502 to execute the query request processing method in one or more of the above-mentioned embodiments.

[0149] It should be noted that the description of the query request processing device embodiment is similar to the description of the method embodiment, and has similar beneficial effects as the method embodiment. For technical details not disclosed in the memory cleaning device embodiment of the present invention, please refer to the description of the method embodiment of the present invention for understanding.

[0150] Based on the same inventive concept, an embodiment of the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium includes a stored program, wherein when the program is running, the device where the storage medium is located is controlled to execute the method in one or more of the above embodiments.

[0151] It should be noted here that the description of the above computer-readable storage medium embodiment is similar to the description of the above method embodiment, and has similar beneficial effects as the method embodiment. For technical details not disclosed in the embodiment of the computer-readable storage medium of the embodiment of the present invention, please refer to the description of the method embodiment of the present invention for understanding.

[0152] The above are only specific implementations of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. A method for processing a query request, characterized in that: The method comprises: Get the target query request that is not matched with the query result in the cache; Determining, according to the query content in the target query request, whether the target query request is the same as a query request for which the query result is not cached; If so, determining a first query result as the query result corresponding to the target query request, the first query result being the query result output by the query request for the uncached query result; If not, the target query request is processed according to a preset rule, and a corresponding second query result is output.

2. The method according to claim 1, characterized in that The query content in the target query request includes a first query condition and a first query field in the structured query language content, and judging whether the target query request is the same as a query request for which the query result is not cached according to the query content in the target query request includes: Generate a first statement according to the first query condition and the first query field; generating a second statement according to a second query condition and a second query field, wherein the second query condition is a query condition of the structured query language content in the query request of the uncached query result, and the second query field is a query field of the structured query language content in the query request of the uncached query result; When the first statement is identical to the second statement, it is determined that the query request is identical to a query request for the uncached query result.

3. The method according to claim 1, characterized in that After obtaining a target query request that does not match a query result in the cache, the method further includes: According to a data source in the target query request, the target query request is divided into at least one first target query request, and the data source is a table in a database where a query result corresponding to the target query request is located.

4. The method according to claim 3, characterized in that The processing of the target query request according to a preset rule includes: Determine whether the comparison content in the first target query request is included in the comparison content in the query request of the uncached query result; If so, processing the first target query request in the query results output by the query request for the uncached query result; If not, the first target query request is processed in the database.

5. The method according to claim 4, characterized in that Determining whether the comparison content in the first target query request is included in the comparison content in the query request of the uncached query result includes: Determining whether the data source of the first target query request is the same as the data source of the query request of the uncached result; If the data sources are different, the comparison content in the first target query request is not included in the comparison content in the query request of the uncached query result; If the data sources are the same, determine whether the third query condition is included in the second query condition. When the third query condition is not included in the second query condition, determine the comparison content in the first target query request, which is not included in the comparison content in the query request of the uncached query result. The third query condition is the query condition of the first target query request.

6. The method according to claim 5, characterized in that When the third query condition is not included in the second query condition, after determining that the comparison content in the first target query request is not included in the comparison content in the query request of the uncached query result, the method further includes: When the third query condition is included in the second query condition, determining whether the third query field is included in the second query field; if the third query field is not included in the second query field, the comparison content in the first target query request is not included in the comparison content in the query request of the uncached query result, and the third query field is the query field of the first target query request; If the third query field is included in the second query field, the comparison content in the first target query request is included in the comparison content in the query request of the uncached query result.

7. The method according to claim 1, characterized in that The query request for which the query result is not cached includes a query request being processed, and determining the first query result as the query result corresponding to the target query request includes: Determine whether the query request being processed has been completed; If yes, determining the third query result as the query result corresponding to the target query request, the third query result being the query result output by the query request being processed; If not, when the processing time of the query request being processed is greater than the preset time, a warning message of timeout processing is output.

8. A query request processing device, characterized in that: The device comprises: An acquisition module is used to acquire a target query request that is not matched with a query result in the cache; A judgment module, used to judge whether the target query request is the same as a query request for which the query result is not cached, according to the query content in the target query request; a determination module, configured to, if yes, determine a first query result as the query result corresponding to the target query request, the first query result being the query result output by the query request for the uncached query result; The processing module is used to process the target query request according to a preset rule if no, and output a corresponding second query result.

9. An electronic device, characterized in that: The electronic device comprises: at least one processor; and at least one memory and bus connected to the processor; The processor and the memory communicate with each other via the bus; the processor is used to call program instructions in the memory to execute the query request processing method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The storage medium includes a stored program, wherein when the program is executed, the device where the storage medium is located is controlled to execute the query request processing method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Business data query method and device, storage medium and electronic device

    CN111125175A

  • Game data query method and device

    CN113360526A

  • Data processing method and device, equipment and storage medium

    CN113934747A

  • Repetitive Query Recognition and Processing

    US20130018918A1

  • Consistent client-side caching for fine grained invalidations

    US20190325052A1