You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The columns are ordered from **lowest** to **highest** selectivity. We can
429
-
expect there to be a lower number of product categories, hence a lower number of
430
-
unique records resulting in a lower selectivity. Although `zip_code` may have
431
-
lower or higher selectivity, the dimensions used to filter must come first than
432
-
the dimensions in the `GROUP BY` part of the query.
425
+
`product_category`column comes first as it's a single value filter.
426
+
Then `zip_code` as it's `GROUP BY` column.
427
+
`product_name`comes last as it's a multiple value filter.
428
+
429
+
It might sound counter-intuitive to have `GROUP BY` columns before filter ones, however Cube Store always performs scans on sorted data, and if `GROUP BY` matches index ordering, merge sort-based algorithms are used for querying, which are usually much faster than hash-based group by in case of index ordering doesn't match the query. If in doubt, always use `EXPLAIN` and `EXPLAIN ANALYZE` in Cube Store to figure out the final query plan.
0 commit comments