Data query method and device, equipment and storage medium

By filtering the query addresses of the database agents using a pre-stored redundant address list, the problem of redundant reading in the database agent is solved, and the effect of reducing network overhead and waste of computing resources is achieved.

CN119719165APending Publication Date: 2025-03-28BEIJING DAJIA INTERNET INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411783929.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-05
Publication Date
2025-03-28

AI Technical Summary

Technical Problem

When the database agent processes data query requests, it is difficult for the route to determine the destination, resulting in redundant reading problems, increasing network communication overhead and waste of computing resources.

Method used

Multiple query addresses are filtered through the pre-stored redundant address list, redundant addresses with empty query results are removed, and data query requests are sent to the filtered query address.

Benefits of technology

It effectively solves the problem of redundant reading, reduces unnecessary network overhead and instance load pressure, and improves system performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119719165A_ABST
    Figure CN119719165A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a data query method and device, electronic equipment and a storage medium, and relates to the technical field of computers. The method comprises the following steps: receiving a data query request sent by a client; determining at least one first query address according to the data query request; filtering the at least one first query address according to a pre-stored redundant address list to obtain at least one second query address; and sending the data query request to the database instance corresponding to the at least one second query address for data query. According to the method, the multiple first query addresses determined according to the data query request are filtered through the pre-stored redundant address list, so that redundant addresses with empty query results are removed, the problem of redundant read in a database agent is solved, and unnecessary network overhead and instance load pressure are avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology, and in particular to a data query method, device, electronic device, storage medium, and computer program product. Background Art

[0002] In the process of using the database, in order to effectively manage the load of each database instance, it is necessary to forward data query requests through a database proxy. However, when processing some data query requests, the database proxy is difficult to determine its routing destination. In order to ensure the correctness of the query results, the relevant requests are usually sent to all database instances for execution. Although this strategy ensures the integrity and accuracy of the data, it also brings significant redundant reading problems. Specifically, since the database proxy cannot accurately locate the target instance, it chooses to broadcast the request to all instances. This practice not only increases the overhead of network communication, but may also cause multiple instances to repeatedly execute the same query, thereby wasting computing resources. Especially for those instances with lower performance, this redundant reading will further increase their burden and seriously affect the performance of the overall system. Summary of the invention

[0003] Embodiments of the present disclosure provide a data query method, device, electronic device, storage medium, and computer program product.

[0004] According to a first aspect of an embodiment of the present disclosure, a data query method is provided, comprising: receiving a data query request sent by a client; the data query request at least includes a query question; determining at least one first query address according to the data query request; filtering the at least one first query address according to a pre-stored redundant address list to obtain at least one second query address; the redundant address list stores redundant addresses whose query results returned for the query question are empty; and sending the data query request to a database instance corresponding to the at least one second query address for data query.

[0005] In some exemplary embodiments of the present disclosure, filtering the at least one first query address according to a pre-stored redundant address list to obtain at least one second query address includes: determining, according to the query question, a redundant address in the redundant address list that matches the query question; and filtering the at least one first query address according to the redundant address to obtain the at least one second query address.

[0006] In some exemplary embodiments of the present disclosure, the method also includes: receiving a query result returned by a database instance corresponding to the at least one second query address; in response to the query result being not empty, returning the query result to the client; in response to the query result being empty, adding a third query address corresponding to the database instance to the redundant address list.

[0007] In some exemplary embodiments of the present disclosure, adding the third query address corresponding to the database instance to the redundant address list includes: using the query question as a key and the third query address as a value, and adding the third query address to the redundant address list.

[0008] In some exemplary embodiments of the present disclosure, adding the third query address corresponding to the database instance to the redundant address list includes: in response to the cache space of the redundant address list being not full, adding the third query address to the redundant address list; in response to the cache space of the redundant address list being full, replacing the redundant addresses in the redundant address list with the third query address in a first-in-first-out manner.

[0009] In some exemplary embodiments of the present disclosure, adding the third query address of the database instance to the redundant address list further includes: configuring a valid time for the third query address; the valid time is used to indicate the retention time of the third query address in the redundant address list.

