Optimization strategy execution method and device, computer equipment, computer readable storage medium and computer program product

By analyzing the database query log, generating frequent item sets and executing optimization strategies, the resource waste caused by repeated calculations of common queries in the Doris system is solved, and more efficient data query and processing is achieved.

CN119646033APending Publication Date: 2025-03-18CHINA TELECOM CLOUD TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411790400.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-06
Publication Date
2025-03-18

AI Technical Summary

Technical Problem

When using the high-performance distributed data analysis storage system Doris, as the data volume grows and business complexity increases, the repeated calculation of common queries leads to waste of resources and is difficult to effectively optimize.

Method used

By obtaining the database query log, the associated data table pairs are parsed, the candidate set is generated and pruned, and the frequent item set is obtained. According to the number of data tables corresponding to the frequent item set, the corresponding optimization strategy is implemented, including the co-located connection strategy and the establishment of materialized views.

Benefits of technology

Effectively remove redundant operations in database queries, optimize data storage and index structure, and improve the data query and processing efficiency of subsequent databases.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119646033A_ABST
    Figure CN119646033A_ABST
Patent Text Reader

Abstract

The invention relates to an optimization strategy execution method and device, computer equipment, a computer readable storage medium and a computer program product. The method comprises the steps of obtaining a database query log, analyzing the database query log to obtain an associated data table pair, generating a candidate item set according to the data table pair, pruning the candidate item set to obtain a frequent item set, and executing a corresponding optimization strategy according to the number of data tables corresponding to the frequent item set. By adopting the method, the frequent item set can be determined by taking the associated data table pair as the minimum unit, the data tables frequently appearing in the database query and the association relationship between the data tables are found, potential modes and association in the data are more effectively mined, the storage and index structures of the data are optimized, and the data query efficiency is improved. Therefore, the efficiency of subsequent data query and processing of the database can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of big data and artificial intelligence technology, and in particular to a method, device, computer equipment, computer-readable storage medium and computer program product for executing an optimization strategy. Background Art

[0002] In today's digital age, data has become the key basis for decision-making in enterprises and organizations. Based on the massively parallel processing architecture (Massively Parallel Processing, MPP for short), the database Doris plays an important role in processing large-scale data as a high-performance distributed data analysis storage system. However, with the rapid growth of data volume and the increasing complexity of business needs, the database Doris also faces many challenges. For example, in actual applications, due to the complexity of business, many queries are frequently used. The repeated calculation of frequently used queries will lead to a waste of resources. Summary of the invention

[0003] Based on this, it is necessary to provide a method, apparatus, computer device, computer-readable storage medium and computer program product for executing an optimization strategy that can help remove redundant database query operations in response to the above technical problems.

[0004] In a first aspect, the present application provides a method for executing an optimization strategy, comprising:

[0005] Obtaining a database query log, and parsing the database query log to obtain associated data table pairs;

[0006] Generating a candidate item set according to the data table, and pruning the candidate item set to obtain a frequent item set;

[0007] According to the number of data tables corresponding to the frequent itemsets, a corresponding optimization strategy is executed.

[0008] In one embodiment, executing a corresponding optimization strategy according to the number of data tables corresponding to the frequent itemsets includes:

[0009] In the case that the number of data tables corresponding to the frequent itemsets is multiple, determining the intersection-and-union ratio between the data table fields in each of the frequent itemsets;

[0010] According to the comparison result of the intersection-over-union ratio and the preset threshold, the corresponding optimization strategy is executed.

[0011] In one embodiment, executing the corresponding optimization strategy according to the comparison result of the intersection-over-union ratio and a preset threshold value includes:

[0012] When the intersection-over-union ratio is greater than the preset threshold, determining the execution time proportion corresponding to the data table pair associated with the frequent itemset;

[0013] When the execution time ratio is greater than a preset time threshold, a co-location connection strategy is executed for the associated data table pair.

[0014] In one embodiment, the method further comprises:

[0015] When the execution time ratio is less than the preset time threshold, an optimization strategy for establishing a materialized view by using the associated data table is executed.

[0016] In one embodiment, executing a corresponding optimization strategy according to the number of data tables corresponding to the frequent itemsets includes:

