ClickhouseBuilder
ClickhouseBuilder copied to clipboard
Optimize count calculation
Optimize the group by count calculation
Prevents groupby
from returning too many numbers, and optimizes the number directly to the database
Before optimization, you need to calculate the quantity
SELECT count() as `count` FROM `test` WHERE `id` != 12 GROUP BY `goods_id`
After optimization, directly return the quantity
SELECT count() as `count` FROM (SELECT `goods_id` FROM `test` WHERE `id` != 12 GROUP BY `goods_id`)