[0010] In some exemplary embodiments of the present disclosure, filtering the at least one first query address according to a pre-stored redundant address list to obtain at least one second query address includes: determining a request type according to the data query request; in response to the request type being a target request type, filtering the at least one first query address according to the redundant address list to obtain the at least one second query address.

[0011] In some exemplary embodiments of the present disclosure, filtering the at least one first query address according to a pre-stored redundant address list to obtain at least one second query address includes: determining the number of addresses of the at least one first query address; in response to the number of addresses being greater than or equal to two, filtering the at least one first query address according to the redundant address list to obtain the at least one second query address.

[0012] In some exemplary embodiments of the present disclosure, the redundant address list is stored in a FreeCache cache library.

[0013] According to a second aspect of an embodiment of the present disclosure, a data query device is provided, comprising: a request receiving module, configured to receive a data query request sent by a client; the data query request includes at least a query question; an address query module, configured to determine at least one first query address according to the data query request; an address filtering module, configured to filter the at least one first query address according to a pre-stored redundant address list to obtain at least one second query address; the redundant address list stores redundant addresses whose query results returned for the query question are empty; and the data query module is configured to send the data query request to a database instance corresponding to the at least one second query address for data query.

[0014] According to a third aspect of an embodiment of the present disclosure, an electronic device is provided, characterized in that it includes: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to execute the executable instructions to implement any one of the data query methods described.

[0015] According to a fourth aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided. When instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute any one of the data query methods described.

[0016] According to a fifth aspect of an embodiment of the present disclosure, there is provided a computer program product, comprising a computer program / instruction, wherein the computer program / instruction implements any one of the data query methods when executed by a processor.

[0017] The data query method provided by the embodiment of the present disclosure filters multiple first query addresses determined according to the data query request through a pre-stored redundant address list to obtain at least one second query address; and sends the data query request to the database instance corresponding to the second query address for data query. The data query method can filter the query address based on the pre-stored redundant address list, thereby removing the redundant addresses where the query result is empty, solving the redundant read problem in the database proxy, and avoiding unnecessary network overhead and instance load pressure.

[0018] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] The accompanying drawings herein are incorporated into the specification and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the specification are used to explain the principles of the present disclosure. Obviously, the accompanying drawings described below are only some embodiments of the present disclosure, and for ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without creative work.

[0020] Figure 1 A schematic diagram showing an exemplary system architecture to which the method according to an embodiment of the present disclosure can be applied is shown.

[0021] Figure 2 The figure is a flow chart of a data query method according to an exemplary embodiment.

[0022] Figure 3 is a schematic diagram of a database system architecture according to an example.

[0023] Figure 4 The following is a flow chart of the address filtering process according to an example Figure 1 .

[0024] Figure 5 is a flow chart showing a redundant address list updating process according to an example.

[0025] Figure 6 The following is a flow chart of the address filtering process according to an example Figure 2 .

[0026] Figure 7 The following is a flow chart of the address filtering process according to an example Figure 3 .

[0027] Figure 8 It is a schematic flow chart of a data query process according to an exemplary embodiment.

[0028] Fig. 9 The invention is a block diagram of a data query device according to an exemplary embodiment.

[0029] Fig.10 It is a schematic diagram showing the structure of an electronic device suitable for implementing the exemplary embodiments of the present disclosure according to an exemplary embodiment. DETAILED DESCRIPTION

[0030] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in many forms and should not be construed as limited to the embodiments set forth herein; rather, these embodiments are provided so that this disclosure will be comprehensive and complete and will fully convey the concepts of the example embodiments to those skilled in the art. The same reference numerals in the figures represent the same or similar parts, and thus their repeated description will be omitted.

[0031] The features, structures or characteristics described in the present disclosure may be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present disclosure. However, those skilled in the art will appreciate that the technical solutions of the present disclosure may be practiced while omitting one or more of the specific details, or other methods, components, devices, steps, etc. may be adopted. In other cases, known methods, devices, implementations or operations are not shown or described in detail to avoid blurring the various aspects of the present disclosure.

[0032] The accompanying drawings are only schematic diagrams of the present disclosure, and the same reference numerals in the drawings represent the same or similar parts, so their repeated description will be omitted. Some block diagrams shown in the accompanying drawings do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software form, or implemented in at least one hardware module or integrated circuit, or implemented in different networks and / or processor devices and / or microcontroller devices.

