Business query method, device, equipment and medium

By acquiring business-related data and constructing the actual probability distribution of sharding keys using Bayesian estimation, the target sharding key is selected, which solves the problem of complexity in sharding key selection in distributed databases and improves query performance, especially in financial business scenarios.

CN117493421BActive Publication Date: 2026-06-12AGRICULTURAL BANK OF CHINA

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
AGRICULTURAL BANK OF CHINA
Filing Date
2023-12-07
Publication Date
2026-06-12

AI Technical Summary

Technical Problem

In distributed relational databases, choosing the appropriate sharding key is a complex and critical process that affects cluster performance and query efficiency. Existing technologies struggle to effectively improve business query performance.

Method used

By acquiring business-related data within a preset time period, the reference probability distribution and query performance data of candidate sharding keys are determined. The actual probability distribution of sharding keys is constructed using Bayesian estimation methods, and the target sharding key is selected for querying.

Benefits of technology

It improves the accuracy of determining sharding keys and query performance, optimizes the query efficiency of business processing databases, and significantly improves query performance, especially in financial business scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117493421B_ABST
    Figure CN117493421B_ABST
Patent Text Reader

Abstract

Embodiments of the present application disclose a service query method, device, equipment and medium. The method comprises: acquiring service association data related to a to-be-processed service in a preset time period; determining, according to the service association data, a shard key reference probability distribution and query performance data of each candidate shard key in a service processing database; determining, according to the shard key reference probability distribution and the query performance data, a shard key actual probability distribution of each candidate shard key; selecting a target shard key from the candidate shard keys according to the shard key actual probability distribution; and querying the to-be-processed service according to the target shard key. The above scheme improves the service query performance of the service processing database.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to the field of database technology, and in particular to a business query method, apparatus, device and medium. Background Technology

[0002] Distributed relational databases (such as TDSQL) support sharding for horizontal scaling. Choosing a suitable sharding key is crucial during the sharding process, as it directly impacts cluster performance and query efficiency. Selecting the appropriate sharding key is a complex process that requires analyzing query data and index hit counts. Therefore, improving the performance of business queries based on distributed databases is of paramount importance. Summary of the Invention

[0003] This invention provides a business query method, apparatus, device, and medium to improve business query performance.

[0004] This invention provides a business query method, including:

[0005] Obtain business-related data related to the pending business within a preset time period;

[0006] Based on the business-related data, determine the sharding key reference probability distribution and query performance data of each candidate sharding key in the business processing database;

[0007] Based on the reference probability distribution of the sharding key and the query performance data, determine the actual probability distribution of each candidate sharding key;

[0008] Based on the actual probability distribution of the sharding keys, select the target sharding key from the candidate sharding keys;

[0009] The pending business is queried based on the target sharding key.

[0010] According to another aspect of the present invention, a business query device is provided, comprising:

[0011] The business-related data acquisition module is used to acquire business-related data related to the business to be processed within a preset time period;

[0012] The probability data determination module is used to determine the reference probability distribution of shard keys and query performance data of each candidate shard key in the business processing database based on the business-related data.

[0013] The probability distribution determination module is used to determine the actual probability distribution of each candidate shard key based on the shard key reference probability distribution and the query performance data.

[0014] The target sharding key selection module is used to select a target sharding key from the candidate sharding keys according to the actual probability distribution of the sharding keys;

[0015] The business query module is used to query the business to be processed based on the target sharding key.

[0016] According to another aspect of the present invention, an electronic device is provided, comprising:

[0017] One or more processors;

[0018] Memory, used to store one or more programs;

[0019] When one or more programs are executed by one or more processors, the one or more processors are able to execute any of the business query methods provided in the embodiments of the present invention.

[0020] According to another aspect of the present invention, a computer-readable storage medium is provided, which stores computer instructions for causing a processor to execute any of the business query methods provided in the embodiments of the present invention.

