CN117762980A - Query optimization method, storage medium and computer equipment - Google Patents

Query optimization method, storage medium and computer equipment Download PDF

Info

Publication number
CN117762980A
CN117762980A CN202311845702.5A CN202311845702A CN117762980A CN 117762980 A CN117762980 A CN 117762980A CN 202311845702 A CN202311845702 A CN 202311845702A CN 117762980 A CN117762980 A CN 117762980A
Authority
CN
China
Prior art keywords
predicate
set predicate
condition
query statement
target query
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
CN202311845702.5A
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 CN202311845702.5A priority Critical patent/CN117762980A/en
Publication of CN117762980A publication Critical patent/CN117762980A/en
Pending legal-status Critical Current

Links

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention provides a query optimization method, a storage medium and a computer device, wherein the query optimization method comprises the following steps: acquiring a target query statement and predicates in the target query statement; judging whether a first set predicate and a second set predicate exist in predicates of the target query statement; the first setting predicate is used for limiting the table equivalence relation of the setting reference, and the second setting predicate is used for limiting the single attribute constraint condition of the setting reference; if yes, a third set predicate is constructed according to the first set predicate and the second set predicate; and rewriting the target query statement according to the third set predicate. According to the technical scheme, the execution difficulty of predicate conditions can be reduced, and the optimizing effect of predicate pushing on query can be improved.

Description

