CN115470306A - Index selection method, system and storage medium for relational database - Google Patents

Index selection method, system and storage medium for relational database Download PDF

Info

Publication number
CN115470306A
CN115470306A CN202211165348.7A CN202211165348A CN115470306A CN 115470306 A CN115470306 A CN 115470306A CN 202211165348 A CN202211165348 A CN 202211165348A CN 115470306 A CN115470306 A CN 115470306A
Authority
CN
China
Prior art keywords
sql query
query statement
source
index structure
statement
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211165348.7A
Other languages
Chinese (zh)
Inventor
罗超
赵海兴
孟珂
岳凯
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Chaozhou Zhuoshu Big Data Industry Development Co Ltd
Original Assignee
Chaozhou Zhuoshu Big Data Industry Development Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Chaozhou Zhuoshu Big Data Industry Development Co Ltd filed Critical Chaozhou Zhuoshu Big Data Industry Development Co Ltd
Priority to CN202211165348.7A priority Critical patent/CN115470306A/en
Publication of CN115470306A publication Critical patent/CN115470306A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/28Databases characterised by their database models, e.g. relational or object models
    • G06F16/284Relational databases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2228Indexing structures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/242Query formulation
    • G06F16/2433Query languages

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Mathematical Physics (AREA)
  • Computational Linguistics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application discloses a method, a system and a storage medium for index selection of a relational database. The method comprises the following steps: the relational database receives a source SQL query statement, and inputs the source SQL query statement into a preset experience discrimination model to carry out target index structure matching; optimizing a source SQL query statement based on the target index structure to obtain an SQL query statement to be executed; executing the SQL query statement to be executed, and determining whether the execution time of the SQL query statement to be executed is greater than a preset threshold value; if the number of the query statements is larger than the preset number, storing the source SQL query statements in a statement table to be optimized, and optimizing the source SQL query statements in the statement table to be optimized based on a preset optimization rule to obtain optimal SQL query statements; and storing the optimal SQL query statement in an empirical judgment model to realize updating. The method avoids the problems that the index of the traditional relational database is often invalid under the complex query condition, and the predicted index structure is difficult to optimize.

Description

