【StarRocks版本】例如:2.3
EXPLAIN logical
SELECT device_id
FROM a
WHERE app_id IN ('com.adidas.app')
AND country IN ('IND')
AND platform = 1
AND create_date >= '20221230'
AND create_date <= '20230330'
GROUP BY device_id
LIMIT 10000000;
这个SQL实际结果大概是130w左右,但是用explain logical查看执行计划,只有估计5000行,这个差距非常大,是我理解错了吗
+---------------------------------------------------------------------------------------------------------------------------------------------+
| Explain String |
+---------------------------------------------------------------------------------------------------------------------------------------------+
| - Output => [2:device_id] |
| - LIMIT [10000000] |
| - EXCHANGE(GATHER) |
| Estimates: {row: 5352, cpu: 192701.79, memory: 0.00, network: 192701.79, cost: 1484034.30} |
| - AGGREGATE(GLOBAL) [2:device_id] |
| Estimates: {row: 5352, cpu: 327823.57, memory: 192701.79, network: 0.00, cost: 1098630.72} |
| limit: 10000000 |
| - EXCHANGE(SHUFFLE) [2] |
| Estimates: {row: 5352, cpu: 192701.79, memory: 0.00, network: 192701.79, cost: 549315.36} |
| - SCAN [adt_rtb_device_dynamic_profile] => [2:device_id] |
| Estimates: {row: 5352, cpu: 327823.57, memory: 0.00, network: 0.00, cost: 163911.78} |
| partitionRatio: 91/185, tabletRatio: 1456/1456 |
| predicate: 3:app_id = 'com.adidas.app' AND 5:country = 'IND' AND 6:platform = 1 AND 1:create_date <= 2023-03-30 |
+---------------------------------------------------------------------------------------------------------------------------------------------+