[0017] In the case that the number of data tables corresponding to the frequent itemsets is one, a storage optimization strategy for the single data table corresponding to the frequent itemsets is executed based on a preset storage method.

[0018] In one embodiment, the step of obtaining a database query log and parsing the database query log to obtain an associated data table pair includes:

[0019] Parsing the database query log to obtain a plurality of abstract syntax trees;

[0020] Eliminate invalid query data and non-selective query statements in the plurality of abstract syntax trees to obtain a plurality of target syntax trees after elimination;

[0021] Determine the association relationship between the data tables in each of the target syntax trees;

[0022] The associated data table pair is extracted from each of the target syntax trees based on the associated relationship.

[0023] In a second aspect, the present application also provides an execution device for an optimization strategy, including:

[0024] A log parsing module, used to obtain a database query log, and parse the database query log to obtain associated data table pairs;

[0025] An item set generation module, used for generating a candidate item set according to the data table, and pruning the candidate item set to obtain a frequent item set;

[0026] The strategy execution module is used to execute the corresponding optimization strategy according to the number of data tables corresponding to the frequent itemsets.

[0027] In a third aspect, the present application further provides a computer device, wherein the computer device comprises a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the method for executing the optimization strategy described in any one of the embodiments of the first aspect is implemented.

[0028] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the method for executing the optimization strategy described in any one of the embodiments of the first aspect above is implemented.

[0029] In a fifth aspect, the present application further provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, the execution method of the optimization strategy described in any one of the embodiments of the first aspect is implemented.

[0030] The execution method, device, computer equipment, computer-readable storage medium and computer program product of the above-mentioned optimization strategy obtain database query logs, parse the database query logs to obtain associated data table pairs, generate candidate item sets based on the data table pairs, and prune the candidate item sets to obtain frequent item sets. According to the number of data tables corresponding to the frequent item sets, the corresponding optimization strategy is executed, and the frequent item sets can be determined with the associated data table pairs as the minimum unit, and the data tables that frequently appear in the database query and the association relationship between the data tables can be found, so as to more effectively mine the potential patterns and associations in the data, optimize the storage and index structure of the data, and thus help to improve the efficiency of subsequent database data query and processing. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0032] Figure 1 A schematic diagram of a flow chart of a method for executing an optimization strategy in an embodiment;

[0033] Figure 2 A schematic diagram of a flow chart of a data table pair extraction step in one embodiment;

[0034] Figure 3 is a schematic diagram of a target syntax tree in one embodiment;

[0035] Figure 4 A schematic flow chart of a method for executing an optimization strategy in another embodiment;

[0036] Figure 5 is a schematic diagram of a data table pair in one embodiment;

[0037] Figure 6 is a structural block diagram of an execution device 600 of an optimization strategy in one embodiment;

[0038] Figure 7 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0039] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0040] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.

[0041] In an exemplary embodiment, Figure 1 As shown, a method for executing an optimization strategy is provided. This embodiment uses the method applied to a server as an example. It can be understood that the method can also be applied to a terminal, and can also be applied to a system including a terminal and a server, and is implemented through the interaction between the terminal and the server. Among them, the terminal can be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, Internet of Things devices and portable wearable devices. The Internet of Things devices can be smart TVs, smart car devices, projection devices, etc. Portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc. Head-mounted devices can be virtual reality (VR) devices, augmented reality (AR) devices, smart glasses, etc. The server can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides cloud computing services.

[0042] In this embodiment, the method includes the following steps S102 to S106, wherein:

[0043] Step S102, obtaining a database query log, and parsing the database query log to obtain associated data table pairs.

[0044] The data table pair can be used to represent a set consisting of multiple data tables.

[0045] Exemplarily, the server may obtain a database query log within a preset time period. The database query log is parsed, and based on the database query statement recorded in the database query log and the queried data table corresponding to the database query statement, it is determined that there is an associated data table pair. For example, multiple data tables involved in the same database query statement may be used as an associated data table pair. Alternatively, multiple data tables stored at the same data node may be used as an associated data table pair.

[0046] Step S104: generating a candidate item set according to the data table, and pruning the candidate item set to obtain a frequent item set.