[0033] The flowcharts shown in the accompanying drawings are only exemplary and do not necessarily include all the contents and steps, nor must they be executed in the order described. For example, some steps can be decomposed, and some steps can be combined or partially combined, so the actual execution order may change according to actual conditions.

[0034] In this specification, the terms "a", "an", "the", "said" and "at least one" are used to indicate the presence of at least one element / component / etc.; the terms "comprising", "including" and "having" are used to express an open-ended inclusion and mean that additional elements / components / etc. may exist in addition to the listed elements / components / etc.; the terms "first", "second" and "third" etc. are used only as labels and are not intended to limit the quantity of their objects.

[0035] Figure 1 A schematic diagram showing an exemplary system architecture to which the method according to an embodiment of the present disclosure can be applied is shown.

[0036] like Figure 1 As shown, the system architecture may include a server 101, a network 102, a terminal device 103, a terminal device 104, and a terminal device 105. The network 102 is used to provide a medium for a communication link between the terminal device 103, the terminal device 104, or the terminal device 105 and the server 101. The network 102 may include various connection types, such as wired, wireless communication links, or optical fiber cables, etc.

[0037] The server 101 may be a server that provides various services, such as a background management server that provides support for devices operated by users using the terminal device 103, the terminal device 104, or the terminal device 105. The background management server may analyze and process the received request and other data, and feed back the processing results to the terminal device 103, the terminal device 104, or the terminal device 105.

[0038] Terminal device 103, terminal device 104 and terminal device 105 can be a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a wearable smart device, a virtual reality device, an augmented reality device, etc., but are not limited thereto.

[0039] It should be understood that Figure 1 The number of terminal devices 103, terminal devices 104, terminal devices 105, networks 102 and servers 101 are merely illustrative. Server 101 may be a physical server, a server cluster consisting of multiple servers, or a cloud server. Depending on actual needs, any number of terminal devices, networks and servers may be provided.

[0040] Below, each step of the method in the exemplary embodiment of the present disclosure will be described in more detail with reference to the accompanying drawings and embodiments.

[0041] Figure 2 The figure is a flow chart of a data query method according to an exemplary embodiment. Figure 3 is a schematic diagram of a database system architecture according to an example. Figure 2 The method provided in the embodiment is applied to the client and can be executed by any electronic device, such as the above Figure 1 The terminal device in Figure 1 Servers in, or Figure 1 The terminal device and the server in the embodiment are jointly executed, but the present disclosure is not limited to this.

[0042] In step S210, a data query request sent by a client is received; the data query request at least includes a query question.

[0043] In the present disclosure, Figure 3As shown, in the database cluster architecture, data is usually stored in each database instance. In order to balance the load of each instance, it is usually necessary to set up a database proxy to be responsible for forwarding data query requests and returned results. The database proxy receives the data query request sent by the client, and forwards it to the corresponding database instance for data query according to the data query request, and then returns the query result returned by the instance to the client. The data query request is used to query specific data from the database. The data query request at least includes a query question. The query question is used to specify the target data to be queried.

[0044] In an exemplary embodiment, in a MySQL system, a client sends one or more SQL statements to a database agent to query data from a database. In the SQL statement, a query question of the target data to be queried is expressed through clauses such as SELECT.

[0045] In step S220, at least one first query address is determined according to the data query request.

[0046] In the embodiment of the present disclosure, the database agent determines the location of the database instance where the target data is located according to the data query request sent by the client, and then determines the query address of the corresponding database instance, that is, at least one first query address. If the database agent can clearly locate the query address of the instance according to the data query request, the data query request can be directly forwarded to the query address for data query. However, for some data query requests, the database agent cannot directly locate the clear instance query address. In order to pursue correctness, the database agent will expand the forwarding range of the data query request, and may group the data query request to multiple first query addresses, or even all database instances. This approach not only increases the overhead of network communication, but may also cause multiple instances to repeatedly execute the same query, thereby wasting computing resources. It should be noted that it is a common technical means in the art for the database agent to determine that the data query request is forwarded to one or more instances for data query based on the existing judgment rules according to the data query request. The present disclosure does not limit the specific judgment rules.

