explain select project_id,indicator ,device_id, sum(value) as value from ( select project_id, device_id, indicator , sum(value) as value, count() as nums, Count(dist
inct device_id) as devNums from ( select project_id, device_id, indicator, num ,concat(substring(day, 1, 7), ‘-01 00:00:00’) as month, sumsValue as value fr
om xxx c where types=‘home’ and project_id=‘154840656’ and indicator in (‘ele_usage’) and ((day >= '2023-09-01 00:00:
limit 300;
explain select /*+ SET_VAR ( enable_query_cache =true ) */ project_id,indicator ,device_id, sum(value) as value from ( select project_id, device_id, indicator , sum(value) as value, count() as nums, Count(distinct device_id) as devNums from ( select project_id, device_id, indicator, num ,concat(substring(day, 1, 7), ‘-01 00:00:00’) as month, sumsValue as value from xxx c where types=‘home’ and project_id=‘154840656’ and indicator in (‘ele_usage’) and ((day >= ‘2023-09-01 00:00:00’ and day <= ‘2023-09-30 23:59:59’)) )a group by project_id, device_id, indicator )b group by project_id,indicator ,device_id order by value desc limit 300
profiles:
profile.txt (136.1 KB)