[0021] This invention provides a business query scheme, which involves: acquiring business-related data concerning the business to be processed within a preset time period; determining the reference probability distribution and query performance data of each candidate shard key in the business processing database based on the business-related data; determining the actual probability distribution of each candidate shard key based on the reference probability distribution and query performance data; selecting a target shard key from the candidate shard keys based on the actual probability distribution; and querying the business to be processed based on the target shard key. This scheme improves the accuracy of the determined actual probability distribution of shard keys by determining the actual probability distribution of each candidate shard key based on the reference probability distribution and query performance data, thereby improving the accuracy of the determined target shard key; simultaneously, executing the business to be processed based on the determined target shard key improves the business query performance of the business processing database.

[0022] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description

[0023] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0024] Figure 1 This is a flowchart of a business query method provided in Embodiment 1 of the present invention;

[0025] Figure 2 This is a flowchart of a business query method provided in Embodiment 2 of the present invention;

[0026] Figure 3 This is a schematic diagram of the structure of a business query device provided in Embodiment 3 of the present invention;

[0027] Figure 4 This is a schematic diagram of the structure of an electronic device for implementing a business query method, provided in Embodiment 4 of the present invention. Detailed Implementation

[0028] The present invention will now be described in further detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and not intended to limit it. Furthermore, it should be noted that, for ease of description, the accompanying drawings show only the parts relevant to the present invention, and not all of the structures.

[0029] TDSQL is a relational database that supports distributed transactions. Sharding keys are used to distribute data across different shards. Bayesian estimation is a statistical method used to update probability distributions based on known data.

[0030] Example 1

[0031] Figure 1 This is a flowchart of a business query method provided in Embodiment 1 of the present invention. This embodiment is applicable to the situation of business query based on database. The method can be executed by a business query device, which can be implemented in software and / or hardware and can be configured in an electronic device that carries the business query function.

[0032] See Figure 1 The business query methods shown include:

[0033] S110. Obtain business-related data related to the business to be processed within a preset time period.

[0034] In this context, "business pending processing" refers to business transactions that require processing. This embodiment of the invention does not limit the type of business pending processing; it can be set by technical personnel based on experience. For example, business pending processing can be corporate financial transactions of a financial institution.

[0035] The preset time period refers to a pre-defined period for data collection. This embodiment of the invention does not limit the length of the preset time period; it can be set by a technician based on experience. For example, the preset time period can be one month, one quarter, or one year. Preferably, the preset time period is longer than one year.

[0036] In this invention, business-related data refers to data associated with business operations. This embodiment of the invention does not limit the scope of business-related data; it can be set by technical personnel based on experience. This embodiment of the invention also does not limit the method of obtaining business-related data; it can be set by technical personnel based on experience. For example, TDSQL log analysis tools and / or monitoring tools (TDSQL Monitor) can be used to obtain business-related data. For instance, TDSQL log analysis tools can be used to extract information from slow query logs, such as query statements, execution times, and query conditions. Emphasis can be placed on queries involving resource interaction identifiers between financial institutions and other institutions, institutional customer information, and resource interaction records, and the extracted data can be used as business-related data. For instance, monitoring tools (TDSQLMonitor) can be used to collect index usage information, such as index hit rate and index scan counts. Emphasis can be placed on indexes related to business operations with other institutions, and the extracted data can be used as business-related data.

[0037] It should be noted that the format of the acquired business-related data can be processed to make the data format a structured data format for subsequent processing.

[0038] Specifically, determine the business type of the business to be processed; obtain business-related data of the same business type within a preset time period. Here, business type refers to the type of business to be processed.

[0039] S120. Based on the business-related data, determine the reference probability distribution of shard keys and query performance data for each candidate shard key in the business processing database.

[0040] In this context, the business processing database refers to the database that executes the business processes to be processed. This embodiment of the invention does not limit the type of business processing database. For example, the business processing database can be a relational database that supports distributed transactions, such as TDSQL.

[0041] In this context, a candidate sharding key refers to a sharding key in the business processing database that can execute the pending business. This embodiment of the invention does not limit the type of candidate sharding key; it can be set by technical personnel based on experience. For example, the type of candidate sharding key can be determined according to the application scenario. If the application scenario is a financial business scenario between a financial institution and other institutions, the candidate sharding key may include institution identifiers, resource interaction identifiers between the financial institution and other institutions, and resource interaction serial numbers, etc.