[0047] In an exemplary embodiment, taking Vitess as an example in a MySQL system, for scenarios where there is no obvious sharding key in the SQL statement, Vitess adopts a strategy of forwarding all queries to ensure the correctness of the query data. However, this has an impact on the performance of the database, especially in scenarios where different sharding keys use different storage media, access to storage media with poor performance will seriously reduce instance performance.

[0048] In step S230, the at least one first query address is filtered according to a pre-stored redundant address list to obtain at least one second query address; the redundant address list stores redundant addresses whose query results returned for the query question are empty.

[0049] In the disclosed embodiment, a cache area is set in the database proxy, and a redundant address list is pre-stored. The redundant address list stores redundant addresses whose query results returned for the query question are empty. The redundant address list can store data in the form of key-value pairs, wherein the query question is the key and the redundant address is the value. When the query result returned by a certain instance for a certain query question is empty, the query address of the instance is stored as a redundant address in the redundant address list. Since the redundant address list records the instance query address whose query result returned for the query question is empty, the redundant address matching the query question can be determined for the data query request sent by the client in the aforementioned step S210. Based on the above query, the redundant address list can mark the relevant redundant addresses. Based on the marked redundant address, the at least one first query address determined based on the existing judgment rule of the database proxy can be filtered, and the redundant address can be removed, thereby obtaining at least one second query address after filtering. Since the redundant address list has recorded the instance query addresses that return empty query results for the query problem, by filtering the at least one first query address through the redundant address list, the database can be skipped to execute related forwarding logic, and the empty results can be directly added to the total results in the database agent, thereby avoiding unnecessary network overhead and instance load pressure.

[0050] In an exemplary embodiment, since the amount of data in the redundant address list is relatively large, implementing the redundant address list with a native hashmap may cause a relatively large waste of resources. Based on this, a FreeCache cache library, a FastCache cache library, or a BigCache cache library with better garbage collection (GC) processing can be used to implement data storage for the redundant address list. Furthermore, since the LRU (Least Recently Used) cache elimination algorithm is more suitable for the application scenario requirements of the redundant address list, the FreeCache cache library is a better implementation.

[0051] In step S240, the data query request is sent to the database instance corresponding to the at least one second query address to perform data query.

[0052] In the disclosed embodiment, the database proxy forwards the data query request to the corresponding database instance based on the at least one second query address obtained after filtering to perform relevant data query.

[0053] In an exemplary embodiment, if Figure 3 As shown, the database cluster architecture includes instances 1-5. The client sends an SQL statement to the database agent. If the SQL statement does not conform to several simple SQL judgment modes, the database agent will group the SQL statement to instances 1-5 according to the judgment rules, that is, determine the five query addresses of instances 1-5 as the first query addresses. However, the redundant address list records that the query result returned by instance 3-5 for this query problem is empty. Based on this, the aforementioned first query address is filtered according to the redundant address list, and the query address of instance 3-5 is marked to obtain the filtered instances 1 and 2, that is, determine the two query addresses of instances 1 and 2 as the second query addresses. Therefore, after filtering through the redundant address list, the database agent only needs to forward the data query request to instances 1 and 2.

[0054] The data query method provided by the embodiment of the present disclosure filters multiple first query addresses determined according to the data query request through a pre-stored redundant address list to obtain at least one second query address; and sends the data query request to the database instance corresponding to the second query address for data query. The data query method can filter the query address based on the pre-stored redundant address list, thereby removing the redundant addresses where the query result is empty, solving the redundant read problem in the database proxy, and avoiding unnecessary network overhead and instance load pressure.

[0055] Figure 4 The following is a flow chart of the address filtering process according to an example Figure 1 .like Figure 4 As shown, the step S230 may include the following steps.

[0056] In step S410, based on the query question, redundant addresses matching the query question are determined in the redundant address list.

[0057] In the disclosed embodiment, the redundant address list stores data in the form of a key-value pair, wherein the query question is the key and the redundant address is the value. Based on the query question in the data query request, a query is performed in the redundant address list to determine a redundant address that matches the query question. The redundant address is an instance address for which the query result returned for the query question is empty. The redundant address may be one or more.