Query optimization method, storage medium and computer equipment
Technical Field
The present invention relates to the field of database technologies, and in particular, to a query optimization method, a storage medium, and a computer device.
Background
Predicate downgauging is a commonly applied database query optimization strategy that can apply the screening conditions as early as possible and reduce the amount of data to be processed before the data is obtained from the base table. However, when the predicate condition includes a more complex expression, after the predicate operation is pushed down to the base table, although more selection spaces of connection paths can be generated on the database optimizer, the operation cost of executing the predicate condition is relatively high, and the execution efficiency of the query statement is reduced; when the expression in the predicate condition is simpler, the executable work of the predicate condition on the base table is less, or even the database optimizer can choose not to push down, so that the predicate push down does not exist or the optimizing effect on the query is virtually lost, and the execution efficiency of the query statement is further reduced.
Therefore, there is a need in the art for a solution that balances the difficulty of executing predicate conditions and the optimization effect of promoting predicate pushdown on queries.
Disclosure of Invention
In view of the foregoing, the present invention has been made to provide a query optimization method, a storage medium, and a computer device that overcome or at least partially solve the foregoing problems, and that can reduce the difficulty of executing predicate conditions and improve the optimization effect of predicate pushing on a query.
Specifically, in a first aspect, the present invention provides a query optimization method, including:
acquiring a target query statement and predicates in the target query statement;
judging whether a first set predicate and a second set predicate exist in predicates of the target query statement; the first setting predicate is used for limiting the table equivalence relation of the setting reference, and the second setting predicate is used for limiting the single attribute constraint condition of the setting reference;
if yes, a third set predicate is constructed according to the first set predicate and the second set predicate;
and rewriting the target query statement according to the third set predicate.
Further, the second set predicate and the third set predicate are conditional expressions that use a comparison operator or a string match operator or a member operator.
Further, rewriting the target query statement according to the third set predicate, including:
and determining constraint conditions where the third set predicate should be located according to constraint conditions where the first set predicate and the second set predicate are located.
Further, the determining, according to the constraint conditions of the first set predicate and the second set predicate, the constraint condition where the third set predicate should be located includes:
in the case where both the first set predicate and the second set predicate are in an inter-table connection condition or a screening condition, the third set predicate should also be in the inter-table connection condition or the screening condition.
Further, the determining, according to the constraint conditions of the first set predicate and the second set predicate, the constraint condition where the third set predicate should be located includes:
in the case where one of the first set predicate and the second set predicate is in the inter-table connection condition and the other is in the screening condition, the third set predicate should be in the screening condition.
Further, the inter-table ligation condition is an on condition and the screening condition is a where condition.
Further, rewriting the target query statement according to the third set predicate, including:
in the target query term, at least one of the first set predicate and the second set predicate is logically connected with the third set predicate.
Further, the logical connection is a logical AND connection.
In a second aspect, the present invention also provides a machine-readable storage medium having stored thereon a machine-executable program which when executed by a processor implements the query optimization method of any of the above.
In a third aspect, the present invention also provides a computer device, including a memory, a processor, and a machine executable program stored on the memory and running on the processor, and the processor implements any one of the above query optimization methods when executing the machine executable program.
According to the technical scheme, the third set predicate can be obtained according to the first set predicate and the second set predicate in the target query statement, and the target query statement is rewritten according to the third set predicate. Because the third setting predicate is added in the rewritten target query statement, when the data query is performed according to the rewritten target query statement, under the condition that the constraint condition of the target query statement is pushed to the base table, the third setting predicate can be adopted to filter the tuple in the corresponding data table, so that the execution difficulty of the predicate condition in the target query statement is reduced, the optimizing effect of pushing down the target query data predicate on the query is improved, and the problems of improving the execution efficiency of the target query statement and improving the performance of the database are solved. In the technical scheme of the invention, the second set predicate is a single attribute constraint condition, and the constraint condition is not limited to an equivalent constraint condition, so that the query optimization method also has the advantage of strong applicability, and can overcome the defect of strong limitation of an equivalent transformation rule in the prior art.
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 schematic flow diagram of a query optimization method according to one embodiment of the invention;
FIG. 2 is a schematic flow chart diagram of a query optimization method in accordance with another embodiment of the invention;
FIG. 3 is a schematic diagram of a machine-readable storage medium according to one embodiment of the invention;
FIG. 4 is a schematic diagram of a computer device according to one embodiment of the invention.
Detailed Description
A query optimization method, a storage medium, and a computer device according to an embodiment of the present invention are described below with reference to fig. 1 to 4. In the description of the present embodiment, it should be understood that the terms "first" and "second" are used for descriptive purposes only and are not to be construed as indicating or implying a relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defining "a first" or "a second" may explicitly or implicitly include at least one such feature, i.e. one or more such features. In the description of the present invention, the meaning of "plurality" means at least two, for example, two, three, etc., unless specifically defined otherwise. When a feature "comprises or includes" a feature or some of its coverage, this indicates that other features are not excluded and may further include other features, unless expressly stated otherwise.
In the description of the present embodiment, a description referring to the terms "one embodiment," "some embodiments," "illustrative embodiments," "examples," "specific examples," or "some examples," etc., means that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the present invention. In this specification, schematic representations of the above terms do not necessarily refer to the same embodiments or examples. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
Predicate downhill in the database query optimization process in the prior art is to rewrite query sentences based on equivalence transformation rules. Assuming constraint conditions a=b and b=c, a=c can be deduced from the characteristics of the equivalence transfer, and A, B and C form an equivalence class to implicitly construct a constraint condition of a=c. In generating the physical path from the query statement, an additional connection path needs to be created according to the implicit constraint a=c to provide the optimizer with a possible optimization choice during the query.
Taking an application scenario as an example, assume that a query statement is
Select*from t1,t2 where t1.id=t2.id and t1.id=5.
In the query statement, there are constraint conditions t1.id=t2.id and t1.id=5, that is, the data column id in the data table t1 is equal to the data column id in the data table t2 in value, and the data column id in the data table t1 is 5, from which constraint conditions t1.id=5 can be implicitly constructed, and the implicit constraint condition is a single attribute constraint condition, that is, a constraint condition involving only one data table (that is, the data table t 1). The implicit constraint condition is pushed down to the base table, and the unused tuples in the data table t1 can be filtered out, so that the execution efficiency of the query statement is improved.
However, in the equivalent transformation rule in the prior art, only equivalent constraint relation content is implicitly constructed by the equivalent transfer relation, namely, only predicates with the transfer relation with the symbol of "=" can be extended and rewritten, and the defect of strong limitation exists.
Referring to fig. 1, fig. 1 is a schematic flow chart of a query optimization method in an embodiment of the present invention, where the query optimization method is applied to a database, and is used to expand query sentences under the condition of receiving query sentences of a user, so as to achieve the purpose of improving the performance of the database. The query optimization method of this embodiment is described in detail below with reference to the flow shown in fig. 1.
As shown in fig. 1, the query optimization method of the present embodiment includes the following steps:
step S102: acquiring a target query statement and predicates in the target query statement;
step S104: judging whether the predicates of the target query statement contain a first set predicate and a second set predicate;
if yes, executing step S106;
step S106: constructing a third set predicate according to the first set predicate and the second set predicate in the target query statement;
step S108: and rewriting the target query statement according to the third set predicate.
In this embodiment, the first setting predicate is a predicate for defining an inter-table equivalence relation to be set for reference in the target query data, and in the query statement, a characteristic symbol "=" corresponding to the inter-table equivalence relation to be set for reference is set. For example, with regard to the data table t1 and the data table t2, if the setting reference is that the data columns in the data table t1 and the data table t2 are id, the setting reference corresponding to the data table t1 is "t1.Id", the setting reference relationship corresponding to the data table t2 is "t2.Id", and if the first setting predicate in the target query statement is "t1. Id=t2.id", it means that the values in the id columns defining the data table t1 and the id columns of the data table t2 are equal.
The set reference relates to an equivalence relation among tables, so the set reference needs to relate to a plurality of data tables, and the second set predicate in the embodiment is a predicate used for defining a single attribute constraint condition of the set reference in the target query data, wherein the single attribute constraint condition refers to a constraint condition of the set reference on a single data table, for example, the second set predicate in the target query statement may be "t1.Id <10" or "t2.Id <10".
In the step S106, the third set predicate may be constructed by performing equivalent deduction according to the logical relationship expressed by the first set predicate and the second set predicate in the target query statement, so that the logical relationship expressed by the third set predicate corresponds to the logical relationship expressed by the first set predicate and the second set predicate.
In the above step S108, the third setting predicate may be connected to the target query term to expand the target query term, so as to achieve the purpose of rewriting the target query term, and make the rewritten target query term have the same logic function as the target query term before rewriting.
After the rewritten target query statement is obtained, in the process of carrying out data query according to the target query statement, the third set predicate is pushed down to the base table, invalid data in the data table can be filtered, the data quantity of connection operation between databases is reduced, and the purpose of improving the performance of the databases is achieved.
In summary, the technical solution of this embodiment may obtain the third set predicate according to the first set predicate and the second set predicate in the target query statement, and rewrite the target query statement according to the third set predicate. Because the third setting predicate is added in the rewritten target query statement, when the data query is performed according to the rewritten target query statement, under the condition that the constraint condition of the target query statement is pushed to the base table, the third setting predicate can be adopted to filter the tuple in the corresponding data table, so that the execution difficulty of the predicate condition in the target query statement is reduced, the optimizing effect of pushing the target query data predicate to the query is improved, and the purposes of improving the execution efficiency of the target query statement and improving the performance of the database are achieved. In addition, in the embodiment, the second predicate is set to be a single attribute constraint condition, and the constraint condition is not limited to an equivalent constraint condition, so that the query optimization method of the embodiment also has the advantage of strong applicability, and the defect of strong limitation of an equivalent transformation rule in the prior art can be overcome.
In some embodiments of the invention, the second set predicate and the third set predicate are conditional expressions using either a compare operator, or a string match operator, or a member operator.
In this embodiment, the comparison operators in the target query statement may include but are not limited to "=", "<", ">" and "+. respectively used for representing equal relation, less relation, greater relation and unequal relation; string matching may include, but is not limited to, "LIKE" to represent similarity relationships; the member operators may include, but are NOT limited to, "IN", "NOT IN", respectively, to denote being and NOT being members of a certain dataset.
In this embodiment, the equivalence relation between tables defined by the first set predicate and the single attribute constraint condition defined by the second set predicate may be equivalently deduced, so as to obtain a third set predicate corresponding to the logical relation between the first set predicate and the second set predicate, so as to facilitate expansion of the target query statement.
Through the technical scheme of the embodiment, the target query statement can be expanded under the condition that the second set predicate is a conditional expression using a comparison operator, a character string matching operator or a member operator, so that the query optimization method of the embodiment is not only suitable for a single constraint condition, but also improves the applicability of the query optimization method.
In some embodiments of the present invention, the method for rewriting the target query sentence according to the third setting in the step S108 includes:
and determining constraint conditions where the third set predicate is located according to constraint conditions where the first set predicate and the second set predicate are located in the target query statement.
In the target query statement, the preset conditions for performing data query include an inter-table connection condition and a screening condition, and in this embodiment, the preset condition where the third set predicate should be located may be determined according to the inter-table connection condition or the screening condition of the first set predicate and the second set predicate, so as to ensure consistency of the target query statement after overwriting and the target query statement logic before overwriting.
Because the first set predicate and the second set predicate may be in the same constraint condition or may be in different constraint conditions in the target query statement, a method for determining a preset condition where the third set predicate should be according to the constraint conditions where the first set predicate and the second set predicate are located is described in detail below in combination with a specific application scenario.
In some embodiments of the present invention, a method for determining a constraint condition to be located by a third set predicate according to a constraint condition to be located by each of a first set predicate and a second set predicate in a target query statement includes:
if the first set predicate and the second set predicate in the target query statement are both in the inter-table connection condition, the third set predicate is also in the inter-table connection condition;
if the first set predicate and the second set predicate in the target query statement are both in the screening condition, the third set predicate is also in the screening condition.
For example, the target query statement is
Select*from t1 left join t2 on t1.id=t2.id and t2.id<10.
The target query statement is left-connected to the data table t2, and in the target query statement, the first set predicate is "t1.id=t2.id", the second set predicate is "t2.id <10", and the constraint conditions of the first set predicate and the second set predicate are on conditions, namely, inter-table connection conditions.
The third set predicate determined from the first set predicate and the second set predicate is "t1.Id <10", and since the constraint conditions of the first set predicate and the second set predicate are all inter-table connection conditions, the third set predicate should be also in the inter-table connection conditions, and the rewritten target query statement is
Select*from t1 left join t2 on t1.id=t2.id and t2.id<10and t1.id<10.
For another example, the target query statement is
Select*from t1 left join t2 on true where t1.id=t2.id and t2.id<10.
In the target query statement, the first set predicate is "t1.id=t2.id", the second set predicate is "t2.id <10", and the constraint condition of the first set predicate and the second set predicate is a where condition, i.e. a screening condition.
The third set predicate determined from the first set predicate and the second set predicate is "t1.Id <10", and since constraint conditions of the first set predicate and the second set predicate are both filter conditions, the third set predicate should be also in the filter conditions, and the rewritten target query statement is
Select*from t1 left join t2 on true where t1.id=t2.id and t2.id<10and t1.id<10.
According to the technical scheme, the preset condition under which the third set predicate should be is determined under the condition that the first set predicate and the second set predicate are both in the inter-table connection condition or are both in the screening condition in the target query statement, so that the accuracy of the rewritten target query statement is improved.
In some embodiments of the present invention, a method for determining a constraint condition to be located by a third set predicate according to a constraint condition to be located by each of a first set predicate and a second set predicate in a target query statement includes:
if one of the first set predicate and the second set predicate is in an inter-table connection condition and the other is in a screening condition in the target query statement, the third set predicate should be in the screening condition.
For example, the target query statement is
Select*from t1 left join t2 on t1.id=t2.id where t2.id<10.
In the target query statement, a first set predicate is "t1.id=t2.id", a second set predicate is "t2.id <10", and a constraint condition of the first set predicate is an on condition, namely an inter-table connection condition; the constraint condition of the second set predicate is a where condition, i.e. a screening condition.
The third set predicate determined according to the first set predicate and the second set predicate is "t1.Id <10", and since the preset condition of the first set predicate is a connection condition and the constraint condition of the second set predicate is a screening condition, the third set predicate should also be screened, and the rewritten target query statement is
Select*from t1 left join t2 on t1.id=t2.id where t2.id<10and t1.id<10.
For another example, the target query statement is
Select*from t1 left join t2 on t2.id<10where t1.id=t2.id.
In the target query statement, a first set predicate is "t1. Id=t2.id", a second set predicate is "t2.id <10", and a constraint condition of the first set predicate is a sphere condition, namely a screening condition; and setting constraint conditions of predicates as on conditions, namely inter-table connection conditions.
The third set predicate determined according to the first set predicate and the second set predicate is't 1.Id < 10', and the constraint condition of the first set predicate is a screening condition; the constraint condition of the second set predicate is the inter-table connection condition, so the third set predicate should also be in screening, and the rewritten target query statement is
Select*from t1 left join t2 on t2.id<10where t1.id=t2.id and t1.id<10.
According to the technical scheme, under the condition that the first set predicate and the second set predicate are in different constraint conditions in the target query statement, the preset condition under which the third set predicate should be is determined, so that the accuracy of the rewritten target query statement is improved.
In some embodiments of the invention, the inter-table ligation conditions are on conditions and the screening conditions are where conditions.
In the query statement of the database, the on condition is a constraint condition which is commonly used for representing the connection condition between tables, and the where condition is commonly used for representing the screening condition, so that the constraint conditions of the first set predicate and the second set predicate can be accurately determined through identifying the on condition and the where condition in the target query statement, so that the constraint conditions of the third set predicate where the target query statement should be rewritten according to the third set predicate can be accurately determined.
In some embodiments of the present invention, the rewriting of the target query statement according to the third setting predicate in step S108 includes:
in the target query statement, at least one of the first set predicate and the second set predicate is connected with the third set predicate through preset logic.
In this embodiment, the third set predicate may be set in a corresponding constraint condition according to the constraint condition in which the determined third set predicate is located, and is in preset logic connection with the first set predicate and/or the second set predicate in the corresponding constraint condition.
For example, in the target query statement, if the first set predicate and the second set predicate are both in the inter-table connection condition, the third set predicate is logically connected with the first set predicate and the second set predicate in the inter-table connection condition;
if the first set predicate and the second set predicate are both in the screening condition, performing preset logic connection on the third set predicate, the first set predicate and the second set predicate in the screening condition;
if the first set predicate is in the inter-table connection condition and the second set predicate is in the screening condition, performing preset logic connection on the third set predicate and the second set predicate in the screening condition;
and if the first set predicate is in the screening condition and the second set predicate is in the inter-table connection condition, performing preset logic connection on the third set predicate and the first set predicate in the screening condition.
In some embodiments of the present invention, when the first set predicate and/or the second set predicate are pre-set logically connected with the third set predicate, the pre-set logical connection employed is a logical AND connection.
And the corresponding connecting word of the logical AND connection in the query statement is "and", namely when the target query statement is re-searched, the connecting word "and" is adopted to logically connect the third setting predicate with the first preset predicate and/or the second setting predicate.
In some embodiments of the present invention, the query optimization method of the present invention is shown in fig. 2, and includes the following steps:
step S202: acquiring a target query statement and predicates in the target query statement;
step S204: judging whether the predicates of the target query statement contain a first set predicate and a second set predicate;
if yes, go to step S206;
step S206: constructing a third set predicate according to the first set predicate and the second set predicate in the target query statement;
step S208: determining constraint conditions in which a third set predicate is supposed to be located according to constraint conditions in which the first set predicate and the second set predicate are located in the target query statement;
step S210: and in the constraint condition that the third set predicate is supposed to be, the third set predicate is logically connected with the first set predicate and/or the second set predicate by adopting a logical and connection mode.
In step S204, the first set predicate is a predicate for defining an equivalence relation between tables for setting references in the target query data, and the second set predicate is a predicate for defining a single-attribute constraint condition for setting references in the target query data.
In the above step S206, the third set predicate may be constructed by performing equivalent deduction according to the logical relationship between the first set predicate and the second set predicate expression in the target query statement.
In the step S208, if the first set predicate and the second set predicate in the target query statement are both in the inter-table connection condition, the third set predicate is also in the inter-table connection condition;
if the first set predicate and the second set predicate in the target query statement are both in the screening condition, the third set predicate is also in the screening condition;
if one of the first set predicate and the second set predicate is in an inter-table connection condition and the other is in a screening condition, the third set predicate should be in the screening condition.
According to the technical scheme, the execution difficulty of predicate conditions in the target query statement can be reduced, the optimizing effect of pushing down the target query data predicate on the query is improved, the purpose of improving the execution efficiency of the target query statement and the performance of a database is achieved, the method and the device have the advantage of strong applicability, and the defect of strong limitation of the equivalent transformation rule in the prior art can be overcome.
An embodiment of the invention also provides a machine-readable storage medium and a computer device. FIG. 3 is a schematic diagram of a machine-readable storage medium 830 according to one embodiment of the invention; fig. 4 is a schematic diagram of a computer device 900 according to one embodiment of the invention. The machine-readable storage medium 830 has stored thereon a machine-executable program 840, which when executed by a processor, implements the query optimization method of any of the embodiments described above.
Computer device 900 may include a memory 920, a processor 910, and a machine executable program 840 stored on memory 920 and running on processor 910, and processor 910 implements the query optimization method of any of the embodiments described above when executing machine executable program 840.
It should be noted that the logic and/or steps represented in the flow diagrams or otherwise described herein, e.g., a ordered listing of executable instructions for implementing logical functions, can 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 the embodiment, a machine-readable storage medium 830 can 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. More specific examples (a non-exhaustive list) of the computer-readable medium would include the following: an electrical connection (electronic device) having one or more wires, a portable computer diskette (magnetic device), a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disc read-only memory (CDROM). Additionally, the machine-readable medium may even be paper or other suitable medium upon which the program is printed, as the program may be electronically captured, via, for instance, optical scanning of the paper or other medium, then compiled, interpreted or otherwise processed in a suitable manner if necessary, and then stored in a computer memory.
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 900 may be, for example, a server, a desktop computer, a notebook computer, a tablet computer, or a smartphone. In some examples, computer device 900 may be a cloud computing node. Computer device 900 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 900 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.
Computer device 900 may include a processor 910 adapted to execute stored instructions, a memory 920 providing temporary storage for the operation of the instructions during operation. Processor 910 may be a single core processor, a multi-core processor, a computing cluster, or any number of other configurations. Memory 920 may include Random Access Memory (RAM), read only memory, flash memory, or any other suitable storage system.
Processor 910 may be connected by a system interconnect (e.g., PCI-Express, etc.) to an I/O interface (input/output interface) adapted to connect computer device 900 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 900 or may be a device externally connected to the computing device.
The processor 910 may also be linked by a system interconnect to a display interface suitable for connecting the computer device 900 to a display device. The display device may include a display screen as a built-in component of the computer device 900. The display device may also include a computer monitor, television, projector, or the like, that is externally connected to the computer device 900. Further, a network interface controller (network interface controller, NIC) may be adapted to connect the computer device 900 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.
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 query optimization, comprising:
acquiring a target query statement and predicates in the target query statement;
judging whether a first set predicate and a second set predicate exist in predicates of the target query statement; the first setting predicate is used for limiting the table equivalence relation of the setting reference, and the second setting predicate is used for limiting the single attribute constraint condition of the setting reference;
if yes, a third set predicate is constructed according to the first set predicate and the second set predicate;
and rewriting the target query statement according to the third set predicate.
2. The query optimization method of claim 1, wherein,
the second set predicate and the third set predicate are conditional expressions using a compare operator or a string match operator or a member operator.
3. The query optimization method of claim 1, wherein,
and rewriting the target query statement according to the third set predicate, including:
and determining constraint conditions where the third set predicate should be located according to constraint conditions where the first set predicate and the second set predicate are located.
4. The query optimization method of claim 3, wherein,
the determining, according to the constraint conditions of the first set predicate and the second set predicate, the constraint condition where the third set predicate should be located includes:
in the case where both the first set predicate and the second set predicate are in an inter-table connection condition or a screening condition, the third set predicate should also be in the inter-table connection condition or the screening condition.
5. The query optimization method of claim 3, wherein,
the determining, according to the constraint conditions of the first set predicate and the second set predicate, the constraint condition where the third set predicate should be located includes:
in the case where one of the first set predicate and the second set predicate is in the inter-table connection condition and the other is in the screening condition, the third set predicate should be in the screening condition.
6. The query optimization method according to claim 4 or 5, wherein,
the inter-table ligation conditions are on conditions and the screening conditions are where conditions.
7. The query optimization method of claim 1, wherein,
and rewriting the target query statement according to the third set predicate, including:
in the target query term, at least one of the first set predicate and the second set predicate is logically connected with the third set predicate.
8. The query optimization method of claim 7, wherein,
the logical connection is a logical AND connection.
9. A machine-readable storage medium having stored thereon a machine-executable program which when executed by a processor implements the query optimization method of any one of claims 1 to 8.
10. A computer device comprising a memory, a processor and a machine executable program stored on the memory and running on the processor, and the processor implementing a query optimization method according to any one of claims 1 to 8 when executing the machine executable program.
CN202311845702.5A 2023-12-28 2023-12-28 Query optimization method, storage medium and computer equipment Pending CN117762980A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311845702.5A CN117762980A (en) 2023-12-28 2023-12-28 Query optimization method, storage medium and computer equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311845702.5A CN117762980A (en) 2023-12-28 2023-12-28 Query optimization method, storage medium and computer equipment