[0042] The sharding key reference probability distribution refers to the prior probability distribution of candidate sharding keys. For example, the sharding key reference probability distribution can be a uniform distribution or a normal distribution. Specifically, the sharding key reference probability distribution can be predicted based on business-related data.

[0043] Query performance data is used to characterize the query performance of candidate sharding keys under different query conditions. Specifically, query performance data can be used to analyze the performance differences of different candidate sharding keys under different query conditions. This embodiment of the invention does not limit the type of query performance data; it can be set by those skilled in the art based on experience. For example, query performance data may include average query time and query success rate, etc.

[0044] Specifically, based on the business-related data, a sharding key reference probability distribution is assigned to each candidate sharding key; based on the business-related data, the query performance data of each candidate sharding key under different query conditions is calculated.

[0045] S130. Based on the sharding key reference probability distribution and query performance data, determine the actual sharding key probability distribution for each candidate sharding key.

[0046] The actual probability distribution of the fragmentation key refers to the posterior probability distribution of the candidate fragmentation key.

[0047] In one optional embodiment, the actual probability distribution of each candidate shard key is determined based on the shard key reference probability distribution and query performance data, including: determining the performance evaluation probability of each candidate shard key based on business association data; and determining the actual probability distribution of the corresponding candidate shard key based on the shard key reference probability distribution, query performance data, and performance evaluation probability.

[0048] Here, performance evaluation probability refers to the likelihood probability of a candidate sharding key. For example, the significance of performance probability evaluation is to measure the probability of query performance data under a given query condition. By calculating the performance evaluation probability, query performance under specific query conditions can be assessed, and the query performance of different candidate sharding keys can be compared and selected. A candidate sharding key with a higher performance evaluation probability indicates that, under a given query condition, the query performance data of that candidate sharding key is more consistent with the actual observed data, thus it can be more reliably used for query optimization and performance improvement. Optionally, the performance evaluation probability can be calculated using collected business-related data, calculating the performance evaluation probability P(D|C), where query condition C is the query condition related to a specific candidate sharding key, and query performance data D is the execution time related to that query condition.

[0049] In an optional embodiment, the actual probability distribution of sharding keys can be determined using a probabilistic model. For example, a reference probability distribution of sharding keys, performance evaluation probabilities, and query performance data are input into the probabilistic model, and the actual probability distribution of sharding keys is output. The query performance data is used to construct the probabilistic model. By collecting and analyzing query performance data, the query performance of different candidate sharding keys under different query conditions can be understood, and then used to construct the probabilistic model to predict the performance probability distribution of each candidate sharding key under various query conditions. The probabilistic model can be used to predict the performance probability distribution of each candidate sharding key under different query conditions, i.e., the actual probability distribution of sharding keys. The inputs to the probabilistic model include the reference probability distribution of sharding keys and the query performance data. The reference probability distribution describes the prior prediction for each candidate sharding key, and the query performance data reflects the actual query performance. The output of the probabilistic model is the actual probability distribution of sharding keys, representing the performance probability distribution of each candidate sharding key given the query performance data. The training process of the probabilistic model is implemented using a Bayesian estimation method.

[0050] In this embodiment of the invention, a Bayesian network model is used to determine the actual probability distribution of sharding keys, which can be used to obtain the impact of different candidate sharding keys on the performance of financial business queries between financial institutions and other institutions.

[0051] Understandably, by introducing performance evaluation probabilities, and by determining the actual probability distribution of the corresponding candidate sharding keys based on the sharding key reference probability distribution, query performance data, and performance evaluation probabilities, the accuracy of the determined actual probability distribution of sharding keys is improved.

[0052] S140. Select the target sharding key from the candidate sharding keys according to the actual probability distribution of the sharding key.

[0053] The target shard key refers to the shard key used to execute the pending business transaction. Specifically, the target shard key can deliver the best performance for financial business queries.