[0058] In step S420, the at least one first query address is filtered according to the redundant address to obtain the at least one second query address.

[0059] In the disclosed embodiment, the redundant address list can mark the queried redundant addresses. Based on the marked redundant addresses, the aforementioned at least one first query address is filtered to remove the redundant addresses therein, thereby obtaining at least one filtered second query address.

[0060] Figure 5 FIG. 1 is a flowchart showing a redundant address list update process according to an example. Figure 5 As shown, the data query method disclosed in the present invention may also include the following steps.

[0061] In step S510, a query result returned by the database instance corresponding to the at least one second query address is received.

[0062] In the disclosed embodiment, the database proxy sends the data query request to the database instance corresponding to the at least one second query address for data query, and then receives the query result returned by the relevant database instance. The relevant data query process belongs to the conventional technical means in this field and will not be described in detail here.

[0063] In step S520, in response to the query result being not empty, the query result is returned to the client.

[0064] In the disclosed embodiment, in response to the query result returned by the database instance being not empty, that is, the instance returns actual results, the query result is returned to the client.

[0065] In an exemplary embodiment, the query results returned by each instance may be first aggregated in the database proxy, and the database proxy generates a total result, which is then returned to the client.

[0066] In step S530, in response to the query result being empty, the third query address corresponding to the database instance is added to the redundant address list.

[0067] In the disclosed embodiment, in response to the query result returned by the database instance being empty, that is, the instance does not return actual results, the redundant address list is updated based on the third query address corresponding to the database instance. By updating the redundant address list, relevant information can be provided for subsequent data query processes, so that the third query address can be filtered out in the next data query request for the query problem, avoiding sending a data query request to the database instance for the query problem. In this way, the information in the redundant address list can be dynamically updated, thereby ensuring the effectiveness of the redundant address list in filtering the query address.

[0068] In an exemplary embodiment, the redundant address list stores the third query address in a key-value pair. Specifically, the third query address is added to the redundant address list using the query question of the data query request as the key and the third query address corresponding to the database instance as the value.

[0069] Since the cache space of the redundant address list is limited, it is necessary to optimize its data elimination mechanism and eliminate redundant addresses with low utilization rate in time to make more effective use of the relevant cache space.

[0070] In an exemplary embodiment, adding the third query address corresponding to the database instance to the redundant address list may include:

[0071] In response to the cache space of the redundant address list being not full, adding the third query address to the redundant address list;

[0072] In response to the cache space of the redundant address list being full, the redundant addresses in the redundant address list are replaced with the third query address in a first-in-first-out manner.

[0073] In this exemplary embodiment, the cache space of the redundant address list is used as a limiting condition. When the cache space of the redundant address list is not full, the third query address can be directly added to the redundant address list. When the cache space of the redundant address list is full, the third query address is used to replace the original redundant address in the redundant address list in a first-in-first-out manner. Through this elimination mechanism, it can be ensured that the redundant address stored in the redundant address list is the latest received third query address.

[0074] Specifically, the cache space of the redundant address list is a circular cache. The data set is divided into 256 segments by the hash value of the key. Each segment has only two pointers, one is a buffer for storing keys and values, and the other is an index slice for finding entries, with a total of 512 pointers. Each segment has its own lock. Based on this method, the redundant address list can support high concurrent access while avoiding the overhead of garbage collection by reducing pointers.

[0075] In an exemplary embodiment, adding the third query address corresponding to the database instance to the redundant address list may also include:

[0076] A valid time is configured for the third query address; the valid time is used to indicate the retention time of the third query address in the redundant address list.

[0077] In this exemplary embodiment, a valid time is configured for each redundant address in the redundant address list. The valid time is used to indicate the retention time of the address in the redundant address list. When the valid time expires, the corresponding redundant address is eliminated. In this way, the effective duration of each redundant address can be clearly managed. Moreover, through this mechanism, differentiated effective times can be configured for different redundant addresses, so as to more flexibly manage the duration of each redundant address.

[0078] The data query method provided by the embodiment of the present disclosure adds the third query address corresponding to the instance to the redundant address list when the query result returned by the instance is empty. In this way, the information in the redundant address list can be dynamically updated to ensure the effectiveness of the redundant address list in filtering the query address. At the same time, a data elimination mechanism is also set for the redundant addresses stored in the redundant address list to eliminate the redundant addresses with low utilization rate in time to make more effective use of the relevant cache space.

