Method for remove SQL inquiry statment constant condition

A query statement and conditional technology, applied in special data processing applications, instruments, electrical digital data processing, etc., can solve the problems of cumbersome data processing, indelibility, and affecting database query speed, so as to avoid query processing and reduce processing overhead Effect

Active Publication Date: 2009-09-02
北京神舟航天软件技术股份有限公司
View PDF3 Cites 0 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0002] In daily applications, databases often need to process large-scale data. Query is an operation frequently used by users. A complex query statement will cause the database system to perform a large amount of tedious data processing. For example, the complexity of the WHERE condition can greatly affect the performance of the database. query speed
[0003] At present, the known database query optimization technologies cannot eliminate complex WHERE constant conditions at the semantic level, which leads to the query executor needing to use the WHERE condition for filtering when scanning each row of the table, thus greatly increasing the data processing overhead

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • Method for remove SQL inquiry statment constant condition
  • Method for remove SQL inquiry statment constant condition
  • Method for remove SQL inquiry statment constant condition

Examples

Experimental program
Comparison scheme
Effect test

Embodiment Construction

[0021] In the OSCAR database, the parser syntax analysis sub-module converts the SQL query statement in the form of a string into a parse tree structure, and then the analyze semantic analysis sub-module converts the parse tree structure into an internally recognized Query query tree structure, different parts of the SQL statement It is converted into each subtree of the query tree, and then the Optimizer query optimization module optimizes the Query structure, generates an execution plan Plan, and submits it to the Executer module for execution to obtain the query result. The present invention is located in the rule-based optimization sub-module in the Optimizer module.

[0022] The inventive method comprises figure 1 Three steps are shown: creating linked list, merging linked list and rewriting query statement.

[0023] The present invention converts both the CHECK constraint and the WHERE condition into a subtree of the query tree at first, and the tree structure of the ex...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

PUM

No PUM Login to view more

Abstract

The invention is a method for removing the constant condition of the SQL query statement, which includes three steps of creating a linked list, merging the linked list and rewriting the query statement. It converts both CHECK constraints and WHERE conditions into subtrees of the query tree. The leaf nodes are expression nodes, and the other nodes are AND or OR nodes. Postorder traversal is performed on these two subtrees, and an expression node is generated when an expression node is encountered. Column attribute linked list, if an AND or OR node is encountered, the column attribute linked list of the subtree of the node will be merged. In the process of merging linked lists, if a constant true or constant false condition is found, the condition node will be rewritten as a TRUE or FALSE constant node. If the root node of the subtree is finally rewritten as TRUE, the WHERE condition can be removed; if the root node is rewritten as FALSE, the SQL query can be directly rewritten as an empty query. Since the present invention effectively eliminates the constant conditions of SQL query statements at the semantic level, it avoids irrelevant query processing and significantly reduces the processing overhead of the database system executor on the constant true and constant false query conditions.

Description

technical field [0001] The invention relates to a method for rewriting an SQL query statement, in particular to a method for removing constant conditions existing in the SQL query statement by using a linked list. Background technique [0002] In daily applications, databases often need to process large-scale data. Query is an operation frequently used by users. A complex query statement will cause the database system to perform a large amount of tedious data processing. For example, the complexity of the WHERE condition can greatly affect the performance of the database. query speed. [0003] At present, the known database query optimization technologies cannot eliminate complex WHERE constant conditions at the semantic level, which leads to the need for query executors to use WHERE conditions for filtering when scanning each row of the table, thereby greatly increasing data processing overhead. If the query optimizer can eliminate some unnecessary WHERE conditions from th...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

Application Information

Patent Timeline
no application Login to view more
Patent Type & Authority Patents(China)
IPC IPC(8): G06F17/30
Inventor 高鹏冯柯张淑锋顾云苏乔典李阳何清法蒋旭孙静元郭毅
Owner 北京神舟航天软件技术股份有限公司
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Try Eureka
PatSnap group products