[0054] S150. Query the business to be processed based on the target sharding key.

[0055] Specifically, the target sharding key is applied to the TDSQL cluster to improve the query performance and efficiency of financial transactions between financial institutions and other institutions. Further, appropriate testing and monitoring can be conducted to verify the performance improvements and make necessary adjustments.

[0056] This invention provides a business query scheme, which involves: acquiring business-related data concerning the business to be processed within a preset time period; determining the reference probability distribution and query performance data of each candidate shard key in the business processing database based on the business-related data; determining the actual probability distribution of each candidate shard key based on the reference probability distribution and query performance data; selecting a target shard key from the candidate shard keys based on the actual probability distribution; and querying the business to be processed based on the target shard key. This scheme improves the accuracy of the determined actual probability distribution of shard keys by determining the actual probability distribution of each candidate shard key based on the reference probability distribution and query performance data, thereby improving the accuracy of the determined target shard key; simultaneously, executing the business to be processed based on the determined target shard key improves the business query performance of the business processing database.

[0057] Example 2

[0058] Figure 2 This is a flowchart of a business query method provided in Embodiment 2 of the present invention. Based on the above embodiments, this embodiment further refines the operation of "selecting a target shard key from candidate shard keys according to the actual probability distribution of the shard key" into "determining a first reference shard key from each candidate shard key according to the actual probability distribution of the shard key; evaluating the actual probability distribution of each candidate shard key based on the shard key evaluation criteria to determine a second reference shard key; and determining the target shard key based on the first and second reference shard keys," thereby improving the target shard key determination mechanism. It should be noted that for parts not detailed in this embodiment, please refer to the descriptions in other embodiments.

[0059] See Figure 2 The business query methods shown include:

[0060] S210. Obtain business-related data related to the business to be processed within a preset time period.

[0061] S220. Based on the business-related data, determine the reference probability distribution of sharding keys and query performance data for each candidate sharding key in the business processing database.

[0062] S230. Based on the sharding key reference probability distribution and query performance data, determine the actual probability distribution of each candidate sharding key.

[0063] S240. Determine the first reference sharding key from each candidate sharding key based on the actual probability distribution of the sharding key.

[0064] The first reference sharding key refers to the sharding key that is initially determined and can be used to execute the pending business.

[0065] In an optional embodiment, determining a first reference sharding key from each candidate sharding key according to the actual probability distribution of the sharding key includes: determining a target probability distribution of the sharding key with the maximum probability value from the actual probability distribution of the sharding keys corresponding to each candidate sharding key; and taking the candidate sharding key corresponding to the target probability distribution of the sharding key as the first reference sharding key.

[0066] The target probability distribution of the shard key refers to the actual probability distribution of the shard key that has the maximum probability value. In this embodiment of the invention, the actual probability distribution of the shard key includes multiple actual probabilities of the shard key. The actual probabilities of the shard keys in each actual probability distribution are compared; the actual probability distribution of the shard key with the maximum actual probability is determined, which is the target probability distribution of the shard key; and the candidate shard key corresponding to the target probability distribution of the shard key is used as the first reference shard key.

[0067] Understandably, by using the candidate sharding key corresponding to the target probability distribution of the sharding key with the maximum probability value as the first reference sharding key, the accuracy of the determined first reference sharding key is improved.

[0068] S250. Based on the fragmentation key evaluation criteria, evaluate the actual probability distribution of each candidate fragmentation key to determine the second reference fragmentation key.

[0069] The sharding key evaluation criterion refers to the criteria used to select the optimal sharding key. For example, the sharding key evaluation criterion could be the Bayesian Information Criterion (BIC). The second reference sharding key refers to the sharding key determined based on the sharding key evaluation criterion that can be used to execute the pending business.

[0070] In one optional embodiment, the actual probability distribution of each candidate fragment key is evaluated based on the fragment key evaluation criterion to determine the second reference fragment key, including: evaluating the actual probability distribution of each candidate fragment key based on the fragment key evaluation criterion to obtain probability evaluation data; and determining the second reference fragment key from each candidate fragment key based on the probability evaluation data.