[0079] Figure 6 The following is a flow chart of the address filtering process according to an example Figure 2 .like Figure 6 As shown, the step S230 may include the following steps.

[0080] In step S610, a request type is determined according to the data query request.

[0081] As mentioned above, the present disclosure is aimed at the situation where the database proxy cannot directly locate the clear instance query address, and filters the query address of the group data query request to solve the system overhead caused by the redundant read problem. Therefore, not all data query requests need to go through the address filtering process of the aforementioned step S230. Therefore, it is necessary to judge whether the address filtering process needs to be performed before step S230.

[0082] In the embodiment of the present disclosure, the judgment is made based on the request type of the data query request. According to the data query request, its request type is determined. According to the request type, it is determined whether the query request involves the aforementioned situation where there is no clear instance query address and a group data query request is required, and whether an address filtering process is required is determined based on the relevant request type. It should be pointed out that judging whether the above-mentioned group data query request is involved based on the request type is common technical knowledge in the art, and the rules for type judgment can also be adjusted according to the needs of specific application scenarios. Therefore, the present disclosure does not limit the specific type judgment process here.

[0083] In step S620, in response to the request type being a target request type, the at least one first query address is filtered according to the redundant address list to obtain the at least one second query address.

[0084] In the embodiment of the present disclosure, based on the result of the aforementioned request type judgment, in response to the request type being a target request type, that is, involving the aforementioned situation where there is no clear instance query address and a group data query request needs to be sent, the address filtering process of the aforementioned step S230 is executed, and at least one first query address is filtered according to the redundant address list to obtain at least one second query address.

[0085] Figure 7 The following is a flow chart of the address filtering process according to an example Figure 3 .like Figure 7 As shown, the step S230 may include the following steps.

[0086] In step S710, the number of addresses of the at least one first query address is determined.

[0087] As mentioned above, the present disclosure is aimed at the situation where the database proxy cannot directly locate the clear instance query address, and filters the query address of the group data query request to solve the system overhead caused by the redundant read problem. Therefore, not all data query requests need to go through the address filtering process of the aforementioned step S230. Therefore, it is necessary to judge whether the address filtering process needs to be performed before step S230.

[0088] In the disclosed embodiment, the judgment is made based on the number of addresses of the first query address determined in step S220. If the number of addresses is unique, the data query request is directly forwarded to the first query address without the need to perform the address filtering process. If the number of addresses is not unique, that is, in the case of a group data query request, the address filtering process is required.

[0089] In step S720, in response to the number of addresses being greater than or equal to two, the at least one first query address is filtered according to the redundant address list to obtain the at least one second query address.

[0090] In the embodiment of the present disclosure, based on the result of the aforementioned request type judgment, in response to the situation where the number of addresses is greater than or equal to two, that is, it involves a group data query request, the address filtering process of the aforementioned step S230 is executed, and at least one first query address is filtered according to the redundant address list to obtain at least one second query address.

[0091] The data query method provided by the embodiment of the present disclosure sets a judgment process before address filtering. When address filtering is required, the mechanism of address filtering based on the redundant address list is activated. Otherwise, the data query request is directly forwarded to the instance of the target query address to further optimize the efficiency of related processing.

[0092] Figure 8 FIG. 1 is a schematic flow chart of a data query process according to an exemplary embodiment. Figure 8 As shown, the data query process disclosed in the present invention may include the following processes.

[0093] The database agent receives data query requests sent by the client.

[0094] The database proxy determines the first query address set of the instance to which the data query request needs to be forwarded based on the existing judgment rules. If the data query request has a clear instance query address, it is directly forwarded to the target query address (not shown in the figure). If the data query request meets the judgment rules but has multiple target query addresses, the first query address set is sent to the address filtering module. If the data query request does not meet the judgment rules and needs to be group-sent, the first query address set is sent to the address filtering module.

[0095] The address filtering module pre-stores a redundant address list. Based on the redundant address list, the address filtering module filters the first query address set according to the query question of the data query request to determine a filtered second query address set.

