The invention relates to the technical field of databases, and provides a method and
system for eliminating left
external connection and right table entries in a
database, and the method comprises the steps: judging whether a
query tree corresponding to a current
SQL statement has a distinct mark or not, and if the
query tree corresponding to the current
SQL statement has the distinct mark, detecting whether the current
SQL statement quotes an unstable expression or not; if the current SQL statement does not quote the unstable expression, traversing an
external connection node
list of the current SQL statement, performing
elimination condition judgment on
external connection nodes in the external connection node
list, and when the external connection nodes meet the
elimination condition, eliminating left external connection right table entries corresponding to the external connection nodes; and after the left external connection right table item corresponding to the external connection node is eliminated each time, traversing the external connection node
list of the current SQL statement again, performing
elimination condition judgment on the external connection node in the external connection node list, and executing elimination of the left external connection right table item according to a judgment result. According to the method, useless right table items of left external connection can be eliminated, and the execution efficiency is improved.