[0071] Among them, the probability evaluation data refers to the data used to evaluate and obtain the second reference fragment key.

[0072] For example, based on the Bayesian information criterion, the actual probability distribution of each candidate sharding key is evaluated to obtain probability evaluation data corresponding to each candidate sharding key; the probability evaluation data are then sorted; and based on the sorting results, a second reference sharding key is determined from among the candidate sharding keys. Specifically, the candidate sharding key corresponding to the smallest probability evaluation data is taken as the second reference sharding key.

[0073] Understandably, determining the second reference fragmentation key based on probability assessment data improves the accuracy of the determined second reference fragmentation key.

[0074] S260. Determine the target fragment key based on the first reference fragment key and the second reference fragment key.

[0075] For example, if the first reference sharding key is the same as the second reference sharding key, then the first reference sharding key is used as the target sharding key; if the first reference sharding key is different from the second reference sharding key, then the second reference sharding key is used as the target sharding key. In this embodiment of the invention, the second reference sharding key is the optimal sharding key for executing the service to be processed.

[0076] S270. Query the business to be processed based on the target sharding key.

[0077] According to an embodiment of the present invention, a business query scheme refines the operation of selecting a target shard key from candidate shard keys based on the actual probability distribution of the shard key into determining a first reference shard key from each candidate shard key based on the actual probability distribution of the shard key; evaluating the actual probability distribution of each candidate shard key based on shard key evaluation criteria to determine a second reference shard key; and determining the target shard key based on the first and second reference shard keys, thus improving the target shard key determination mechanism. This scheme, by introducing a first and second reference shard key, achieves multi-dimensional determination of the target shard key, improving the accuracy of the determined target shard key.

[0078] Based on the above technical solutions, this invention provides a method for determining TDSQL shard keys using Bayesian estimation. This method involves acquiring business-related data, constructing a probability model, determining the actual probability distribution of shard keys, selecting target shard keys, and executing queries for the business to be processed. Specifically, in this invention, by analyzing the actual probability distribution of shard keys, the target shard key with the highest probability can be identified, i.e., the one with the best query performance. When calculating the actual probability distribution of shard keys, a reference probability distribution and a performance evaluation probability need to be introduced. Using Bayes' theorem, combined with the reference probability distribution and the performance evaluation probability, a reference actual probability distribution can be calculated. Based on the reference actual probability distribution, the performance probability distribution of each candidate shard key can be derived given the query performance data, thus selecting the target shard key with the highest probability as the optimal choice.

[0079] This invention focuses on data collection and analysis within financial institutions' business scenarios, closely aligning with actual business needs and improving the targeted nature of query performance optimization. By using Bayesian estimation to analyze slow queries and index hit counts, the appropriate sharding key can be determined more accurately. Under different query conditions, the Bayesian estimation method is fully utilized to select the optimal sharding key, further optimizing database query efficiency. This invention is easy to implement, has broad application value, and can be widely used in the optimization and management of TDSQL clusters.

[0080] Example 3

[0081] Figure 3 This is a schematic diagram of a business query device provided in Embodiment 3 of the present invention. This embodiment is applicable to situations where business queries are performed based on a database. The method can be executed by a business query device, which can be implemented in software and / or hardware and can be configured in an electronic device that carries the business query function.

[0082] like Figure 3 As shown, the device includes: a business-related data acquisition module 310, a probability data determination module 320, a probability distribution determination module 330, a target sharding key selection module 340, and a business query module 350.

[0083] in,

[0084] The business-related data acquisition module 310 is used to acquire business-related data related to the business to be processed within a preset time period.

[0085] The probability data determination module 320 is used to determine the reference probability distribution of shard keys and query performance data of each candidate shard key in the business processing database based on the business-related data.

[0086] The probability distribution determination module 330 is used to determine the actual probability distribution of each candidate shard key based on the shard key reference probability distribution and the query performance data.

[0087] The target sharding key selection module 340 is used to select a target sharding key from the candidate sharding keys according to the actual probability distribution of the sharding keys;

