on 2011 Jun 16 3:25 PM
In general, will you see faster performance selecting distinct or selecting and then grouping by each column to achieve the same results?
Probably depends on the data I know, but just looking for general pointers and factors to consider one way or the other.
Request clarification before answering.
I would not rewrite SELECT DISTINCT as a grouped query, for two main reasons.
In releases of SQL Anywhere older than Version 8, distinct and grouped queries had precisely the same implementation and their execution characteristics were identical. Starting with Version 8, the server constructs different DFO operators for the operations, however much of the underlying implementation remains the same (using shared code) and hence I would be surprised if there were substantial performance differences between the two.
The reasons I would refrain from rewriting SELECT DISTINCT as a grouped query are:
The latter item can be substantially important with respect to how complex queries are simplified by the query optimizer, and for that reason I would retain the syntax of the intended semantics (of SELECT DISTINCT) rather than try to do anything fancier.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
52 | |
10 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.