Multiple DISTINCT aggregates
If your query has multiple DISTINCT aggregates, there is no straightforward SQL rewrite that can compute them.
If your query has multiple DISTINCT
aggregates, there is no straightforward SQL rewrite that can compute them. The following query cannot easily be rewritten for improved performance:
SELECT a, COUNT(DISTINCT b), COUNT(DISTINCT c) AS dcnt FROM table1 GROUP BY a;
For a query with multiple DISTINCT
aggregates, there is no projection design that can avoid using GROUPBY HASH
and resegmenting the data. To improve performance of this query, make sure that it has large amounts of memory available. For more information about memory allocation for queries, see Resource manager.