Publications (1)

Publication Number Publication Date
CN117762980A true CN117762980A (en) 2024-03-26

Family

ID=90323796

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311845702.5A Pending CN117762980A (en) 2023-12-28 2023-12-28 Query optimization method, storage medium and computer equipment

Country Status (1)

Country Link
CN (1) CN117762980A (en)

Similar Documents

Publication Publication Date Title
US10928970B2 (en) User-interface for developing applications that apply machine learning
US10055509B2 (en) Constructing an in-memory representation of a graph
US8868595B2 (en) Enhanced control to users to populate a cache in a database system
US20090024940A1 (en) Systems And Methods For Generating A Database Query Using A Graphical User Interface
US20170103226A1 (en) Database public interface
CN110795455A (en) Dependency relationship analysis method, electronic device, computer device and readable storage medium
US9734176B2 (en) Index merge ordering
US11416458B2 (en) Efficient indexing for querying arrays in databases
US11036709B2 (en) Single-level, multi-dimension, hash-based table partitioning
US11188594B2 (en) Wildcard searches using numeric string hash
CN110019342B (en) Partition table access method, device and equipment and computer readable storage medium
US20230244665A1 (en) Automatic selection of precompiled or code-generated operator variants
US20180165068A1 (en) Generation and usage of language-converted script
CN116610697A (en) Query method, storage medium and device for database query statement
CN116595044A (en) Optimization method, storage medium and equipment for database selectivity calculation
CN115934760A (en) Database query statement optimization method, storage medium and computer device
CN116204550A (en) Database query statement optimization method, storage medium and device
US9824122B2 (en) Requests for source code text
CN117762980A (en) Query optimization method, storage medium and computer equipment
WO2023086322A1 (en) Late materialization of queried data in database cache
CN117093611B (en) Database combined index suggestion processing method, storage medium and computer device
US10198249B1 (en) Accessing schema-free databases
US9916339B2 (en) Efficient sorting in a relational database
US20240184753A1 (en) Automated database artifact update using design definitions
CN117149821B (en) Query optimization method, storage medium and computer equipment

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