5.9 Method for processing SELECT DISTINCT
If you specify DISTINCT in the SELECT statement, deduplication is performed by using either of the following processing methods:
-
Hash execution
-
Work table execution
HADB automatically determines which method to use. You can find out which processing method is used by viewing the access path. For details about access paths, see the following sections:
-
How to check access paths
-
Information that is displayed as access paths
See (12) Processing method for duplicate removal in 6.1.4 Information displayed in the tree view.
- Note
-
-
You can prevent the application of hash execution by specifying the SELECT deduplication method specification. For details about the SELECT deduplication method specification, see Specification format and rules for query specifications in the manual HADB SQL Reference.
-
If HADB determines that deduplication processing for SELECT DISTINCT is unnecessary, deduplication processing is not performed.
-
The method for processing SELECT DISTINCT is determined based on the query expressions rewritten by expanding internal derived tables and the search conditions rewritten by equivalent exchange of search conditions. For details about expanding internal derived tables, see 5.13 Expanding internal derived tables. For details about equivalent exchange for search conditions, see 5.11 Equivalent exchange of search conditions.
-
If only literals are specified in a scalar operation, that scalar operation might be treated as a literal. For details about scalar operations equivalent to literals, see the table Conditions under which value expressions are equivalent to literals under Rules in Specification format and rules for value expressions in the manual HADB SQL Reference.
-
- Organization of this section