Is there any way to simulate GROUP BY WITH CUBE in MySql?

MySql supports GROUP BY WITH ROLLUP, which will return aggregates for the last x of n columns in a group, but does not support GROUP BY WITH CUBE to accept all combinations of n columns and accept aggregates.

I can simulate this by combining GROUP BY WITH ROLLUP queries, but MySql implements my subquery many times. I use the group in a large subquery, so this is suboptimal. Is there a way to solve this problem without temporary tables?

+6
source share
1 answer

Short answer: No.

Long answer. You can install an open source data warehouse with GROUP BY WITH CUBE support, which uses Mysql as a storage engine, such as Pentaho.

+8
source

Source: https://habr.com/ru/post/895194/


All Articles