[0047] Exemplarily, the server may iteratively combine the data tables in the data table pair to generate a candidate item set. For example, when the data table pair includes E(AB)(CD), the first round of candidate item sets may be constructed as {A}, {B}, {C}, {D}, {E} according to data tables A, B, C, D, and E. The first round of candidate item sets are used for association matching to obtain a second round of candidate item sets as {(AB), (CD)}. The second round of candidate item sets are used for association matching to obtain a third round of candidate item sets as {E, (AB), (CD)}. The candidate item sets are pruned according to the subsets in the candidate item sets, and the processed candidate item sets are used as frequent item sets.

[0048] Step S106: executing a corresponding optimization strategy according to the number of data tables corresponding to the frequent itemsets.

[0049] Exemplarily, the server may store database optimization strategies corresponding to the number of data tables. According to the number of data tables corresponding to the subsets in the frequent itemsets, the currently used database optimization strategy is determined and executed to optimize the database query.

[0050] In the execution method of the above optimization strategy, by obtaining the database query log, the associated data table pairs are parsed from the database query log, a candidate item set is generated according to the data table pairs, and the candidate item set is pruned to obtain a frequent item set. According to the number of data tables corresponding to the frequent item set, the corresponding optimization strategy is executed. The frequent item set can be determined with the associated data table pair as the minimum unit, and the data tables that frequently appear in the database query and the association relationship between the data tables can be found. The potential patterns and associations in the data can be more effectively mined, and the storage and index structure of the data are optimized, which helps to improve the efficiency of subsequent database data query and processing.

[0051] In an exemplary embodiment, step S106 includes: when there are multiple data tables corresponding to the frequent itemsets, determining the intersection-and-union ratio between the data table fields in each frequent itemset; and executing a corresponding optimization strategy according to a comparison result of the intersection-and-union ratio with a preset threshold.

[0052] Exemplarily, when there are multiple data tables corresponding to the frequent item sets, the server can count the data table fields that appear in each frequent item set. Calculate the intersection-and-union ratio between the data table fields of different frequent item sets. Compare the calculated intersection-and-union ratio with a preset threshold. According to the comparison result of the intersection-and-union ratio with the preset threshold, execute the optimization strategy corresponding to the comparison result.

[0053] In this embodiment, when frequent item sets involve multiple data tables, the overlap between data table fields of different frequent item sets is determined by using the intersection-and-union method, and then the corresponding optimization strategy is executed according to the overlap. This can evaluate the similarity and correlation between the data tables, thereby facilitating the construction of the storage and index structure of the associated data table pairs, and improving the subsequent query and processing efficiency of the data table pairs.

[0054] In an exemplary embodiment, the execution method of the optimization strategy provided in the present application may also include: when the intersection-and-union ratio is greater than a preset threshold, determining the execution time proportion corresponding to the data table pairs associated with the frequent item set; when the execution time proportion is greater than the preset time threshold, executing a co-location connection strategy for the associated data table pairs.

[0055] Exemplarily, the server can determine the execution time corresponding to the data table pair associated with the frequency item set when the intersection-and-union ratio is greater than a preset threshold value 1. According to the execution time of a single data table pair and the total execution time of all data table pairs, the execution time proportion corresponding to the data table pair is calculated. The execution time proportion is compared with the preset time threshold. When the execution time proportion is greater than the preset time threshold, a co-location connection strategy (i.e., colocate join instruction strategy) is executed for the associated data table pair. The co-location connection strategy can be used to store the associated data table pairs whose intersection-and-union ratio is greater than the preset threshold and whose execution time proportion is greater than the preset time threshold to the same data node.

[0056] Optionally, in some embodiments, the server may also comprehensively sort the data table pairs from high to low according to the execution time ratio, so as to give priority to the data table pairs with the highest ranking. In other embodiments, the server may also perform a sorting operation based on the execution time ratio every preset period, so as to select the data table pair with the highest execution time ratio in each processing period for optimization and acceleration.

[0057] Optionally, in other implementations, it is possible to evaluate whether to optimize and accelerate data table pairs with a low execution time ratio based on the machine resources currently available on the server.