[0088] The business query module 350 is used to query the business to be processed based on the target sharding key.

[0089] This invention provides a business query scheme, which involves: acquiring business-related data concerning the business to be processed within a preset time period; determining the reference probability distribution and query performance data of each candidate shard key in the business processing database based on the business-related data; determining the actual probability distribution of each candidate shard key based on the reference probability distribution and query performance data; selecting a target shard key from the candidate shard keys based on the actual probability distribution; and querying the business to be processed based on the target shard key. This scheme improves the accuracy of the determined actual probability distribution of shard keys by determining the actual probability distribution of each candidate shard key based on the reference probability distribution and query performance data, thereby improving the accuracy of the determined target shard key; simultaneously, executing the business to be processed based on the determined target shard key improves the business query performance of the business processing database.

[0090] Optionally, the target sharding key selection module includes:

[0091] The first reference fragment key determination unit is used to determine the first reference fragment key from each of the candidate fragment keys according to the actual probability distribution of the fragment key;

[0092] The second reference fragment key determination unit is used to evaluate the actual probability distribution of each candidate fragment key based on the fragment key evaluation criteria, and determine the second reference fragment key.

[0093] The target fragment key determination unit is used to determine the target fragment key based on the first reference fragment key and the second reference fragment key.

[0094] Optionally, the first reference fragment key determination unit is specifically used for:

[0095] From the actual probability distribution of the fragment keys corresponding to each of the candidate fragment keys, determine the target probability distribution of the fragment key with the maximum probability value;

[0096] The candidate sharding keys corresponding to the target probability distribution of the sharding keys are used as the first reference sharding keys.

[0097] Optionally, the second reference fragment key determination unit is specifically used for:

[0098] Based on the fragmentation key evaluation criteria, the actual probability distribution of each candidate fragmentation key is evaluated to obtain probability evaluation data;

[0099] Based on the probability evaluation data, the second reference fragment key is determined from each of the candidate fragment keys.

[0100] Optionally, the probability distribution determination module is specifically used for:

[0101] Based on the business-related data, determine the performance evaluation probability of each candidate sharding key;

[0102] Based on the reference probability distribution of the sharding key, the query performance data, and the performance evaluation probability, the actual probability distribution of the sharding key for the corresponding candidate sharding key is determined.

[0103] The business query device provided in the embodiments of the present invention can execute the business query method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects for executing each business query method.

[0104] The collection, storage, use, processing, transmission, provision, and disclosure of business-related data involved in the technical solution of this invention all comply with the provisions of relevant laws and regulations and do not violate public order and good morals.

[0105] Example 4

[0106] Figure 4 This is a schematic diagram of the structure of an electronic device for implementing a business query method according to Embodiment 4 of the present invention. The electronic device 410 is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (such as helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.

[0107] like Figure 4As shown, the electronic device 410 includes at least one processor 411 and a memory, such as a read-only memory (ROM) 412 or a random access memory (RAM) 413, communicatively connected to the at least one processor 411. The memory stores computer programs executable by the at least one processor. The processor 411 can perform various appropriate actions and processes based on the computer program stored in the ROM 412 or loaded from storage unit 418 into the RAM 413. The RAM 413 may also store various programs and data required for the operation of the electronic device 410. The processor 411, ROM 412, and RAM 413 are interconnected via a bus 414. An input / output (I / O) interface 415 is also connected to the bus 414.

[0108] Multiple components in electronic device 410 are connected to I / O interface 415, including: input unit 416, such as keyboard, mouse, etc.; output unit 417, such as various types of displays, speakers, etc.; storage unit 418, such as disk, optical disk, etc.; and communication unit 419, such as network card, modem, wireless transceiver, etc. Communication unit 419 allows electronic device 410 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0109] Processor 411 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 411 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 411 performs the various methods and processes described above, such as business query methods.

[0110] In some embodiments, the business query method may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 418. In some embodiments, part or all of the computer program may be loaded and / or installed on electronic device 410 via ROM 412 and / or communication unit 419. When the computer program is loaded into RAM 413 and executed by processor 411, one or more steps of the business query method described above may be performed. Alternatively, in other embodiments, processor 411 may be configured to execute the business query method by any other suitable means (e.g., by means of firmware).