Index selection method, system and storage medium for relational database
Technical Field
The present application relates to the field of database technologies, and in particular, to a method, a system, and a storage medium for index selection of a relational database.
Background
In the development of relational databases, in order to increase the speed of data retrieval, indexes are usually added to fields to speed up the data retrieval capability. The relational database index locates the range address of the data to be searched by using a B + tree (or other trees) as guidance, reads the required data from the disk according to the reduced range, and the retrieval mode can avoid the frequent reading of the disk to the maximum extent and accelerate the overall query efficiency.
However, whether the relational database index takes effect or not is not completely controlled by a programmer, after a request is submitted to the relational database, the relational database can prejudge SQL statements, the content of prejudgment comprises whether the index is used or not, whether the index specified by a user is used or not, and the optimal index considered by the relational database is selected. Therefore, aiming at the traditional relational database, the index often fails under the complex query condition, and the difficulty in optimizing the index structure predicted by the relational database becomes a technical problem to be solved urgently.
Disclosure of Invention
The embodiment of the application provides an index selection method, a system and a storage medium of a relational database, which are used for solving the following technical problems: aiming at the traditional relational database, the index is often invalid under the complex query condition, and the index structure predicted by the relational database is difficult to optimize.
In a first aspect, an embodiment of the present application provides an index selection method for a relational database, where the method includes: the relational database receives a source SQL query statement, and inputs the source SQL query statement into a preset experience discrimination model to carry out target index structure matching; under the condition that the empirical discrimination model determines that the matched target index structure exists, optimizing a source SQL query statement based on the target index structure to obtain an SQL query statement to be executed; executing the SQL query sentence to be executed, and determining whether the execution time of the SQL query sentence to be executed is greater than a preset threshold value; under the condition that the execution time is greater than a preset threshold value, storing the source SQL query statement in a statement table to be optimized, and optimizing the source SQL query statement in the statement table to be optimized based on a preset optimization rule to obtain an optimal SQL query statement; and storing the optimal SQL query statement in an empirical judgment model to realize updating.
In an implementation manner of the present application, inputting a source SQL query statement into a preset empirical mode to perform target index structure matching specifically includes: analyzing the source SQL query statement to determine a first number of index nodes contained in the source index structure; the source index structure is an index structure contained in a source SQL query statement; matching the first number of index nodes with a plurality of optimized SQL query statements contained in the experience discrimination model to obtain a second number of sub-index structures; and processing the second number of sub-index structures based on a preset classification judging module to obtain a target index structure.
In an implementation manner of the present application, optimizing a source SQL query statement in a statement table to be optimized based on a preset optimization rule specifically includes: monitoring the relational database to determine whether the relational database is in an idle state; and traversing the index structure combination based on the tail index node of the source index structure under the condition that the relational database is determined to be in an idle state so as to obtain the optimal SQL query statement corresponding to the source SQL query statement.
In one implementation of the present application, before the relational database receives the source SQL query statement, the method further includes: constructing a target SQL query statement corresponding to the source SQL query statement based on a preset query requirement, and adding a priority label to the target SQL query statement; and storing the target SQL query statement in an experience discrimination model, and preferentially selecting if a sub-index structure corresponding to the target SQL query statement exists when the source SQL query statement is input into a preset experience discrimination model to match the target index structure.
In one implementation of the present application, the method further comprises: and under the condition that the empirical discrimination model determines that no matched target index structure exists, determining the source SQL query statement as the SQL query statement to be executed.
In a second aspect, an embodiment of the present application further provides an index selection system for a relational database, where the index selection system is applied to the relational database, and the system includes: the system comprises an experience judgment module, a first optimization module, an execution module, a second optimization module and an updating module; the experience judging module is used for receiving the source SQL query statement and inputting the source SQL query statement into a preset experience judging model to carry out target index structure matching; the first optimization module is used for optimizing the source SQL query statement based on the target index structure under the condition that the matched target index structure exists as determined by the empirical discrimination model so as to obtain the SQL query statement to be executed; the execution module is used for executing the SQL query statement to be executed and determining whether the execution time of the SQL query statement to be executed is greater than a preset threshold value; the second optimization module is used for storing the source SQL query statement in the statement table to be optimized under the condition that the execution time is greater than the preset threshold value, and optimizing the source SQL query statement in the statement table to be optimized based on a preset optimization rule to obtain an optimal SQL query statement; and the updating module is used for storing the optimal SQL query statement in the experience judgment model so as to realize updating.
In an implementation manner of the present application, inputting a source SQL query statement into a preset empirical mode to perform target index structure matching specifically includes: analyzing a source SQL query statement to determine a first number of index nodes contained in a source index structure; the source index structure is an index structure contained in a source SQL query statement; matching the first number of index nodes with a plurality of optimized SQL query statements contained in the experience discrimination model to obtain a second number of sub-index structures; and processing the second number of sub-index structures based on a preset classification judging module to obtain a target index structure.
In an implementation manner of the present application, optimizing a source SQL query statement in a statement table to be optimized based on a preset optimization rule specifically includes: monitoring the relational database to determine whether the relational database is in an idle state; and traversing the index structure combination based on the tail index node of the source index structure under the condition that the relational database is determined to be in an idle state so as to obtain the optimal SQL query statement corresponding to the source SQL query statement.
In one implementation of the present application, the system further comprises: building a model by sentences; the statement construction model is used for constructing a target SQL query statement corresponding to the source SQL query statement based on a preset query requirement, and adding a priority label to the target SQL query statement; and storing the target SQL query statement in an experience discrimination model, and preferentially selecting if a sub-index structure corresponding to the target SQL query statement exists when the source SQL query statement is input into a preset experience discrimination model to match the target index structure.
In a third aspect, an embodiment of the present application further provides a nonvolatile computer storage medium for index selection of a relational database, where computer-executable instructions are stored, and the computer-executable instructions are configured to: the relational database receives a source SQL query statement, and inputs the source SQL query statement into a preset experience discrimination model to carry out target index structure matching; under the condition that the matched target index structure exists as determined by the empirical discrimination model, optimizing a source SQL query statement based on the target index structure to obtain an SQL query statement to be executed; executing the SQL query statement to be executed, and determining whether the execution time of the SQL query statement to be executed is greater than a preset threshold value; under the condition that the execution time is larger than a preset threshold value, storing the source SQL query sentence in a sentence table to be optimized, and optimizing the source SQL query sentence in the sentence table to be optimized based on a preset optimization rule to obtain an optimal SQL query sentence; and storing the optimal SQL query statement in an empirical judgment model to realize updating.
According to the index selection method, the index selection system and the storage medium of the relational database, provided by the embodiment of the application, the problem that the optimal index of the traditional relational database cannot be selected in a complex SQL query statement can be effectively solved through an empirical judgment model. In addition, the optimal SQL query use scheme can be continuously searched through the optimization rule empirical model of the application along with the change of time and data volume.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the application and together with the description serve to explain the application and not to limit the application. In the drawings:
fig. 1 is a flowchart of an index selection method for a relational database according to an embodiment of the present disclosure;
fig. 2 is a schematic diagram of an internal structure of an index selection system of a relational database according to an embodiment of the present disclosure.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the technical solutions of the present application will be described in detail and completely with reference to the following specific embodiments of the present application and the accompanying drawings. It should be apparent that the described embodiments are only a few embodiments of the present application, and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The embodiment of the application provides an index selection method, a system and a storage medium of a relational database, which are used for solving the following technical problems: aiming at the traditional relational database, the index is often invalid under the complex query condition, and the index structure predicted by the relational database is difficult to optimize.
The technical solutions proposed in the embodiments of the present application are explained in detail below with reference to the accompanying drawings.
Fig. 1 is a flowchart of an index selection method for a relational database according to an embodiment of the present disclosure. As shown in fig. 1, an index selection method for a relational database provided in an embodiment of the present application specifically includes the following steps:
step 101, the relational database receives a source SQL query statement, and inputs the source SQL query statement into a preset experience discrimination model to perform target index structure matching.
In an embodiment of the application, after a relational database receives a source SQL query statement, the source SQL query statement is first input into a preset experience discrimination model, and the experience discrimination model analyzes the source SQL query statement to determine a first number of index nodes included in a source index structure; it should be noted that the source index structure is an index structure included in the source SQL query statement.
Further, the first number of index nodes are matched with a plurality of optimized SQL query statements contained in the empirical mode so as to obtain a second number of sub-index structures. It can be understood that the sub-index structure is a section of index structure corresponding to any two matched index nodes on the optimized SQL query statement after the index nodes are matched on the optimized SQL query statement.
Further, a second number of sub-index structures are processed based on a preset classification discrimination module to obtain a target index structure. It should be noted that the classification and discrimination module can be obtained by training a preset classification algorithm, and the classification algorithm can be selected, such as a decision tree algorithm, a bayesian classification algorithm, and the like.
And 102, under the condition that the matched target index structure exists as determined by the empirical judgment model, optimizing the source SQL query statement based on the target index structure so as to obtain the SQL query statement to be executed.
In an embodiment of the application, when the empirical discrimination model determines that a matched target index structure exists, the source SQL query statement is optimized based on the target index structure, so that the source index structure in the source SQL query statement is replaced by the matched target index structure, and the SQL query statement to be executed is obtained.
It should be noted that, there may be a case where a matching target index structure cannot be obtained from the second number of sub-index structures. Therefore, under the condition that the empirical discrimination model determines that no matched target index structure exists, the method directly determines the source SQL query statement as the SQL query statement to be executed.
Step 103, executing the SQL query statement to be executed, and determining whether the execution time of the SQL query statement to be executed is greater than a preset threshold.
In an embodiment of the present application, the SQL query to be executed obtained through empirical discriminant model matching is not necessarily the current optimal solution. Therefore, after the relational database executes the SQL query statement, whether the execution time of the SQL query statement to be executed is greater than the preset threshold value is determined, and whether secondary optimization is performed is determined.
And 104, under the condition that the execution time is greater than a preset threshold value, storing the source SQL query statement in a statement table to be optimized, and optimizing the source SQL query statement in the statement table to be optimized based on a preset optimization rule to obtain an optimal SQL query statement.
In an embodiment of the application, when the execution time is greater than a preset threshold, it is determined that the to-be-executed SQL query statement is not optimal, the source SQL query statement is stored in the to-be-optimized statement table, and after the database enters an idle time slice, secondary optimization is performed.
Specifically, monitoring the relational database to determine whether the relational database is in an idle state; and traversing the index structure combination based on the tail index node of the source index structure under the condition that the relational database is determined to be in an idle state to obtain the optimal SQL query sentence corresponding to the source SQL query sentence. It can be understood that the end index node of the source index structure is a node corresponding to target information to be queried by the source SQL query statement.
And 105, storing the optimal SQL query statement in an empirical judgment model to realize updating.
In one embodiment of the present application, since the optimal solution given by the empirical model is not the optimal solution considered by the user at some time, the model also needs to provide a condition for supporting the user to actively enter the target SQL query statement. When the user inputs the optimal SQL into the system, the empirical model sends the optimal SQL into the discriminant model, a mark indicating whether the data record is the user SQL is required to be added into the data record, and when the discriminant model is used for discrimination, if the SQL mark of the user exists in a plurality of returned values, the SQL model of the user is preferentially selected.
Specifically, based on preset query requirements, constructing a target SQL query statement corresponding to the source SQL query statement, and adding a priority label to the target SQL query statement; and storing the target SQL query statement in an experience discrimination model, and preferentially selecting if a sub-index structure corresponding to the target SQL query statement exists when the source SQL query statement is input into a preset experience discrimination model to match the target index structure.
Based on the same inventive concept, the embodiment of the present application further provides an index selection system for a relational database, and an internal structure of the index selection system is shown in fig. 2.
Fig. 2 is a schematic diagram of an internal structure of an index selection system of a relational database according to an embodiment of the present disclosure. As shown in fig. 2, the system 200 includes: the system comprises an empirical judgment module 201, a first optimization module 202, an execution module 203, a second optimization module 204, an updating module 205 and a statement building model 206.
In an embodiment of the present application, the experience judging module 201 is configured to receive a source SQL query statement, and input the source SQL query statement to a preset experience judging model for matching a target index structure; the first optimization module 202 is configured to optimize a source SQL query statement based on a target index structure to obtain an SQL query statement to be executed when the empirical discrimination model determines that a matched target index structure exists; the execution module 203 is configured to execute the to-be-executed SQL query statement, and determine whether an execution time of the to-be-executed SQL query statement is greater than a preset threshold; the second optimization module 204 is configured to store the source SQL query statement in the statement table to be optimized under the condition that the execution time is greater than the preset threshold, and optimize the source SQL query statement in the statement table to be optimized based on a preset optimization rule to obtain an optimal SQL query statement; and the updating module 205 is configured to store the optimal SQL query statement in the empirical judgment model to implement the updating.
In an embodiment of the present application, inputting a source SQL query statement into a preset empirical discriminant model for performing target index structure matching specifically includes: analyzing the source SQL query statement to determine a first number of index nodes contained in the source index structure; the source index structure is an index structure contained in a source SQL query statement; matching the first number of index nodes with a plurality of optimized SQL query statements contained in the experience discrimination model to obtain a second number of sub-index structures; and processing the second number of sub-index structures based on a preset classification judging module to obtain a target index structure.
In an embodiment of the present application, optimizing a source SQL query statement in a statement table to be optimized based on a preset optimization rule specifically includes: monitoring the relational database to determine whether the relational database is in an idle state; and traversing the index structure combination based on the tail index node of the source index structure under the condition that the relational database is determined to be in an idle state so as to obtain the optimal SQL query statement corresponding to the source SQL query statement.
In an embodiment of the present application, the statement constructing model 206 is configured to construct, based on a preset query requirement, a target SQL query statement corresponding to a source SQL query statement, and add a priority tag to the target SQL query statement; and storing the target SQL query statement in an experience discrimination model, and preferentially selecting if a sub-index structure corresponding to the target SQL query statement exists when the source SQL query statement is input into a preset experience discrimination model to match the target index structure.
In an embodiment of the present application, the first optimization module 202 is further configured to determine the source SQL query statement as the to-be-executed SQL query statement when the empirical discrimination model determines that there is no matching target index structure.
Some embodiments of the present application provide a non-transitory computer storage medium corresponding to index selection for a relational database of fig. 1, storing computer-executable instructions configured to:
the relational database receives a source SQL query statement, and inputs the source SQL query statement into a preset experience discrimination model to carry out target index structure matching;
under the condition that the empirical discrimination model determines that the matched target index structure exists, optimizing a source SQL query statement based on the target index structure to obtain an SQL query statement to be executed;
executing the SQL query statement to be executed, and determining whether the execution time of the SQL query statement to be executed is greater than a preset threshold value;
under the condition that the execution time is greater than a preset threshold value, storing the source SQL query statement in a statement table to be optimized, and optimizing the source SQL query statement in the statement table to be optimized based on a preset optimization rule to obtain an optimal SQL query statement;
and storing the optimal SQL query statement in an empirical judgment model to realize updating.
The embodiments in the present application are described in a progressive manner, and the same and similar parts among the embodiments can be referred to each other, and each embodiment focuses on the differences from the other embodiments. Especially, for the internet of things device and medium embodiments, since they are substantially similar to the method embodiments, the description is simple, and the relevant points can be referred to the partial description of the method embodiments.
The system and the medium provided by the embodiment of the application correspond to the method one to one, so the system and the medium also have the beneficial technical effects similar to the corresponding method.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of a computer-readable medium.
Computer-readable media, including both permanent and non-permanent, removable and non-removable media, may implement the information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static Random Access Memory (SRAM), dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), read Only Memory (ROM), electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising a … …" does not exclude the presence of another identical element in a process, method, article, or apparatus that comprises the element.
The above description is only an example of the present application and is not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.

