Details
-
Improvement
-
Status: Open
-
Major
-
Resolution: Unresolved
-
None
-
None
-
None
-
ghx-label-9
Description
Computing incremental stats on partitions generates bad sql for instance:
For a table foo partitioned by column bar, the compute stats statement:
compute incremental stats foo partition (bar = 1);
would generate the following query:
SELECT COUNT(*), month FROM foo WHERE (bar=1) GROUP BY bar;
If this were to be rewritten as follows, it would produce fewer fragments and hence also reduce query memory by avoiding a hash aggregation node.
SELECT COUNT(*), 1 FROM foo WHERE bar=1;