[0096] The database proxy forwards the data query request to the database instance corresponding to the second query address set for data query.

[0097] Each database instance returns the query results to the database proxy.

[0098] The database agent judges each query result. If the query result is empty, the redundant address list is updated based on the query address of the database instance. If the query result is not empty, the query result is returned to the client.

[0099] The following are embodiments of the device disclosed herein, which can be used to execute the method embodiments disclosed herein. For details not disclosed in the device embodiments disclosed herein, please refer to the method embodiments disclosed herein.

[0100] Fig. 9 is a block diagram of a data query device according to an exemplary embodiment. Fig. 9 The data query device 900 may include: a request receiving module 910, an address query module 920, an address filtering module 930 and a data query module 940.

[0101] The request receiving module 910 is configured to receive a data query request sent by a client; the data query request at least includes a query question.

[0102] The address query module 920 is configured to determine at least one first query address according to the data query request.

[0103] The address filtering module 930 is configured to filter the at least one first query address according to a pre-stored redundant address list to obtain at least one second query address; the redundant address list stores redundant addresses whose query results returned for the query question are empty.

[0104] The data query module 940 is configured to send the data query request to the database instance corresponding to the at least one second query address to perform data query.

[0105] In some exemplary embodiments of the present disclosure, the address filtering module 930 is further configured to determine, based on the query question, a redundant address in the redundant address list that matches the query question; and filter, based on the redundant address, the at least one first query address to obtain the at least one second query address.

[0106] In some exemplary embodiments of the present disclosure, the query result processing module is configured to receive the query result returned by the database instance corresponding to the at least one second query address; in response to the query result being not empty, return the query result to the client; in response to the query result being empty, add the third query address corresponding to the database instance to the redundant address list.

[0107] In some exemplary embodiments of the present disclosure, the query result processing module is further configured to add the third query address to the redundant address list using the query question as a key and the third query address as a value.

[0108] In some exemplary embodiments of the present disclosure, the query result processing module is also configured to, in response to the cache space of the redundant address list being not full, add the third query address to the redundant address list; in response to the cache space of the redundant address list being full, replace the redundant addresses in the redundant address list with the third query address in a first-in-first-out manner.

[0109] In some exemplary embodiments of the present disclosure, the query result processing module is further configured to configure a valid time for the third query address; the valid time is used to indicate a retention time of the third query address in the redundant address list.

[0110] In some exemplary embodiments of the present disclosure, the address filtering module 930 is also configured to determine the request type based on the data query request; in response to the request type being a target request type, filter the at least one first query address according to the redundant address list to obtain the at least one second query address.

[0111] In some exemplary embodiments of the present disclosure, the address filtering module 930 is also configured to determine the number of addresses of the at least one first query address; in response to the number of addresses being greater than or equal to two, filter the at least one first query address according to the redundant address list to obtain the at least one second query address.

[0112] In some exemplary embodiments of the present disclosure, the redundant address list is stored in a FreeCache cache library.

[0113] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.

[0114] Refer to the following Fig.10 hereinafter describes the electronic device 1000 according to such an embodiment of the present disclosure. Fig.10 The electronic device 1000 shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.

[0115] like Fig.10 As shown, the electronic device 1000 is in the form of a general computing device. The components of the electronic device 1000 may include but are not limited to: the at least one processing unit 1010, the at least one storage unit 1020, a bus 1030 connecting different system components (including the storage unit 1020 and the processing unit 1010), and a display unit 1040.

[0116] The storage unit stores program codes, which can be executed by the processing unit 1010, so that the processing unit 1010 performs the steps according to various exemplary embodiments of the present disclosure described in the above “Exemplary Method” section of this specification. For example, the processing unit 1010 can perform the following steps: Figure 2 The steps shown.

[0117] For example, electronic devices can achieve Figure 2 The steps shown.

[0118] The storage unit 1020 may include a readable medium in the form of a volatile storage unit, such as a random access memory unit (RAM) 1021 and / or a cache memory unit 1022 , and may further include a read-only memory unit (ROM) 1023 .

[0119] The storage unit 1020 may also include a program / utility 1024 having a set (at least one) of program modules 1025, such program modules 1025 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.

[0120] Bus 1030 may represent one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.

