Real-time data query method and system
Through genetic algorithms, data access efficiency is improved through chromosome fitness calculation and cross-mutation operations, and the problems of inefficiency of traditional query architectures and increased resource requirements are solved.
Patent Information
- Application Number
- CN202510893431.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-30
- Publication Date
- 2025-07-25
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Traditional query architectures cannot meet the complex query needs of enterprises after the increase in data volume, resulting in inefficient data access and increased hardware resource requirements.
Using genetic algorithm, we obtain the initial population of chromosomes, calculate its fitness value, select the parent chromosome for cross-and-mutation operations, generate the offspring chromosomes, and finally determine the target query plan.
It improves the real-time and efficiency of data query, reduces the hardware resource requirements, and solves the problem of multi-constrained nonlinear optimization.
Smart Images

Figure CN120371881A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data processing, and particularly to a real-time data query method and system in the technical field of data processing. Background Art
[0002] In the face of the continuous increase in enterprise data volume, the widespread requirements of complex queries (multi-table joins, multi-condition filtering), dynamic data environments, and distributed systems, traditional standard queries can no longer meet the current complex business needs, and the current big data open-source query architecture can no longer meet the real-time data access requirements. That is, in the prior art, there are problems such as low data access efficiency and a multiple-fold increase in hardware resource requirements. Summary of the Invention
[0003] The purpose of the present invention is to provide a real-time data query method and system, and the specific technical solutions adopted are as follows: In a first aspect, an embodiment of the present invention provides a real-time data query method, which includes: Obtain an initial population including multiple chromosomes; wherein, each chromosome corresponds to a query plan one by one; In the initial population, determine the fitness value of each chromosome among the multiple chromosomes; Based on the fitness of each chromosome, select parental chromosomes from the multiple chromosomes; Perform a crossover operation on the parental chromosomes to generate offspring chromosomes; Perform a mutation operation on the offspring chromosomes to obtain updated offspring chromosomes; Based on the fitness value corresponding to the updated offspring chromosomes, determine a target query plan.
[0004] In some possible implementation manners, the determining the target query plan based on the fitness value corresponding to the updated offspring chromosomes includes: Update the initial population based on the updated offspring chromosomes to obtain a candidate population; In the candidate population, determine a target chromosome whose fitness value meets a preset iteration termination condition; Determine the target query plan based on the target chromosome.
[0005] In some possible implementation manners, the determining the target chromosome whose fitness value meets a preset iteration termination condition in the candidate population includes: In the candidate population, determine a target chromosome with the highest fitness value; Determine the query plan represented by the target chromosome as the target query plan.
[0006] In some possible implementation manners, determining the target chromosome with the highest fitness value in the candidate population includes: Determining whether the candidate population meets a preset iteration termination condition; If the candidate population meets the preset iteration termination condition, output the target chromosome with the highest fitness value in the candidate population.
[0007] In some possible implementation manners, performing a crossover operation on the parental chromosomes to generate offspring chromosomes includes: Randomly select two candidate chromosomes from the parental chromosomes; Perform crossover on the two candidate chromosomes to generate two offspring chromosomes.
[0008] In some possible implementation manners, performing a mutation operation on the offspring chromosomes to obtain updated offspring chromosomes includes: Obtain the dynamic mutation probability of the offspring chromosomes; wherein, the dynamic mutation probability decreases with time; Based on the dynamic mutation probability, determine the mutation gene positions of the offspring chromosomes; Based on the mutation gene positions of the offspring chromosomes, perform a mutation operation to obtain the updated offspring chromosomes.
[0009] In some possible implementation manners, performing a mutation operation on the offspring chromosomes to obtain updated offspring chromosomes includes: Based on the distance between the offspring chromosomes, determine the diversity of the offspring chromosomes; If the diversity is less than a preset diversity threshold, perform a mutation operation on the offspring chromosomes with fitness values less than a preset fitness threshold to obtain the updated offspring chromosomes.
[0010] In some possible implementation manners, the preset iteration termination condition includes at least one of the following: During consecutive multiple iterations, the fluctuation value between the fitness values of multiple updated offspring chromosomes is less than a preset fluctuation threshold; During consecutive multiple iterations, the diversity is less than the preset diversity threshold for consecutive multiple times; The improvement rate between the fitness value of the offspring chromosome and the fitness value of the corresponding updated offspring chromosome is less than a preset improvement rate threshold; The current iteration number reaches a preset maximum iteration number.
[0011] In some possible implementation manners, obtaining an initial population including multiple chromosomes includes: Obtain the preset encoding method of the chromosomes; Determine the gene structure based on preset storage information and identification information; Randomly generate multiple chromosomes based on the preset coding method and the gene structure; Obtain the initial population based on the multiple chromosomes.
[0012] In a second aspect, a real-time data query system is provided, and the system includes: An acquisition module for acquiring an initial population including multiple chromosomes; wherein, the chromosomes correspond to query plans one by one; A first determination module for determining the fitness value of each chromosome among the multiple chromosomes in the initial population; A selection module for selecting parental chromosomes from the multiple chromosomes based on the fitness of each chromosome; A crossover module for performing a crossover operation on the parental chromosomes to generate offspring chromosomes; A mutation module for performing a mutation operation on the offspring chromosomes to obtain updated offspring chromosomes; A second determination module for determining a target query plan based on the fitness value corresponding to the updated offspring chromosomes.
[0013] In a third aspect, a computer program product is provided, and the computer program product includes: computer program code, which when running on a computer, causes the computer to execute the method in the first aspect or any one of the possible implementation manners described in the first aspect.
[0014] In a fourth aspect, a computer-readable storage medium is provided, and the computer-readable storage medium stores computer program code, which when running on a computer, causes the computer to execute the method in the first aspect or any one of the possible implementation manners described in the first aspect.
[0015] The present invention has the following beneficial effects: After obtaining an initial population including multiple chromosomes, in the initial population, the fitness value of each chromosome among the multiple chromosomes is determined; wherein, the chromosomes correspond to query plans one by one; in this way, by introducing a genetic algorithm, the real-time performance of data query can be improved. Through the fitness of each chromosome, parent chromosomes are selected from the multiple chromosomes, and crossover operations are performed on the parent chromosomes to generate offspring chromosomes. Then, mutation operations are performed on the offspring chromosomes to obtain updated offspring chromosomes; finally, based on the fitness values corresponding to the updated offspring chromosomes, a target query plan is determined. In this way, by calculating the fitness values of the chromosomes representing the query plans, performing crossover operations and mutation operations to determine the target query plan, thereby realizing the optimization of real-time data query, efficiently solving multi-constraint non-linear optimization problems, further improving data access efficiency, and reducing hardware resource requirements. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the technical solutions and advantages in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the following-described drawings are only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can be obtained based on these drawings.
[0017] Figure 1 It is a schematic flowchart of the implementation of a real-time data query method provided by an embodiment of the present invention; Figure 2 It is another schematic flowchart of the implementation of a real-time data query method provided by an embodiment of the present invention; Figure 3 It is still another schematic flowchart of the implementation of a real-time data query method provided by an embodiment of the present invention; Figure 4 It is yet another schematic flowchart of the implementation of a real-time data query method provided by an embodiment of the present invention; Figure 5 It is a schematic structural diagram of the composition of a real-time data query system provided by an embodiment of the present invention; Figure 6 It is a schematic structural diagram of a computer device provided by an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0018] To further elaborate on the technical means and effects adopted by the present invention to achieve the intended invention purpose, the following specifically describes, in conjunction with the accompanying drawings and preferred embodiments, a real-time data query method proposed according to the present invention, including its specific implementation manners, structures, features, and effects. In the following description, different "one embodiment" or "another embodiment" do not necessarily refer to the same embodiment. In addition, the specific features, structures, or characteristics in one or more embodiments may be combined in any suitable form.
[0019] Among them, in the description of the embodiments of the present invention, unless otherwise specified, " / " means "or". For example, A / B may represent A or B. The "and / or" in the text is only a description of the association relationship between associated objects, indicating that there can be three relationships. For example, A and / or B may represent: A exists alone, A and B exist simultaneously, and B exists alone. In addition, in the description of the embodiments of the present invention, "a plurality" means two or more than two.
[0020] Hereinafter, the terms "first" and "second" are only used for descriptive purposes and cannot be understood as implying or suggesting relative importance or implicitly indicating the quantity of the indicated technical features. Thus, the features defined with "first" and "second" may explicitly or implicitly include one or more of such features.
[0021] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the technical field to which the present invention belongs.
[0022] The following specifically describes the specific solution of a real-time data query method provided by the present invention in conjunction with the accompanying drawings. Please refer to Figure 1 , which shows a schematic diagram of the implementation process of a real-time data query method provided by an embodiment of the present invention. The method includes: 101. Obtain an initial population including multiple chromosomes.
[0023] Among them, the chromosomes correspond one-to-one with the query plans. One chromosome represents one query plan, that is, a combination of each query record and its storage location.
[0024] In some possible implementation manners, by first determining a preset coding method and gene structure, multiple chromosomes are generated, thereby obtaining an initial population. That is, the above step 101 can be implemented through the following steps 111 to 114 (not shown in the figure): 111. Obtain the preset coding method of the chromosome.
[0025] Here, the preset encoding methods include: binary encoding, real number encoding, path encoding, etc. By analyzing the problem to be optimized, the preset encoding method that matches the problem to be optimized can be determined. For example, according to the type of the problem to be optimized, binary encoding, real number encoding, path encoding, etc. can be selected.
[0026] 112. Based on the preset storage information and identification information, determine the gene structure.
[0027] Here, the preset storage information is the storage node, and the identification information includes: identity identification (ID) and variable value bit string. By the preset storage information and identification information, the meaning of each gene is clarified, that is, the gene structure is obtained.
[0028] 113. Based on the preset encoding method and the gene structure, randomly generate multiple chromosomes.
[0029] Here, in the preset encoding method, randomly generate multiple chromosomes with this gene structure. For example, randomly generate N chromosomes, where N is an integer greater than 1.
[0030] 114. Based on the multiple chromosomes, obtain the initial population.
[0031] Here, population initialization is achieved through the multiple randomly generated chromosomes to obtain the initial population, and the size of this population is N. After generating N chromosomes, eliminate the chromosomes that violate the constraints (such as data consistency conflicts) among the N chromosomes to verify the feasibility of the initial population, so that the accuracy of the initial population is relatively high.
[0032] 102. In the initial population, determine the fitness value of each of the multiple chromosomes.
[0033] Here, for each chromosome x in the initial population, use the query processing tree to calculate its communication cost C comm (x) and local operation cost C local (x). Calculate the total query cost C(x) according to the above formula.
[0034] Query processing tree calculation is to convert an SQL query into a query tree (Query Tree), which contains operation nodes such as selection, projection, and join.
[0035] The local operation cost is the estimation of I / O cost (full table scan, join operation, index scan), the estimation of the cost of the Central Processing Unit (CPU), etc.
[0036] Communication costs include: data localization analysis (statistically querying the distribution of tables involved in each node and preferentially performing operations locally on the data), intermediate result transmission (in join operations, if the tables participating in the join are distributed across different nodes), and network overhead optimization (using data compression to reduce the amount of data transmitted or using columnar storage to reduce bandwidth consumption). Subsequently, the fitness value of each chromosome is calculated according to the fitness function F(x).
[0037] 103. Based on the fitness of each chromosome, select parental chromosomes from the multiple chromosomes.
[0038] Here, the roulette wheel selection method is used to select a certain number of chromosomes from the initial population as parental chromosomes. The probability of each chromosome being selected is proportional to its fitness value.
[0039] Let the selection probability P(x) be:[[]] , where is the probability that individual x is selected; is the fitness value of individual x (Fitness Value). is the sum of the fitness values of all individuals in the population.
[0040] 104. Perform a crossover operation on the parental chromosomes to generate offspring chromosomes.
[0041] Here, randomly select two candidate chromosomes from the parental chromosomes; and perform a crossover on the two candidate chromosomes to generate two offspring chromosomes. For example, randomly select two chromosomes from the parental chromosomes for crossover operation to generate two offspring chromosomes. Methods such as single-point crossover and multi-point crossover can be used. For example, single-point crossover is to randomly select a crossover point on the chromosome and exchange the parts of the two parental chromosomes after the crossover point.
[0042] 105. Perform a mutation operation on the offspring chromosomes to obtain updated offspring chromosomes.
[0043] Here, perform a dynamic mutation operation on the offspring chromosomes through the dynamic mutation probability of the offspring chromosomes, thereby obtaining updated offspring chromosomes.
[0044] In some possible implementation manners, perform a mutation operation on the offspring chromosomes to increase the diversity of the population. The mutation operation can be randomly changing a certain gene on the chromosome (i.e., the storage location of the query record).
[0045] The purpose of the mutation operation is to maintain population diversity, prevent the algorithm from falling into local optima, and jump out of the current search area by introducing random perturbations. At the same time, it explores the new solution space, supplements unforeseen genetic changes based on the crossover operation, and expands the search scope. The adjustment of the offspring chromosomes by the mutation operation directly affects the population update strategy and the logic for judging the preset iteration termination condition. The above step 105 can be achieved through Figure 2 the steps shown as follows: 201. Obtain the dynamic mutation probability of the offspring chromosomes.
[0046] Among them, the dynamic mutation probability decreases with time. First, perform a basic mutation operation, including: randomly modifying 1%-5% of the genes of the offspring chromosomes (such as adjusting the storage location) to prevent the population from falling into local optima. Secondly, set the dynamic mutation probability, including: adopting a higher mutation probability (such as 5%) in the initial stage and decreasing to 1% in the later stage to balance the exploration and exploitation efficiency. Finally, implement the retention of elite offspring chromosomes: retain the top 5% of the offspring chromosomes with high fitness to avoid the destruction of high-quality solutions due to mutation, and at the same time introduce new solutions through mutation.
[0047] 202. Based on the dynamic mutation probability, determine the mutated gene positions of the offspring chromosomes.
[0048] Here, according to the dynamic mutation probability in the offspring chromosomes, determine the mutated gene positions that need to undergo mutation operations.
[0049] 203. Based on the mutated gene positions of the offspring chromosomes, perform mutation operations to obtain the updated offspring chromosomes.
[0050] Here, mutate the mutated gene positions of the offspring chromosomes to obtain the updated offspring chromosomes to enrich the initial population.
[0051] In some possible implementation manners, it is also possible to perform diversity measurement and intervention on the offspring chromosomes. For example, by analyzing the distances between the offspring chromosomes, determine the diversity of the offspring chromosomes; if the diversity is less than the preset diversity threshold, perform mutation operations on the offspring chromosomes with fitness values less than the preset fitness threshold to obtain the updated offspring chromosomes.
[0052] Here, evaluate the differences between the chromosomes through the Euclidean distance or Hamming distance, and trigger the mutation enhancement strategy when the diversity is lower than the threshold (such as 0.2). Perform forced mutation on the offspring chromosomes with low fitness (such as a 10% probability for the preset fitness threshold), or introduce genes from an external population.
[0053] In some possible implementations, a hybrid strategy optimization can also be performed on the offspring chromosomes, including: Local search combination: performing hill climbing or simulated annealing on the mutated offspring chromosomes to improve the local search efficiency. And hierarchical update: merging the offspring chromosomes with the parent chromosomes, sorting them according to fitness, and only retaining the top N chromosomes to avoid information loss.
[0054] 106. Based on the fitness value corresponding to the updated offspring chromosome, determine the target query plan.
[0055] Here, the initial population is updated through the updated offspring chromosomes, so as to determine the optimal target query plan in the candidate population.
[0056] In some possible implementations, the above step 106 can be implemented through Figure 3 the steps shown as follows: 301. Update the initial population based on the updated offspring chromosomes to obtain a candidate population.
[0057] Here, the updated offspring chromosomes are added to the initial population, replacing some of the offspring chromosomes with lower fitness values to form a new population, so as to obtain a candidate population.
[0058] 302. In the candidate population, determine the target chromosome whose fitness value meets the preset iteration termination condition.
[0059] Here, the preset iteration termination condition includes at least one of the following: During consecutive multiple iterations, the fluctuation value between the fitness values of multiple updated sub-chromosomes is less than the preset fluctuation threshold; During consecutive multiple iterations, the diversity is continuously less than the preset diversity threshold; The improvement rate between the fitness value of the offspring chromosome and the fitness value of the corresponding updated sub-chromosome is less than the preset improvement rate threshold; The current iteration number reaches the preset maximum iteration number.
[0060] Among them, the influence of the mutation operation on the preset iteration termination condition includes: 1. Judge the convergence; Fitness fluctuation threshold: If the optimal solution has not changed for 20 consecutive generations and the average fitness fluctuation < 0.01, terminate the iteration to prevent premature convergence.
[0061] Diversity trigger mechanism: When the population diversity is continuously lower than the threshold, even if the maximum iteration number is not reached, force termination and restart.
[0062] 2. Dynamically adjust the termination criterion; Simulated annealing idea: In the later stage, it allows accepting some inferior solutions (the probability decreases with the number of iterations) to avoid falling into local optima.
[0063] Comprehensive judgment of multiple indicators: Combining the number of iterations (such as 1000 generations), the stability of the optimal solution, and the diversity index to dynamically determine the preset iteration termination condition.
[0064] 3. Mutation and restart strategy; Periodic restart: Perform random initialization every 50 generations and restart the population in combination with mutation operations.
[0065] Adaptive termination: If the fitness improvement rate after mutation < 0.1%, it is considered that the algorithm converges and the iteration is terminated.
[0066] In some possible implementation manners, in the candidate population, determine the target chromosome with the highest fitness value; for example, by determining whether the candidate population meets the preset iteration termination condition; if the candidate population meets the preset iteration termination condition, in the candidate population, output the target chromosome with the highest fitness value. If the preset iteration termination condition is met, output the target chromosome with the highest fitness value; otherwise, continue the iteration. After that, determine the query plan represented by the target chromosome as the target query plan. In this way, taking the query plan represented by the target chromosome with the highest fitness value as the optimal target query plan can improve the accuracy of the target query plan.
[0067] 303. Determine the target query plan based on the target chromosome.
[0068] Here, determine whether the preset iteration termination condition is met, such as reaching the maximum number of iterations (manually set threshold) or the fitness value converging to a certain extent. In the genetic algorithm, the fitness value converging to a certain extent means that the change of individual fitness in the population evolution process tends to a stable state, and at this time the algorithm may have reached the optimal or near-optimal solution. For example: the number of iterations ≥ 1000 or the optimal solution remains unchanged for 20 consecutive generations or the fitness fluctuation < 0.01. The essence of "the fitness value converging to a certain extent" is that the algorithm's search ability is exhausted, and it needs to be jointly determined by multiple indicators (such as stability + diversity + directionality).
[0069] In an embodiment of the present invention, after obtaining an initial population including multiple chromosomes, the fitness value of each chromosome among the multiple chromosomes is determined in the initial population; wherein, each chromosome corresponds to a query plan one by one; thus, by introducing a genetic algorithm, the real-time performance of data query can be improved. Through the fitness of each chromosome, parent chromosomes are selected from the multiple chromosomes, and crossover operations are performed on the parent chromosomes to generate offspring chromosomes. Then, mutation operations are performed on the offspring chromosomes to obtain updated offspring chromosomes; finally, based on the fitness value corresponding to the updated offspring chromosomes, a target query plan is determined. In this way, by calculating the fitness value of the chromosome representing the query plan, and performing crossover operations and mutation operations to determine the target query plan, the optimization of real-time data query is realized, the multi-constraint non-linear optimization problem can be efficiently solved, thereby improving the data access efficiency and reducing the hardware resource requirements.
[0070] In some embodiments, the real-time data query method can be implemented through the Figure 4 steps shown below: 401. Initialize the population to obtain an initial population.
[0071] 402. Calculate the fitness value of each chromosome in the initial population.
[0072] 403. Perform a selection operation on the chromosomes in the initial population to obtain parent chromosomes.
[0073] 404. Perform crossover operations on the parent chromosomes to obtain offspring chromosomes.
[0074] 405. Perform mutation operations on the offspring chromosomes to obtain updated offspring chromosomes.
[0075] 406. Update the initial population with the updated offspring chromosomes to obtain a candidate population.
[0076] 407. Determine whether the candidate population satisfies a preset iteration termination condition.
[0077] Here, if the candidate population satisfies the preset iteration termination condition, proceed to step 408; if the candidate population does not satisfy the preset iteration termination condition, return to step 402.
[0078] 408. Output the chromosome with the highest fitness value as the target query plan.
[0079] The embodiment of the present invention optimizes the query of a large real-time database through a genetic algorithm, combines real-time cost information collection with a query processing tree, can efficiently solve the multi-constraint non-linear optimization problem, and avoid the deficiencies of traditional methods in terms of query efficiency and global optimal solution search. By continuously iteratively updating the population, the optimal query plan is finally found.
[0080] An embodiment of the present invention provides a real-time data query system. Please refer to Figure 5 , which shows a schematic structural diagram of a real-time data query system provided by an embodiment of the present invention. The system 500 includes: An acquisition module 501, configured to acquire an initial population including multiple chromosomes; wherein, each chromosome corresponds to a query plan one by one; A first determination module 502, configured to determine the fitness value of each chromosome among the multiple chromosomes in the initial population; A selection module 503, configured to select parental chromosomes from the multiple chromosomes based on the fitness of each chromosome; A crossover module 504, configured to perform a crossover operation on the parental chromosomes to generate offspring chromosomes; A mutation module 505, configured to perform a mutation operation on the offspring chromosomes to obtain updated offspring chromosomes; A second determination module 506, configured to determine a target query plan based on the fitness value corresponding to the updated offspring chromosomes.
[0081] In some possible implementation manners, the second determination module is further configured to update the initial population based on the updated offspring chromosomes to obtain a candidate population; determine a target chromosome in the candidate population whose fitness value meets a preset iteration termination condition; and determine the target query plan based on the target chromosome.
[0082] In some possible implementation manners, the second determination module is further configured to determine a target chromosome with the highest fitness value in the candidate population; and determine the query plan represented by the target chromosome as the target query plan.
[0083] In some possible implementation manners, the second determination module is further configured to determine whether the candidate population meets a preset iteration termination condition; if the candidate population meets the preset iteration termination condition, output a target chromosome with the highest fitness value in the candidate population.
[0084] In some possible implementation manners, the crossover module is further configured to randomly select two candidate chromosomes from the parental chromosomes; and perform a crossover on the two candidate chromosomes to generate two offspring chromosomes.
[0085] In some possible implementation manners, the mutation module is further configured to obtain a dynamic mutation probability of the offspring chromosomes; wherein, the dynamic mutation probability decreases with time; determine a mutation gene position of the offspring chromosomes based on the dynamic mutation probability; and perform a mutation operation based on the mutation gene position of the offspring chromosomes to obtain the updated offspring chromosomes.
[0086] In some possible implementation manners, the mutation module is further configured to determine the diversity of the offspring chromosomes based on the distance between the offspring chromosomes; if the diversity is less than a preset diversity threshold, perform a mutation operation on the offspring chromosomes whose fitness values are less than a preset fitness threshold to obtain the updated offspring chromosomes.
[0087] In some possible implementation manners, the preset iteration termination condition includes at least one of the following: during consecutive multiple iterations, the fluctuation value between the fitness values of multiple updated sub-chromosomes is less than a preset fluctuation threshold; during consecutive multiple iterations, the diversity is less than the preset diversity threshold for consecutive multiple times; the improvement rate between the fitness value of the offspring chromosome and the fitness value of the corresponding updated sub-chromosome is less than a preset improvement rate threshold; the current iteration number reaches a preset maximum iteration number.
[0088] In some possible implementation manners, the obtaining module is further configured to obtain a preset encoding manner of the chromosomes; determine the gene structure based on preset storage information and identification information; randomly generate multiple chromosomes based on the preset encoding manner and the gene structure; and obtain the initial population based on the multiple chromosomes.
[0089] Optionally, the transmission medium may be a wired link (such as, but not limited to, coaxial cable, optical fiber, and Digital Subscriber Line (DSL), etc.) or a wireless link (such as, but not limited to, Wireless Fidelity (WIFI), Bluetooth, and mobile device network, etc.). It should be noted that: for the system provided in the above embodiments, only the division of the above functional modules is used for illustration. In practical applications, the above functions may be allocated to different functional modules according to needs, that is, the internal structure of the computer device is divided into different functional modules to complete all or part of the functions described above. In addition, the method embodiments provided in the above embodiments belong to the same concept, and the specific implementation process is detailed in the method embodiments and will not be repeated here.
[0090] Figure 6 is a schematic structural diagram of a computer device provided by an embodiment of the present invention. Exemplarily, as Figure 6 shown, the computer device 600 includes: a memory 601, a processor 602, and a computer program 603 stored in the memory 601 and running on the processor 602. When the processor 602 executes the computer program 603, the computer device can execute any one of the real-time data query methods described above.
[0091] In addition, an embodiment of the present invention also protects a system, which may include a memory and a processor. Among them, executable program code is stored in the memory, and the processor is configured to call and execute the executable program code to execute a real-time data query method provided by an embodiment of the present invention. In this embodiment, the system can be divided into functional modules according to the above method examples. For example, it can correspond to each functional module, or two or more functions can be integrated into one processing module. The above integrated module can be implemented in the form of hardware. It should be noted that the division of modules in this embodiment is illustrative, only a logical function division, and there may be other division methods in actual implementation. It should be noted that all relevant contents of each step involved in the above method embodiment can be cited in the function description of the corresponding functional module, and will not be repeated here.
[0092] It should be understood that the system provided in this embodiment is used to execute the above real-time data query method, so the same effect as the above implementation method can be achieved. In the case of adopting an integrated unit, the system may include a processing module and a storage module. Among them, when the system is applied to a device, the processing module can be used to control and manage the actions of the device. The storage module can be used to support the device to execute mutual program codes, etc. Among them, the processing module can be a processor or a controller, which can implement or execute various exemplary logical blocks, modules and circuits described in combination with the disclosure of the present invention. The processor can also be a combination that realizes computing functions, such as including a combination of one or more microprocessors, a combination of digital signal processing (DSP) and a microprocessor, etc. The storage module can be a memory.
[0093] In addition, the system provided in the embodiment of the present invention can specifically be a chip, a component or a module. The chip may include a connected processor and a memory; among them, the memory is used to store instructions, and when the processor calls and executes the instructions, the chip can execute a real-time data query method provided in the above embodiment. This embodiment also provides a computer-readable storage medium, in which computer program code is stored. When the computer program code runs on a computer, the computer is enabled to execute the above relevant method steps to implement a real-time data query method provided in the above embodiment.
[0094] This embodiment also provides a computer program product. When the computer program product runs on a computer, it causes the computer to execute the above-related steps to implement a real-time data query method provided by the above embodiment. Among them, the system, computer-readable storage medium, computer program product or chip provided by this embodiment are all used to execute the corresponding method provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding method provided above, and will not be elaborated here. Through the description of the above embodiments, those skilled in the art can understand that for the convenience and brevity of description, only the above division of each functional module is used as an example. In actual applications, the above functions can be allocated to different functional modules according to needs, that is, the internal structure of the system is divided into different functional modules to complete all or part of the functions described above. In the embodiments provided by the present invention, it should be understood that the disclosed system and method can be implemented in other ways. For example, the system embodiments described above are only illustrative. For example, the division of modules or units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point, the displayed or discussed coupling or direct coupling or communication connection between each other can be through some interfaces. The indirect coupling or communication connection of the system or unit can be in an electrical, mechanical or other form.
[0095] It should be noted that the above sequence of the embodiments of the present invention is only for description and does not represent the superiority or inferiority of the embodiments. The processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired result. In some embodiments, multitasking and parallel processing are also possible or may be advantageous. Each embodiment in this specification is described in a progressive manner. The same or similar parts between each embodiment can be referred to each other. Each embodiment focuses on the differences from other embodiments. The above content is only the specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art within the technical scope disclosed by the present invention can easily think of changes or substitutions, which should all be covered by the protection scope of the present invention.
Claims
1. A real-time data query method, characterized in that, The real-time data query method includes: Obtain an initial population including multiple chromosomes; wherein, each chromosome corresponds to a query plan one by one; In the initial population, determine the fitness value of each of the multiple chromosomes; Based on the fitness of each chromosome, select parental chromosomes from the multiple chromosomes; Perform a crossover operation on the parental chromosomes to generate offspring chromosomes; Perform a mutation operation on the offspring chromosomes to obtain updated offspring chromosomes; Based on the fitness value corresponding to the updated offspring chromosomes, determine a target query plan.
2. The real-time data query method according to claim 1, wherein, The determining the target query plan based on the fitness value corresponding to the updated offspring chromosomes includes: Update the initial population based on the updated offspring chromosomes to obtain a candidate population; In the candidate population, determine a target chromosome whose fitness value meets a preset iteration termination condition; Determine the target query plan based on the target chromosome.
3. A real-time data query method according to claim 2, characterized in that, The determining, in the candidate population, a target chromosome whose fitness value meets a preset iteration termination condition includes: In the candidate population, determine a target chromosome with the highest fitness value; Determine the query plan represented by the target chromosome as the target query plan.
4. The real-time data query method according to claim 3, wherein The determining, in the candidate population, a target chromosome with the highest fitness value includes: Determine whether the candidate population meets a preset iteration termination condition; If the candidate population meets the preset iteration termination condition, in the candidate population, output a target chromosome with the highest fitness value.
5. A real-time data query method according to claim 1, characterized in that The performing a crossover operation on the parental chromosomes to generate offspring chromosomes includes: Randomly select two candidate chromosomes from the parental chromosomes; Perform a crossover on the two candidate chromosomes to generate two offspring chromosomes.
6. A real-time data query method according to claim 1, characterized in that, The performing a mutation operation on the offspring chromosomes to obtain updated offspring chromosomes includes: Obtain the dynamic mutation probability of the offspring chromosomes; wherein, the dynamic mutation probability decreases with time; Based on the dynamic mutation probability, determine the mutation gene positions of the offspring chromosomes; Based on the mutation gene positions of the offspring chromosomes, perform a mutation operation to obtain the updated offspring chromosomes.
7. A real-time data query method according to claim 1, characterized in that The performing a mutation operation on the offspring chromosomes to obtain updated offspring chromosomes includes: Based on the distance between the offspring chromosomes, determine the diversity of the offspring chromosomes; If the diversity is less than a preset diversity threshold, perform a mutation operation on the offspring chromosomes whose fitness value is less than a preset fitness threshold to obtain the updated offspring chromosomes.
8. A real-time data query method according to claim 7, wherein The preset iteration termination condition includes at least one of the following: During consecutive multiple iteration processes, the fluctuation value between the fitness values of multiple updated offspring chromosomes is less than a preset fluctuation threshold; During consecutive multiple iteration processes, the diversity of the offspring chromosomes is continuously less than the preset diversity threshold for multiple times; The promotion rate between the fitness value of the offspring chromosomes and the fitness value of the corresponding updated offspring chromosomes is less than a preset promotion rate threshold; The current iteration number reaches a preset maximum iteration number.
9. A real-time data query method according to claim 1, characterized in that, The obtaining an initial population including multiple chromosomes includes: Obtain a preset coding method of the chromosomes; Determine the gene structure based on the preset storage information and identification information; Randomly generate multiple chromosomes based on the preset coding method and the gene structure; Obtain the initial population based on the multiple chromosomes.
10. A real-time data query system, characterized in that, The system includes: An acquisition module, configured to acquire an initial population including multiple chromosomes; wherein, the chromosomes correspond to query plans one by one; A first determination module, configured to determine the fitness value of each of the multiple chromosomes in the initial population; A selection module, configured to select parental chromosomes from the multiple chromosomes based on the fitness of each chromosome; A crossover module, configured to perform a crossover operation on the parental chromosomes to generate offspring chromosomes; A mutation module, configured to perform a mutation operation on the offspring chromosomes to obtain updated offspring chromosomes; A second determination module, configured to determine a target query plan based on the fitness value corresponding to the updated offspring chromosomes.
Citation Information
Patent Citations
Wireless broadband communication system station layout networking method and system
CN113709753A
Distributed database query optimization method
CN115858577A
Logistics tracing method and system based on block chain technology
CN118644172A
Methods and systems for dynamic variant thresholding in a liquid biopsy assay
US20210343372A1