[0058] In this embodiment, by determining the execution time ratio of the associated data table pairs, and executing the corresponding optimization strategy based on the comparison result of the execution time ratio with the preset time threshold, the data table pairs with higher execution time ratio can be processed preferentially, thereby improving the processing efficiency of subsequent common query operations on the data table pairs.

[0059] In an exemplary embodiment, the execution method of the optimization strategy provided by the present application may further include: when the execution time ratio is less than a preset time threshold, executing the optimization strategy of establishing a materialized view using the associated data table.

[0060] Among them, a materialized view is a database object that can store the execution results of a query in physical storage and can be updated regularly to speed up the query and improve performance.

[0061] Exemplarily, when the intersection-and-union ratio of data table fields is greater than a preset threshold and the execution time proportion of the data table pair is less than the preset time threshold, the server can use the associated data table pair as the execution result of the query result to establish a corresponding materialized view.

[0062] In this embodiment, the optimization of database query is achieved by using the optimization method of materialized view, which can help to speed up the subsequent query.

[0063] In an exemplary embodiment, step S106 may further include: when the number of data tables corresponding to the frequent itemsets is one, executing a storage optimization strategy for the single data table corresponding to the frequent itemsets based on a preset storage method.

[0064] Among them, the preset storage method may include but is not limited to high-performance storage methods such as data compression storage, data partition storage, and data distributed storage.

[0065] Exemplarily, when the number of data tables corresponding to the frequent itemsets is one, the server may execute a storage optimization strategy for a single data table corresponding to the frequent itemsets based on a preset storage method to achieve high-performance storage of the single data table.

[0066] In this embodiment, optimizing a single data table by using a high-performance storage method can help improve subsequent data query efficiency.

[0067] In an exemplary embodiment, Figure 2 As shown, step S106 may include the following steps S202 to S208. Among them:

[0068] Step S202: Parse the database query log to obtain a number of abstract syntax trees.

[0069] Step S204: remove invalid query data and non-selective query statements in a plurality of abstract syntax trees to obtain a plurality of target syntax trees after removal.

[0070] Exemplarily, the server may obtain a database query log and parse the database query log. An abstract syntax tree corresponding to each query operation is constructed based on the statement instructions used in each query operation recorded in the database query log and the execution results of the statement instructions. Invalid query data and non-selective query statements of failed queries are removed from the abstract syntax tree, and the abstract syntax tree after the removal is used as the target syntax tree.

[0071] Step S206, determining the association relationship between the data tables in each target syntax tree.

[0072] Step S208: extracting associated data table pairs from each target syntax tree based on the association relationship.

[0073] Exemplarily, the server may determine the association relationship between the data tables in each target syntax tree based on the index level where the data tables in each target syntax tree are located, and extract the associated data table pairs from each target syntax tree based on the association relationship.

[0074] Optionally, in some embodiments, Figure 3 As shown, in the target syntax tree 310, the execution result of the data table TableA / select query statement is the data tables TableB and TableC. Then the associated data table pair can be extracted as BC. In the target syntax tree 320, the index level of the data table TableC also includes two sub-data tables TableD and TableE, then the associated data table pair can be extracted as B (DE).

[0075] In this embodiment, by eliminating invalid query data and non-selective query statements, the amount of data processing calculation can be reduced, thereby helping to improve the efficiency and accuracy of subsequent acquisition of frequent itemsets.

[0076] In an exemplary embodiment, Figure 4 As shown, a method for executing an optimization strategy is also provided, including the following steps S402 to S416. Among them:

[0077] Step S402: Obtain a database query log, and parse the database query log to obtain a plurality of abstract syntax trees.

[0078] Step S404: remove invalid query data and non-select query statements from the plurality of abstract syntax trees, extract associated data table pairs, and determine the execution time of the data table pairs.

[0079] Exemplarily, the server may obtain the database query log of the most recent day. The database query log is parsed to obtain an abstract syntax tree, and invalid query data and non-selective query statements in the abstract syntax tree are removed to obtain a target syntax tree that can perform valid data parsing after the removal. Associated data table pairs are extracted from the target syntax tree. The execution time of each associated data table pair is marked. Optionally, in some embodiments, the queried field information may be further supplemented in the data table pair according to the target abstract tree.