[0121] The electronic device 1000 may also communicate with one or more external devices 1070 (e.g., keyboards, pointing devices, Bluetooth devices, etc.), may also communicate with one or more devices that enable a user to interact with the electronic device 1000, and / or communicate with any device that enables the electronic device 1000 to communicate with one or more other computing devices (e.g., routers, modems, etc.). Such communication may be performed via an input / output (I / O) interface 1050. Furthermore, the electronic device 1000 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) via a network adapter 1060. As shown, the network adapter 1060 communicates with other modules of the electronic device 1000 via a bus 1030. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 1000, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0122] Through the description of the above embodiments, it is easy for those skilled in the art to understand that the example embodiments described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the embodiment of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which can be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the embodiment of the present disclosure.

[0123] In an exemplary embodiment, a computer-readable storage medium including instructions is also provided, such as a memory including instructions, and the above instructions can be executed by a processor of the device to complete the above method. Optionally, the computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.

[0124] In an exemplary embodiment, a computer program product is also provided, including a computer program / instruction, and when the computer program / instruction is executed by a processor, the method in the above embodiment is implemented.

[0125] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.

[0126] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims

1. A data query method, characterized in that: include: Receive a data query request sent by a client; The data query request at least includes a query question; Determining at least one first query address according to the data query request; According to a pre-stored redundant address list, the at least one first query address is filtered to obtain at least one second query address; the redundant address list stores redundant addresses for which the query results returned for the query question are empty; The data query request is sent to the database instance corresponding to the at least one second query address for data query.

2. The method according to claim 1, characterized in that The filtering of the at least one first query address according to the pre-stored redundant address list to obtain at least one second query address includes: According to the query question, determining a redundant address matching the query question in the redundant address list; The at least one first query address is filtered according to the redundant address to obtain the at least one second query address.

3. The method according to claim 1, characterized in that The method further comprises: Receiving a query result returned by the database instance corresponding to the at least one second query address; In response to the query result being not empty, returning the query result to the client; In response to the query result being empty, adding the third query address corresponding to the database instance to the redundant address list.

4. The method according to claim 3, characterized in that: The adding the third query address corresponding to the database instance to the redundant address list includes: Using the query question as a key and the third query address as a value, the third query address is added to the redundant address list.

5. The method according to claim 3, characterized in that: The adding the third query address corresponding to the database instance to the redundant address list includes: In response to the cache space of the redundant address list being not full, adding the third query address to the redundant address list; In response to the cache space of the redundant address list being full, the redundant addresses in the redundant address list are replaced with the third query address in a first-in-first-out manner.

6. The method according to claim 3, characterized in that The adding the third query address of the database instance to the redundant address list further includes: A valid time is configured for the third query address; the valid time is used to indicate the retention time of the third query address in the redundant address list.

7. The method according to claim 1, characterized in that The filtering the at least one first query address according to the pre-stored redundant address list to obtain at least one second query address includes: Determine a request type according to the data query request; In response to the request type being a target request type, the at least one first query address is filtered according to the redundant address list to obtain the at least one second query address.

8. The method according to claim 1, characterized in that The filtering of the at least one first query address according to the pre-stored redundant address list to obtain at least one second query address includes: determining the number of addresses of the at least one first query address; In response to the number of addresses being greater than or equal to two, the at least one first query address is filtered according to the redundant address list to obtain the at least one second query address.

9. The method according to claim 1, characterized in that: The redundant address list is stored in the FreeCache cache library.

10. A data query device, characterized in that: include: A request receiving module, configured to receive a data query request sent by a client; The data query request at least includes a query question; An address query module, configured to determine at least one first query address according to the data query request; The address filtering module is configured to filter the at least one first query address according to a pre-stored redundant address list to obtain at least one second query address; the redundant address list stores redundant addresses whose query results returned for the query question are empty; The data query module is configured to send the data query request to the database instance corresponding to the at least one second query address to perform data query.

11. An electronic device, characterized in that: include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the executable instructions to implement the data query method according to any one of claims 1 to 9. 12 . A computer-readable storage medium, when instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the data query method according to any one of claims 1 to 9.

13. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the data query method according to any one of claims 1 to 9 is implemented.