請問一下impala查詢該如何優化,查詢速度有點慢(5s以上)
impala查詢陳述句:
select case when t.nl>=18 and t.nl<=25 then '18-25歲'
when t.nl>=26 and t.nl<=32 then '26-32歲'
when t.nl>=33 and t.nl<=40 then '33-40歲'
when t.nl>=41 and t.nl<=48 then '41-49歲'
when t.nl>=49 and t.nl<=55 then '49-55歲'
end as nld,count(1) jls
from
(select
case when length(sfzh)=18 then
cast(from_unixtime(unix_timestamp(xxrq,'yyyy-MM-dd'),'yyyy') as int)-cast(substr(sfzh,7,4) as int)
else cast(from_unixtime(unix_timestamp(xxrq,'yyyy-MM-dd'),'yyyy') as int)-cast(concat('19',substr(sfzh,7,2)) as int)
end as nl,xxrq,sfzh from hbase_impala.impala_table39119_1550771711308
where sfzh is not null and year(now())-year(xxrq) <=4
) t
where t.nl>=18 and t.nl<=55 group by nld order by nld;
explain結果
:uj5u.com熱心網友回復:
已經進行了表分析還這么慢,sql問題轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/46761.html
標籤:MySQL
上一篇:PB8.0升級到12.5
下一篇:求助 GP6.0沒有備份的命令
