| CPC G06F 16/24553 (2019.01) [G06F 40/211 (2020.01)] | 18 Claims |

|
1. A method, comprising:
obtaining a query statement input by a user, wherein the query statement queries data from a database;
generating, based on the query statement, an execution plan corresponding to the query statement;
determining, based on the execution plan, each query operation involved in the execution plan and an execution order of query operations;
determining a target operation from the query operations based on the execution order of the query operations, wherein the target operation is an operation other than a last query operation to be executed among the query operations; and
when executing the execution plan, performing deduplication on duplicate results comprised in query results obtained by executing the target operation to obtain deduplicated query results, and obtaining, based on the deduplicated query results, query data corresponding to the query statement, wherein:
before the performing deduplication on duplicate results comprised in query results obtained by executing the target operation to obtain deduplicated query results when executing the execution plan, the method further comprises:
determining, based on a position of an operation instruction corresponding to the target operation in the execution plan, a position for inserting a deduplication operation in the execution plan as a target position; and
inserting a deduplication operation instruction into the execution plan based on the target position to generate an optimized execution plan; and
the performing deduplication on duplicate results comprised in query results obtained by executing the target operation to obtain deduplicated query results when executing the execution plan comprises:
when executing the optimized execution plan, performing, based on the deduplication operation instruction, deduplication on the duplicate results comprised in the query results obtained by executing the target operation to obtain the deduplicated query results.
|