[0080] Step S406: Generate a candidate item set according to the data table, and prune the candidate item set to obtain a frequent item set.

[0081] For example, the server can improve the traditional Apriori algorithm and generate frequent item sets with the associated data table pairs as the smallest unit. Figure 5 The candidate item sets are extracted from the abstract syntax tree shown in the figure: {A}, {B}, {C}, {D}, {E}, {(AB), (CD)}, {E, (AB), (CD)}. The candidate item sets of each abstract syntax tree are pruned to obtain the corresponding frequent item sets.

[0082] Step S408: When the number of data tables corresponding to the frequent itemsets is one, a storage optimization strategy for the single data table corresponding to the frequent itemsets is executed based on a preset storage method.

[0083] Exemplarily, when the number of data tables corresponding to the frequent itemsets is one, such as {A}, {B}, etc., a storage optimization strategy for high-performance storage of data table TableA or data table TableB can be executed based on a preset storage method.

[0084] Step S410: when there are multiple data tables corresponding to the frequent itemsets, determine the intersection-and-union ratios between the fields in the data tables of the frequent itemsets.

[0085] For example, when there are multiple data tables corresponding to the frequent itemsets, the server may use the following formula to determine the intersection-and-union ratio between the fields in the data tables of the frequent itemsets:

[0086] .

[0087] Among them, IoU represents the intersection-over-union ratio of data table fields A and B. T1.(AB) represents the intersection of data table fields A, data table fields B, and data table fields AB. T2,(AB) represents the union of data table fields A and data table fields B.

[0088] Step S412: when the intersection-and-union ratio is greater than a preset threshold, determining the execution time proportion of the data table pair.

[0089] Exemplarily, when the intersection-and-union ratio is greater than a preset threshold, the server may use the following formula to determine the execution time proportion of the data table pair:

[0090] .in, Represents the total execution time of N tables containing data for AB. Represents the sum of all execution times.

[0091] Step S414: when the execution time ratio is greater than a preset time threshold, executing a co-location connection strategy for the associated data table pair.

[0092] Step S416: When the execution time ratio is less than the preset time threshold, an optimization strategy for establishing a materialized view using the associated data table is executed.

[0093] In this embodiment, by filtering invalid query data and non-selective query statements, the amount of data calculation in the process of generating frequent item sets can be reduced, and the efficiency and accuracy of obtaining frequent item sets can be improved based on the associated data tables. By adopting corresponding preset storage methods of high-performance storage in different situations, establishing materialized views or co-location connections and other optimization strategies, refined management for different application scenarios can be achieved, which helps the database achieve a better balance and greatly improves the flexibility of database query optimization.

[0094] It should be understood that, although the various steps in the flowcharts involved in the various embodiments described above are displayed in sequence according to the indications of the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless there is a clear description in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a portion of the steps in the flowcharts involved in the various embodiments described above may include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a portion of the steps or stages in other steps.

[0095] Based on the same inventive concept, the embodiment of the present application also provides an execution device of an optimization strategy for implementing the execution method of the optimization strategy involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in the embodiments of the execution device of one or more optimization strategies provided below can refer to the limitations of the execution method of the optimization strategy above, and will not be repeated here.

[0096] In an exemplary embodiment, Figure 6 As shown, an optimization strategy execution device 600 is provided, including: a log parsing module 602, an item set generation module 604 and a strategy execution module 606, wherein:

[0097] The log parsing module 602 is used to obtain database query logs and parse the database query logs to obtain associated data table pairs.

[0098] The item set generation module 604 is used to generate candidate item sets according to the data table, and perform pruning processing on the candidate item sets to obtain frequent item sets.

[0099] The strategy execution module 606 is used to execute the corresponding optimization strategy according to the number of data tables corresponding to the frequent itemsets.

[0100] In an exemplary embodiment, the strategy execution module 606 includes a multi-table optimization unit, which is used to determine the intersection-and-union ratio between the data table fields in each frequent item set when there are multiple data tables corresponding to the frequent item set; and execute the corresponding optimization strategy according to the comparison result of the intersection-and-union ratio and the preset threshold.

