CN117331969A - Processing method, storage medium and device for database operation statement - Google Patents

Processing method, storage medium and device for database operation statement Download PDF

Info

Publication number
CN117331969A
CN117331969A CN202311343056.2A CN202311343056A CN117331969A CN 117331969 A CN117331969 A CN 117331969A CN 202311343056 A CN202311343056 A CN 202311343056A CN 117331969 A CN117331969 A CN 117331969A
Authority
CN
China
Prior art keywords
index
database operation
path
processing
target
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
CN202311343056.2A
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.)
Beijing Kingbase Information Technologies Co Ltd
Original Assignee
Beijing Kingbase Information Technologies 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 Beijing Kingbase Information Technologies Co Ltd filed Critical Beijing Kingbase Information Technologies Co Ltd
Priority to CN202311343056.2A priority Critical patent/CN117331969A/en
Publication of CN117331969A publication Critical patent/CN117331969A/en
Pending legal-status Critical Current

Links

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/24Querying
    • G06F16/245Query processing
    • G06F16/2453Query optimisation
    • G06F16/24534Query rewriting; Transformation
    • G06F16/24542Plan optimisation
    • 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)
  • Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computational Linguistics (AREA)
  • Operations Research (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention provides a processing method, a storage medium and equipment of database operation sentences. Wherein the method comprises the following steps: acquiring index configuration information in a database operation statement; processing the generation path of the execution plan according to the index configuration information; and generating an execution plan according to the processed generation path. By the method, the recommended index keywords and the execution logic of the appointed index keywords are modified, the influence of index configuration sentences on path selection is further improved, generation of an execution plan is controlled, and database operation sentences are executed in an expected mode.

Description

Processing method, storage medium and device for database operation statement
Technical Field
The present invention relates to the field of databases, and in particular, to a method, a storage medium, and an apparatus for processing database operation statements.
Background
With the popularization of databases, the performance requirements of the databases are higher and higher, so that the databases need to be optimized when executing database operation sentences, and finally an optimal execution plan is obtained.
However, in actual production, the business requirement may manually interfere with the determination of the optimal execution plan, so that the database operation statement is executed in an expected manner, for example, in the manner of using index, but the effect is not strong, and often the database operation statement is still executed according to another execution plan, so that the expected purpose is not achieved.
Disclosure of Invention
It is an object of the invention to control the generation of execution plans.
It is a further object of the invention to increase the impact of index configuration statements.
In particular, the invention provides a processing method of database operation sentences, which comprises the following steps:
acquiring index configuration information in a database operation statement;
processing the generation path of the execution plan according to the index configuration information;
and generating an execution plan according to the processed generation path.
Optionally, the step of obtaining index configuration information in the database operation statement includes:
acquiring a database operation statement;
judging whether the database operation statement contains a target keyword or not;
if yes, extracting the target keywords and the content contained in the target keywords as index configuration information.
Optionally, the target keywords include recommended index keywords;
the step of processing the generation path of the execution plan according to the index configuration information includes:
judging whether the target keyword in the index configuration information is a recommended index keyword or not;
if yes, processing an index scanning path in the generation path;
and adding scanning cost for scanning paths other than the index scanning path in the generation path.
Optionally, the step of processing the index scan path in the generation path includes:
recording index information in database operation sentences into a preset information table;
acquiring a target index designated by a target keyword;
and deleting indexes except the target index in the preset information table.
Optionally, the target keywords include specified index keywords;
the step of processing the generation path of the execution plan according to the index configuration information includes:
judging whether the target keyword in the index configuration information is a designated index keyword or not;
if yes, processing an index scanning path in the generation path;
adding scanning cost for scanning paths other than the index scanning path in the generation path;
and deleting the index scanning path and the scanning paths except the full-table scanning path in the generating path.
Optionally, the step of processing the index scan path in the generation path includes:
recording index information in database operation sentences into a preset information table;
acquiring a target index designated by a target keyword;
and deleting indexes except the target index in the preset information table.
Optionally, the target keywords include ignore index keywords;
the step of processing the generation path of the execution plan according to the index configuration information includes:
judging whether the target keyword in the index configuration information is an neglected index keyword or not;
if yes, recording index information in the database operation statement into a preset information table;
acquiring a target index designated by a target keyword;
and deleting the target index in a preset information table.
Optionally, the step of generating the execution plan according to the processed generation path includes:
calculating the cost consumed by each generated path;
and sorting according to the cost, and selecting an optimal generation path as an execution plan.
Optionally, the step of obtaining the database operation statement further includes:
calculating the selectivity of the database operation sentences;
judging whether the selectivity is larger than a preset threshold value or not;
if yes, directly determining to execute the plan as the full-table scanning.
According to yet another aspect of the present invention, there is also provided a machine-readable storage medium having stored thereon a machine-executable program which when executed by a processor implements a method of processing a database operation statement of any of the above.
In the scheme of the invention, index configuration information in a database operation statement is firstly obtained; processing the generation path of the execution plan according to the index configuration information; and generating an execution plan according to the processed generation path. By the method, the generation of the execution plan of the database operation statement can be controlled according to the index configuration information, so that the database operation statement is executed in an expected mode.
Further, in the scheme of the invention, when the target keyword is the recommended index keyword, the index scanning paths in the generated paths are processed first, and then the cost is increased for the scanning paths other than the index scanning paths in the generated paths. Therefore, the strength of the recommended index keywords is increased, and the execution plan is executed according to the recommended index as much as possible. When the target keyword is a specified index keyword, the index scan paths in the generation paths are processed first, and then the cost is increased for scan paths other than the index scan paths in the generation paths. Other paths than the index scan and the full table scan are then deleted, forcing the execution plan to execute according to the specified index. By the method, influence of index configuration sentences on path selection is further improved, so that database operation sentences can be executed in an expected mode.
The above, as well as additional objectives, advantages, and features of the present invention will become apparent to those skilled in the art from the following detailed description of a specific embodiment of the present invention when read in conjunction with the accompanying drawings.
Drawings
Some specific embodiments of the invention will be described in detail hereinafter by way of example and not by way of limitation with reference to the accompanying drawings. The same reference numbers will be used throughout the drawings to refer to the same or like parts or portions. It will be appreciated by those skilled in the art that the drawings are not necessarily drawn to scale. In the accompanying drawings:
FIG. 1 is a flow diagram of a method of processing database operation statements according to one embodiment of the invention;
FIG. 2 is a flow diagram of a method of processing database operation statements according to another embodiment of the invention;
FIG. 3 is a flow diagram of a method of processing database operation statements in accordance with yet another embodiment of the present invention;
FIG. 4 is a schematic diagram of a machine-readable storage medium in a method of processing database operating statements according to one embodiment of the invention; and
FIG. 5 is a schematic diagram of a method computer device for processing database operation statements in accordance with one embodiment of the invention.
Detailed Description
It should be understood by those skilled in the art that the embodiments described below are only some embodiments of the present invention, but not all embodiments of the present invention, and the some embodiments are intended to explain the technical principles of the present invention and are not intended to limit the scope of the present invention. All other embodiments, which can be obtained by a person skilled in the art without any inventive effort, based on the embodiments provided by the present invention, shall still fall within the scope of protection of the present invention.
FIG. 1 is a flow diagram of a method of processing a database operation statement according to one embodiment of the invention. In some alternative embodiments, the present process may generally include:
step S101, obtaining index configuration information in a database operation sentence. In this embodiment, the database operation statement may be an SQL statement. After receiving the database operation statement, the database calculates the cost consumed by the database operation statement through various paths according to the specific content of the database operation statement, and finally determines the optimal path according to the consumed cost to execute the database operation statement, namely, optimize the database operation statement. However, in actual production, the service requirement may intervene in the determination of the optimal execution plan, so that the database operation statement is executed in an expected manner, and an alternative way is to add an index configuration statement into the database operation statement, and when the database receives such database operation statement, the database can obtain the corresponding index configuration information through keyword recognition. An alternative example of the index configuration information is information such as the type of configuration statement of the index and its corresponding specific index. The specific content of the index configuration information can be determined by those skilled in the art according to the actual situation.
Step S102, processing the generation path of the execution plan according to the index configuration information. In some alternative embodiments, the generation path of the execution plan is processed by some alternative operations such as: and carrying out corresponding processing on paths designated by the index configuration information, and carrying out processing modes such as adding cost on paths other than the designated paths. The cost refers to a selection mode of the optimizer in determining the final selected path, and the consumed cost of each path is sequenced, so that the optimal path is selected to generate a corresponding execution plan.
Step S103, generating an execution plan according to the processed generation path.
By the method, influence of index configuration sentences on path selection is improved, generation of an execution plan is controlled, and database operation sentences are executed in an expected mode.
In this embodiment, the step of obtaining the index configuration information in the database operation statement may generally include: acquiring a database operation statement; judging whether the database operation statement contains a target keyword or not; if yes, extracting the target keywords and the content contained in the target keywords as index configuration information. Some optional examples of the target keyword are: use index (recommended index), force index (specified index), and ignore index. The specific category of the target keyword can be determined by those skilled in the art according to the actual situation.
In some alternative embodiments, the target keywords may include recommended index keywords; the step of processing the generation path of the execution plan according to the index configuration information may generally include: judging whether the target keyword in the index configuration information is a recommended index keyword or not; if yes, processing an index scanning path in the generation path; and adding cost for the scanning paths except the index scanning path in the generation path. The recommended index keyword may be an use index, which is used to instruct the database to recommend that a corresponding execution plan be generated with a specific index specified by the keyword in the process of generating the execution plan. One way of operation for recommending index keywords in this embodiment is: after the step of processing the index scan paths in the generation paths, the cost is increased for scan paths other than the index scan paths in the generation paths. By the method, when the subsequent optimizers calculate the cost of each scanning path, the optimizers are more prone to using index scanning because the cost of other paths is artificially increased, so that the purpose of recommending indexes is achieved.
In this embodiment, the step of processing the index scan path in the generation path may generally include: recording index information in database operation sentences into a preset information table; acquiring a target index designated by a target keyword; and deleting indexes except the target index in the preset information table. By the method, when the optimizer determines the execution path scanned by the index, the optimizer can be ensured to operate according to the designated index, so that the aim of recommending the index is fulfilled.
In other alternative embodiments, the target keywords may generally include specified index keywords; the step of processing the generation path of the execution plan according to the index configuration information may generally include: judging whether the target keyword in the index configuration information is a designated index keyword or not; if yes, processing an index scanning path in the generation path; adding cost for scanning paths other than the index scanning path in the generated path; and deleting the index scanning path and the scanning paths except the full-table scanning path in the generating path. The specified index keyword may be a force index, which is used to instruct the database to specify a specific index specified by the keyword to generate a corresponding execution plan in the process of generating the execution plan. One way of operating the specified index key in this embodiment is: after the step of processing the index scan path in the generation path to increase the cost of the scan path other than the index scan path in the generation path, the index scan path and the scan path other than the full-table scan path are newly deleted. By the method, when the subsequent optimizer calculates the cost of each scanning path, only the index scanning path can be found, so that the purpose of designating the index is achieved. Moreover, the cost is increased for other scan paths, and then the other scan paths are deleted, because the cost of the index scan path is too high if the cost is not increased for other scan paths in the database execution process, and the index scan path is automatically ignored by the optimizer. Meanwhile, in order to ensure the normal operation of the database, at least one effective path needs to be reserved in the scanning path of the database, and the whole table scanning is effective in the execution process of the database, so that other scanning paths except the index scanning path and the whole table scanning path are deleted, and the database operation error caused by the failure of the index scanning path is avoided.
In this embodiment, the step of processing the index scan path in the generation path may generally include: recording index information in database operation sentences into a preset information table; acquiring a target index designated by a target keyword; and deleting indexes except the target index in the preset information table. By the method, when the optimizer determines the execution path scanned by the index, the optimizer can be ensured to operate according to the appointed index, so that the aim of the appointed index is fulfilled.
In yet other alternative embodiments, the target keywords include ignore index keywords; the step of processing the generation path of the execution plan according to the index configuration information may generally include: judging whether the target keyword in the index configuration information is an neglected index keyword or not; if yes, recording index information in the database operation statement into a preset information table; acquiring a target index designated by a target keyword; and deleting the target index in a preset information table. Wherein the ignore index key may be an ignore index that instructs the database to ignore the specific index specified by this key in generating the execution plan. By the method, when the subsequent optimizer calculates the cost of each scanning path, even if the index scanning path is adopted, the designated index can be ignored, so that the purpose is achieved.
In this embodiment, the step of generating the execution plan according to the processed generation path may generally include: calculating the cost consumed by each generated path; and sorting according to the cost, and selecting an optimal generation path as an execution plan.
The step of retrieving the database operation statement may further generally include: calculating the selectivity of the database operation sentences; judging whether the selectivity is larger than a preset threshold value or not; if yes, directly determining to execute the plan as the full-table scanning. The selection rate refers to the ratio of the rows meeting the condition to the result set of the query, one optional example of the preset threshold is 1, the selection rate is greater than 1, and the database operation statement is indicated to operate on the full table, so that the full table scanning mode can be directly selected, and the database server resources are saved.
By the method, the recommended index keywords and the execution logic of the appointed index keywords are modified, the influence of index configuration sentences on path selection is further improved, generation of an execution plan is controlled, and database operation sentences are executed in an expected mode.
Fig. 2 is a flow chart of a method for processing a database operation statement according to another embodiment of the present invention. In some alternative embodiments, the present process may generally include:
step S201, a database operation sentence is acquired.
Step S202, judging whether the selectivity is larger than a preset threshold. In this embodiment, the selectivity generally refers to the ratio of rows satisfying the condition to the result set of the query.
In step S203, when the determination in step S202 is yes, it is determined that the execution plan is the full-table scan. In this embodiment, an optional example of the preset threshold is 1, where the selection rate is greater than 1, which indicates that the database operation statement will operate on the full table, so the full table scanning manner may be directly selected, thereby saving database server resources.
Step S204, if no is determined in step S202, it is determined whether the database operation sentence contains the target keyword. In this embodiment, some optional examples of the target keyword are: use index (recommended index), force index (specified index), and ignore index.
In step S205, if yes in step S204, the target keyword and the content contained therein are extracted as index arrangement information. In some alternative embodiments, the usage patterns of the target keyword are generally use index (idx 1, idx 2), ignore index (idx 1, idx 3) and force index (idx 2), so the target keyword and the content contained therein can be obtained as index configuration information according to such a statement. Wherein use index (idx 1, idx 2) is used to instruct the database to recommend that the specific indexes idx1 and idx2 specified by the keyword generate corresponding execution plans in the process of generating execution plans; force index (idx 2) for instructing the database to specify a specific index idx2 specified by the keyword in generating an execution plan to generate a corresponding execution plan; the ignore index (idx 1, idx 3) is used to instruct the database to specify specific indexes idx1 and idx3 specified by ignoring this keyword in generating the execution plan.
Step S206, judging the target keyword category in the index configuration information.
Step S207, corresponding processing is carried out on the index scanning paths in the generated paths according to the target keyword category. In some alternative embodiments, when the target keyword is a recommended index keyword, the processing steps may generally include: recording index information in database operation sentences into a preset information table; acquiring a target index designated by a target keyword; deleting indexes except the target indexes in the preset information table, and adding cost for scanning paths except the index scanning path in the generated paths. By the method, when the subsequent optimizers calculate the cost of each scanning path, the optimizers are more prone to using index scanning because the cost of other paths is artificially increased, so that the purpose of recommending indexes is achieved.
When the target keyword is a specified index keyword, the processing steps may generally include: recording index information in database operation sentences into a preset information table; acquiring a target index designated by a target keyword; deleting indexes except for target indexes in a preset information table, adding cost to the scanning paths except for the index scanning path in the generation path, and deleting the scanning paths except for the index scanning path and the full table scanning path in the generation path. By the method, when the subsequent optimizer calculates the cost of each scanning path, only the index scanning path and the full-table scanning path can be found, so that the purpose of designating the index is achieved. Moreover, the cost is added to other scan paths, and then the other scan paths are deleted, because in the process of executing the database, if the cost is not added to other scan paths, the cost of indexing the scan paths may be too high, and the cost may be automatically ignored by the optimizer. Meanwhile, in order to ensure the normal operation of the database, at least one effective path needs to be reserved in the scanning path of the database, and the whole table scanning is effective in the execution process of the database, so that other scanning paths except the index scanning path and the whole table scanning path are deleted, and the database operation error caused by the failure of the index scanning path is avoided.
When the target keyword is an ignore index keyword, the processing steps may generally include: recording index information in database operation sentences into a preset information table; acquiring a target index designated by a target keyword; and deleting the target index in a preset information table. By the method, when the subsequent optimizer calculates the cost of each scanning path, even if the index scanning path is adopted, the designated index can be ignored, so that the purpose is achieved.
Step S208, the cost consumed by each generated path is calculated.
Step S209, sorting according to the cost, and selecting an optimal generation path as an execution plan.
By the method, the recommended index keywords and the execution logic of the appointed index keywords are modified, the influence of index configuration sentences on path selection is further improved, generation of an execution plan is controlled, and database operation sentences are executed in an expected mode. And when the selectivity is larger than a preset threshold value, the method is directly executed in a full scanning mode, so that the resource consumption of the database is reduced.
FIG. 3 is a flow chart of a method of processing a database operation statement according to yet another embodiment of the invention. In some alternative embodiments, the present process may generally include:
step S301, index information is acquired from the information table. In this embodiment, the information table records index information in the database operation statement, where the index key word and specific index list information contained therein may be generally included. The type and storage mode of the information table can be set by a person skilled in the art according to actual conditions.
Step S302, judging whether the index keyword is recommended or designated. In some alternative embodiments, the recommended index key may generally be a use index and the specified index key may generally be a force index. The specific forms corresponding to different types of index keywords can be determined by a person skilled in the art according to actual conditions.
Step S303, if no is determined in step S302, determines whether or not the index keyword is ignored. In this embodiment, the ignore index key may be an ignore index that instructs the database to ignore the specific index specified by this key in generating the execution plan.
Step S304, when step S303 determines yes, the designated index item is deleted from the information table. In this step, an alternative example is as follows: when indexing keywords and their specified content are as follows: when indicated by the ignore index (idx 1, idx 3), then the indices idx1 and idx3 are deleted from the information table, thereby causing the database to ignore idx1 and idx3 in generating the execution plan.
In step S305, when step S302 determines yes, only the specified index item is retained in the information table. In this step, an alternative example is as follows: when indexing keywords and their specified content are as follows: use index (idx 1, idx 2), then other indexes than idx1 and idx2 are deleted from the information table, so that the database can only generate an execution plan through idx1 and idx3 in generating an execution plan from the indexes.
Step S306 adds a cost to the scan path other than the index scan. In some alternative embodiments, the cost refers to a selection manner by which the optimizer generates a corresponding execution plan by ordering the costs consumed for each path in determining the final selected path. The probability of the optimizer to select the index scan path is thus increased in this step by adding a cost to the other scan paths. The specific manner of increasing the cost and specific values can be determined by those skilled in the art according to the actual circumstances.
Step S307, determining whether the selectivity is less than 1.
In step S308, if no is determined in step S307, full-table scanning is used. In this embodiment, when the selection rate is greater than or equal to 1, it indicates that the database operation statement will operate on the full table, so that the full table scanning mode can be directly selected, thereby saving database server resources.
Step S309, if yes in step S307, it is determined whether or not the index is available. In this embodiment, when the selectivity is less than 1, it means that the database operation statement will not operate on the full table, so that a faster execution plan, such as an index scan, can be generated through other paths.
In step S310, if the determination in step S309 is yes, it is determined whether or not the index keyword is specified. In this embodiment, the specified index keyword may be a force index, which is used to instruct the database to specify, in the process of generating the execution plan, that a corresponding execution plan be generated with the specific index specified by the keyword.
In step S311, if the determination in step S310 is yes, the other scan paths other than the index scan and the full-table scan are deleted. Through the step, under the condition that the index keywords are designated index keywords, the optimizer can be ensured to generate an execution plan by using the paths of the index scan, meanwhile, in order to ensure the normal operation of the database, at least one effective path needs to be reserved in the scanning paths of the database, and the whole table scan is effective in the database execution process, so that other scanning paths except the index scanning paths and the whole table scanning paths are deleted, and the database operation error caused by the failure of the index scanning paths is avoided.
In step S312, when no is determined in step S309, no is determined in step S310, and the execution of step S311 is completed, an optimal path is calculated. In this embodiment, when step S309 determines no, it indicates that there is no available index, that is, the execution plan cannot be generated using the path scanned by the index, so that the following step is skipped to directly calculate the optimal path; when step S310 determines no, indicating that the index keyword is a recommended index keyword, after the operations of step S305 and step S306, the execution plan can be generated with a high probability by selecting a recommended index scan; when the execution of step S311 is completed, only the path of the index scan exists and only the index specified by the index keyword exists in the information table, thereby achieving the purpose of specifying the index.
By the method, the recommended index keywords and the execution logic of the appointed index keywords are modified, the influence of index configuration sentences on path selection is further improved, generation of an execution plan is controlled, and database operation sentences are executed in an expected mode. And when the selectivity is larger than a preset threshold value, the method is directly executed in a full scanning mode, so that the resource consumption of the database is reduced.
The present implementation also provides a machine-readable storage medium and a computer device. Fig. 4 is a schematic diagram of a machine-readable storage medium 401 according to one embodiment of the invention, and fig. 5 is a schematic diagram of a computer device 503 according to one embodiment of the invention.
The machine-readable storage medium 401 has stored thereon a machine-executable program 402, which when executed by a processor, implements the method of processing database operation statements of any of the embodiments described above.
The computer device 503 may include a memory 501, a processor 502, and a machine executable program 402 stored on the memory 501 and running on the processor 502, and the processor 502 implements the processing method of the database operation statement of any of the embodiments described above when executing the machine executable program 402.
It should be appreciated that the logic and/or steps represented in the flow diagrams or otherwise described herein, e.g., generating an execution plan, may be embodied in any machine-readable storage medium for use by or in connection with an instruction execution system, apparatus, or device, such as a computer-based system, processor-containing system, or other system that can fetch the instructions from the instruction execution system, apparatus, or device and execute the instructions.
For the purposes of this description of embodiments, a machine-readable storage medium 401 may be any means that can contain, store, communicate, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device.
It is to be understood that portions of the present invention may be implemented in hardware, software, firmware, or a combination thereof. In the above-described embodiments, the various steps or methods may be implemented in software or firmware stored in a memory and executed by a suitable instruction execution system.
The computer device 503 may be a type of in-vehicle device such as an in-vehicle computer. The computer device 503 may be described in the general context of computer-system-executable instructions, such as program modules, being executed by a computer system. Generally, program modules may include routines, programs, objects, components, logic, data structures, etc. that perform particular tasks or implement particular abstract data types. Computer device 503 may be implemented in a distributed cloud computing environment where remote processing devices coupled via a communications network perform tasks. In a distributed cloud computing environment, program modules may be located in both local and remote computing system storage media including memory storage devices such as an automobile central processing unit.
The computer device 503 may comprise a processor 502 adapted to execute stored instructions, a memory 501 providing temporary storage for the operation of the instructions during operation. The processor 502 may be a single core processor, a multi-core processor, a computing cluster, or any number of other configurations. Memory 501 may include Random Access Memory (RAM), read only memory, flash memory, or any other suitable storage system.
The processor 502 may be connected through a system interconnect (e.g., PCI-Express, etc.) to an I/O interface (input/output interface) adapted to connect the computer device 503 to one or more I/O devices (input/output devices). The I/O devices may include, for example, a keyboard and a pointing device, which may include a touch pad or touch screen, among others. The I/O device may be a built-in component of the computer device 503 or may be a device externally connected to the computing device.
The processor 502 may also be linked through a system interconnect to a display interface adapted to connect the computer device 503 to a display device. The display device may include a display screen as a built-in component of the computer device 503. The display device may also include a computer monitor, television, projector, or the like, which is externally connected to the computer device 503. Further, a network interface controller (network interface controller, NIC) may be adapted to connect the computer device 503 to a network through a system interconnect. In some embodiments, the NIC may use any suitable interface or protocol (such as an internet small computer system interface, etc.) to transfer data. The network may be a cellular network, a radio network, a Wide Area Network (WAN), a Local Area Network (LAN), or the internet, among others. The remote device may be connected to the computing device through a network.
The flowcharts provided by this embodiment are not intended to indicate that the operations of the method are to be performed in any particular order, or that all of the operations of the method are included in all of each case. Furthermore, the method may include additional operations. Additional variations may be made to the above-described methods within the scope of the technical ideas provided by the methods of the present embodiments.
By now it should be appreciated by those skilled in the art that while a number of exemplary embodiments of the invention have been shown and described herein in detail, many other variations or modifications of the invention consistent with the principles of the invention may be directly ascertained or inferred from the present disclosure without departing from the spirit and scope of the invention. Accordingly, the scope of the present invention should be understood and deemed to cover all such other variations or modifications.

Claims (10)

1. A method of processing database operation statements, comprising:
acquiring index configuration information in the database operation statement;
processing a generation path of the execution plan according to the index configuration information;
and generating the execution plan according to the processed generation path.
2. The method for processing a database operation sentence according to claim 1, wherein,
the step of obtaining the index configuration information in the database operation statement includes:
acquiring the database operation statement;
judging whether the database operation statement contains a target keyword or not;
if yes, extracting the target keywords and the content contained in the target keywords as the index configuration information.
3. The method for processing a database operation sentence according to claim 2, wherein,
the target keywords comprise recommended index keywords;
the step of processing the generation path of the execution plan according to the index configuration information comprises the following steps:
judging whether the target keyword in the index configuration information is the recommended index keyword or not;
if yes, processing an index scanning path in the generation path;
and adding cost for scanning paths other than the index scanning path in the generation paths.
4. The method for processing a database operation sentence according to claim 3, wherein,
the step of processing the index scan path in the generation path includes:
recording index information in the database operation statement into a preset information table;
acquiring a target index designated by the target keyword;
and deleting indexes except the target index in the preset information table.
5. The method for processing a database operation sentence according to claim 2, wherein,
the target keywords comprise designated index keywords;
the step of processing the generation path of the execution plan according to the index configuration information comprises the following steps:
judging whether the target keyword in the index configuration information is the appointed index keyword or not;
if yes, processing an index scanning path in the generation path;
adding cost for scanning paths other than the index scanning path in the generation path;
and deleting the index scanning path and the scanning paths except the full-table scanning path in the generating path.
6. The method for processing a database operation sentence according to claim 5, wherein,
the step of processing the index scan path in the generation path includes:
recording index information in the database operation statement into a preset information table;
acquiring a target index designated by the target keyword;
and deleting indexes except the target index in the preset information table.
7. The method for processing a database operation sentence according to claim 2, wherein,
the target keywords include neglecting index keywords;
the step of processing the generation path of the execution plan according to the index configuration information comprises the following steps:
judging whether the target keyword in the index configuration information is the neglected index keyword or not;
if yes, recording index information in the database operation statement into a preset information table;
acquiring a target index designated by the target keyword;
and deleting the target index in the preset information table.
8. The method for processing a database operation sentence according to claim 1, wherein,
the step of generating the execution plan according to the processed generation path includes:
calculating the cost consumed by each generated path;
and sorting according to the cost, and selecting an optimal generation path as the execution plan.
9. The method for processing a database operation sentence according to claim 2, wherein,
the step of obtaining the database operation statement further comprises the following steps:
calculating the selectivity of the database operation sentences;
judging whether the selectivity is larger than a preset threshold value or not;
if yes, the execution plan is directly determined to be the full-table scanning.
10. A machine-readable storage medium having stored thereon a machine-executable program which, when executed by a processor, implements a method of processing a database operation statement according to any one of claims 1 to 9.
CN202311343056.2A 2023-10-17 2023-10-17 Processing method, storage medium and device for database operation statement Pending CN117331969A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311343056.2A CN117331969A (en) 2023-10-17 2023-10-17 Processing method, storage medium and device for database operation statement

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311343056.2A CN117331969A (en) 2023-10-17 2023-10-17 Processing method, storage medium and device for database operation statement

Publications (1)

Publication Number Publication Date
CN117331969A true CN117331969A (en) 2024-01-02

Family

ID=89279043

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311343056.2A Pending CN117331969A (en) 2023-10-17 2023-10-17 Processing method, storage medium and device for database operation statement

Country Status (1)

Country Link
CN (1) CN117331969A (en)

Similar Documents

Publication Publication Date Title
CN109144696A (en) A kind of method for scheduling task, device, electronic equipment and storage medium
US20230214689A1 (en) Method and apparatus for processing dialogue, electronic device, and storage medium
CN116737908A (en) Knowledge question-answering method, device, equipment and storage medium
CN109241100B (en) Query method, device, equipment and storage medium
CN111177247B (en) Data conversion method, device and storage medium
CN112989171A (en) Data query method, device, equipment and medium
CN111858366B (en) Test case generation method, device, equipment and storage medium
CN117331969A (en) Processing method, storage medium and device for database operation statement
CN110716949A (en) Method, device, medium and electronic equipment for automatically optimizing structured query statement
CN110689137B (en) Parameter determination method, system, medium, and electronic device
KR102167776B1 (en) An apparatus for evaluating the risk of Hydrogen Energy Stations, a method therefor, and a computer recordable medium storing a program to perform the method
JP4906968B1 (en) Database inquiry terminal
CN116204550A (en) Database query statement optimization method, storage medium and device
CN116595044A (en) Optimization method, storage medium and equipment for database selectivity calculation
CN117076491A (en) Data processing method, storage medium and equipment
CN114237588A (en) Code warehouse selection method, device, equipment and storage medium
CN115455057A (en) Execution method of database connection operation, storage medium and computer device
CN112231564B (en) Goods source sorting method and device, electronic equipment and storage medium
CN111753164A (en) Link event guiding method and device, electronic equipment and storage medium
CN110765237A (en) Document processing method, document processing device, storage medium and electronic equipment
CN117149821B (en) Query optimization method, storage medium and computer equipment
CN117235119B (en) Multi-table joint query method under low-code platform
JP5256355B2 (en) Database inquiry terminal
CN114461889B (en) Data searching method, device, electronic equipment and program product
CN109978081B (en) Method, apparatus, device and medium for determining feature transformation mode

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