Claims (10)

1. An index selection method for a relational database, the method comprising:
the method comprises the steps that a relational database receives a source SQL query statement, and the source SQL query statement is input into a preset experience discrimination model to be matched with a target index structure;
optimizing the source SQL query statement based on the target index structure under the condition that the matched target index structure exists in the empirical judgment model so as to obtain an SQL query statement to be executed;
executing the SQL query statement to be executed, and determining whether the execution time of the SQL query statement to be executed is greater than a preset threshold value;
under the condition that the execution time is greater than a preset threshold value, storing the source SQL query statement in a statement table to be optimized, and optimizing the source SQL query statement in the statement table to be optimized based on a preset optimization rule to obtain an optimal SQL query statement;
and storing the optimal SQL query statement in the empirical judgment model to realize updating.
2. The method of claim 1, wherein the step of inputting the source SQL query statement into a preset empirical discriminant model for target index structure matching comprises:
parsing the source SQL query statement to determine a first number of index nodes contained in a source index structure; wherein, the source index structure is an index structure contained in the source SQL query statement;
matching the first number of index nodes with a plurality of optimized SQL query statements contained in the empirical discrimination model to obtain a second number of sub-index structures;
and processing the second number of sub-index structures based on a preset classification judgment module to obtain a target index structure.
3. The index selection method of a relational database according to claim 2, wherein the optimizing the source SQL query statement in the statement table to be optimized based on a preset optimization rule specifically comprises:
monitoring the relational database to determine whether the relational database is in an idle state;
and traversing the index structure combination based on the tail index node of the source index structure under the condition that the relational database is determined to be in an idle state, so as to obtain the optimal SQL query statement corresponding to the source SQL query statement.
4. The method of claim 1, wherein before the relational database receives the source SQL query statement, the method further comprises:
constructing a target SQL query statement corresponding to the source SQL query statement based on a preset query requirement, and adding a priority label to the target SQL query statement;
and storing the target SQL query statement in the experience discrimination model, and preferentially selecting if a sub-index structure corresponding to the target SQL query statement exists when the source SQL query statement is input into a preset experience discrimination model to match a target index structure.
5. The method of claim 1, further comprising:
and under the condition that the empirical discrimination model determines that no matched target index structure exists, determining the source SQL query statement as the SQL query statement to be executed.
6. An index selection system for a relational database, the index selection system being applied to the relational database, the system comprising: the system comprises an experience judgment module, a first optimization module, an execution module, a second optimization module and an updating module;
the experience judging module is used for receiving a source SQL query statement and inputting the source SQL query statement into a preset experience judging model to carry out target index structure matching;
the first optimization module is used for optimizing the source SQL query statement based on the target index structure under the condition that the empirical discrimination model determines that the matched target index structure exists so as to obtain the SQL query statement to be executed;
the execution module is used for executing the SQL query statement to be executed and determining whether the execution time of the SQL query statement to be executed is greater than a preset threshold value;
the second optimization module is used for storing the source SQL query statement in a statement table to be optimized under the condition that the execution time is greater than a preset threshold value, and optimizing the source SQL query statement in the statement table to be optimized based on a preset optimization rule to obtain an optimal SQL query statement;
and the updating module is used for storing the optimal SQL query statement in the empirical judgment model so as to realize updating.
7. The system of claim 6, wherein the step of inputting the source SQL query statement into a preset empirical decision model for matching the target index structure comprises:
parsing the source SQL query statement to determine a first number of index nodes contained in a source index structure; wherein, the source index structure is an index structure contained in the source SQL query statement;
matching the first number of index nodes with a plurality of optimized SQL query statements contained in the empirical discrimination model to obtain a second number of sub-index structures;
and processing the second number of sub-index structures based on a preset classification judgment module to obtain a target index structure.
8. The index selection system of a relational database according to claim 7, wherein the optimizing the source SQL query statement in the statement table to be optimized based on a preset optimization rule specifically comprises:
monitoring the relational database to determine whether the relational database is in an idle state;
and traversing the index structure combination based on the tail index node of the source index structure under the condition that the relational database is determined to be in an idle state, so as to obtain the optimal SQL query statement corresponding to the source SQL query statement.
9. The system of claim 6, further comprising: building a model by sentences;
the statement construction model is used for constructing a target SQL query statement corresponding to the source SQL query statement based on a preset query requirement, and adding a priority label to the target SQL query statement;
and storing the target SQL query statement in the experience discrimination model, and preferentially selecting if a sub-index structure corresponding to the target SQL query statement exists when the source SQL query statement is input into a preset experience discrimination model to match a target index structure.
10. A non-transitory computer storage medium for index selection of a relational database, the computer storage medium having stored thereon computer-executable instructions configured to:
the method comprises the following steps that a relational database receives a source SQL query statement, and the source SQL query statement is input into a preset experience discrimination model to be matched with a target index structure;
optimizing the source SQL query statement based on the target index structure under the condition that the matched target index structure exists in the empirical judgment model so as to obtain an SQL query statement to be executed;
executing the SQL query statement to be executed, and determining whether the execution time of the SQL query statement to be executed is greater than a preset threshold value;
under the condition that the execution time is greater than a preset threshold value, storing the source SQL query statement in a statement table to be optimized, and optimizing the source SQL query statement in the statement table to be optimized based on a preset optimization rule to obtain an optimal SQL query statement;
and storing the optimal SQL query statement in the empirical judgment model to realize updating.
CN202211165348.7A 2022-09-23 2022-09-23 Index selection method, system and storage medium for relational database Pending CN115470306A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211165348.7A CN115470306A (en) 2022-09-23 2022-09-23 Index selection method, system and storage medium for relational database

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211165348.7A CN115470306A (en) 2022-09-23 2022-09-23 Index selection method, system and storage medium for relational database