[0101] In an exemplary embodiment, the multi-table optimization unit is further used to determine the execution time proportion corresponding to the data table pair associated with the frequent item set when the intersection-union ratio is greater than a preset threshold; and execute the co-location connection strategy for the associated data table pair when the execution time proportion is greater than the preset time threshold.

[0102] In an exemplary embodiment, the multi-table optimization unit is further configured to execute an optimization strategy for establishing a materialized view using associated data tables when the execution time ratio is less than a preset time threshold.

[0103] In an exemplary embodiment, the strategy execution module 606 includes a single table optimization unit, which is used to execute a storage optimization strategy for a single data table corresponding to a frequent itemset based on a preset storage method when the number of data tables corresponding to the frequent itemset is one.

[0104] In an exemplary embodiment, the log parsing module 602 is also used to parse the database query log to obtain several abstract syntax trees; eliminate invalid query data and non-selective query statements in several abstract syntax trees to obtain multiple target syntax trees after elimination; determine the association relationship between data tables in each target syntax tree; and extract associated data table pairs from each target syntax tree based on the association relationship.

[0105] Each module in the execution device 600 of the above optimization strategy can be implemented in whole or in part by software, hardware or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.

[0106] In an exemplary embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as shown in FIG. Figure 7 As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data such as database query logs, associated data table pairs, candidate item sets, frequent item sets, optimization strategies, etc. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a method for executing an optimization strategy is implemented.

[0107] Those skilled in the art will understand that Figure 7 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0108] In an exemplary embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above-mentioned method embodiments when executing the computer program.

[0109] In an exemplary embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.

[0110] In an exemplary embodiment, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the steps in the above method embodiments are implemented.

[0111] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.

[0112] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.

[0113] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A method for executing an optimization strategy, characterized in that: The method comprises: Obtaining a database query log, and parsing the database query log to obtain associated data table pairs; Generating a candidate item set according to the data table, and pruning the candidate item set to obtain a frequent item set; According to the number of data tables corresponding to the frequent itemsets, a corresponding optimization strategy is executed.

2. The method according to claim 1, characterized in that The executing a corresponding optimization strategy according to the number of data tables corresponding to the frequent itemsets includes: In the case that the number of data tables corresponding to the frequent itemsets is multiple, determining the intersection-and-union ratio between the data table fields in each of the frequent itemsets; According to the comparison result of the intersection-over-union ratio and the preset threshold, the corresponding optimization strategy is executed.

3. The method according to claim 2, characterized in that The step of executing the corresponding optimization strategy according to the comparison result between the intersection-and-union ratio and the preset threshold value includes: When the intersection-over-union ratio is greater than the preset threshold, determining the execution time proportion corresponding to the data table pair associated with the frequent itemset; When the execution time ratio is greater than a preset time threshold, a co-location connection strategy is executed for the associated data table pair.

4. The method according to claim 3, characterized in that The method further comprises: When the execution time ratio is less than the preset time threshold, an optimization strategy for establishing a materialized view by using the associated data table is executed.

5. The method according to claim 1, characterized in that The executing a corresponding optimization strategy according to the number of data tables corresponding to the frequent itemsets includes: In the case that the number of data tables corresponding to the frequent itemsets is one, a storage optimization strategy for the single data table corresponding to the frequent itemsets is executed based on a preset storage method.

6. The method according to claim 1, characterized in that The step of obtaining a database query log and parsing the database query log to obtain an associated data table pair includes: Parsing the database query log to obtain a plurality of abstract syntax trees; Eliminate invalid query data and non-selective query statements in the plurality of abstract syntax trees to obtain a plurality of target syntax trees after elimination; Determine the association relationship between the data tables in each of the target syntax trees; The associated data table pair is extracted from each of the target syntax trees based on the associated relationship.

7. An execution device for an optimization strategy, characterized in that: The device comprises: A log parsing module, used to obtain a database query log, and parse the database query log to obtain associated data table pairs; An item set generation module, used for generating a candidate item set according to the data table, and pruning the candidate item set to obtain a frequent item set; The strategy execution module is used to execute the corresponding optimization strategy according to the number of data tables corresponding to the frequent itemsets.

8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.