[0111] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.

[0112] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0113] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.

[0114] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).

[0115] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or computing systems that include middleware components (e.g., application servers), or computing systems that include frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.

[0116] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.

[0117] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.

[0118] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.

Claims

1. A service query method, characterized by, include: Obtain business-related data related to the pending business within a preset time period; Based on the business-related data, determine the sharding key reference probability distribution and query performance data of each candidate sharding key in the business processing database; Based on the reference probability distribution of the sharding key and the query performance data, determine the actual probability distribution of each candidate sharding key; Based on the actual probability distribution of the sharding keys, select the target sharding key from the candidate sharding keys; The pending business is queried based on the target sharding key.

2. The method according to claim 1, characterized in that, The step of selecting a target sharding key from the candidate sharding keys based on the actual probability distribution of the sharding key includes: Based on the actual probability distribution of the fragmentation key, a first reference fragmentation key is determined from each of the candidate fragmentation keys; Based on the fragmentation key evaluation criteria, the actual probability distribution of each candidate fragmentation key is evaluated to determine the second reference fragmentation key; The target fragment key is determined based on the first reference fragment key and the second reference fragment key.

3. The method according to claim 2, characterized in that, The step of determining the first reference sharding key from the candidate sharding keys based on the actual probability distribution of the sharding key includes: From the actual probability distribution of the fragment keys corresponding to each of the candidate fragment keys, determine the target probability distribution of the fragment key with the maximum probability value; The candidate sharding keys corresponding to the target probability distribution of the sharding keys are used as the first reference sharding keys.

4. The method according to claim 2, characterized in that, The step of evaluating the actual probability distribution of each candidate fragment key based on the fragment key evaluation criterion to determine the second reference fragment key includes: Based on the fragmentation key evaluation criteria, the actual probability distribution of each candidate fragmentation key is evaluated to obtain probability evaluation data; Based on the probability evaluation data, the second reference fragment key is determined from each of the candidate fragment keys.

5. The method according to claim 1, characterized in that, The step of determining the actual probability distribution of each candidate shard key based on the shard key reference probability distribution and the query performance data includes: Based on the business-related data, determine the performance evaluation probability of each candidate sharding key; Based on the reference probability distribution of the sharding key, the query performance data, and the performance evaluation probability, the actual probability distribution of the sharding key for the corresponding candidate sharding key is determined.

6. A business query device, characterized in that, include: The business-related data acquisition module is used to acquire business-related data related to the business to be processed within a preset time period; The probability data determination module is used to determine the reference probability distribution of shard keys and query performance data of each candidate shard key in the business processing database based on the business-related data. The probability distribution determination module is used to determine the actual probability distribution of each candidate shard key based on the shard key reference probability distribution and the query performance data. The target sharding key selection module is used to select a target sharding key from the candidate sharding keys according to the actual probability distribution of the sharding keys; The business query module is used to query the business to be processed based on the target sharding key.

7. The apparatus according to claim 6, wherein the target segmentation key selection module comprises: The first reference fragment key determination unit is used to determine the first reference fragment key from each of the candidate fragment keys according to the actual probability distribution of the fragment key; The second reference fragment key determination unit is used to evaluate the actual probability distribution of each candidate fragment key based on the fragment key evaluation criteria, and determine the second reference fragment key. The target fragment key determination unit is used to determine the target fragment key based on the first reference fragment key and the second reference fragment key.

8. The apparatus according to claim 7, wherein the first reference fragment key determining unit is specifically used for: From the actual probability distribution of the fragment keys corresponding to each of the candidate fragment keys, determine the target probability distribution of the fragment key with the maximum probability value; The candidate sharding keys corresponding to the target probability distribution of the sharding keys are used as the first reference sharding keys.

9. An electronic device, characterized in that, include: One or more processors; Memory, used to store one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement a business query method as described in any one of claims 1-5.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements a business query method as described in any one of claims 1-5.