Publications (1)

Publication Number Publication Date
CN115470306A true CN115470306A (en) 2022-12-13

Family

ID=84335194

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211165348.7A Pending CN115470306A (en) 2022-09-23 2022-09-23 Index selection method, system and storage medium for relational database

Country Status (1)

Country Link
CN (1) CN115470306A (en)

Similar Documents

Publication Publication Date Title
CN107038207B (en) Data query method, data processing method and device
US11423082B2 (en) Methods and apparatus for subgraph matching in big data analysis
US9916368B2 (en) Non-exclusionary search within in-memory databases
CN107038161B (en) Equipment and method for filtering data
US11449564B2 (en) System and method for searching based on text blocks and associated search operators
KR102005343B1 (en) Partitioned space based spatial data object query processing apparatus and method, storage media storing the same
CN113110866A (en) Method and device for evaluating database change script
WO2013138441A1 (en) Systems, methods, and software for computing reachability in large graphs
US20130159347A1 (en) Automatic and dynamic design of cache groups
CN114880504A (en) Graph data query method, device and equipment
US11995059B2 (en) Database index and database query processing method, apparatus, and device
CN105630475A (en) Data label organization system and organization method
CN114297204A (en) Data storage and retrieval method and device for heterogeneous data source
CN114328601A (en) Data down-sampling and data query method, system and storage medium
CN116775830A (en) Online technical document searching method, device and medium
Schildgen et al. Marimba: A framework for making mapreduce jobs incremental
CN110019295B (en) Database retrieval method, device, system and storage medium
CN115470306A (en) Index selection method, system and storage medium for relational database
CN110019544B (en) Data query method and system
CN112860912B (en) Method and device for updating knowledge graph
US20190034481A1 (en) Data stores for generating an information source
CN112749189A (en) Data query method and device
US11386155B2 (en) Filter evaluation in a database system
US20180232416A1 (en) Distribute execution of user-defined function
Anastasiu et al. Parallel cosine nearest neighbor graph construction

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination