流量统计优化sql查询速度
This commit is contained in:
@@ -15,10 +15,13 @@
|
||||
stat_id, app_type, entrance_id, c2s_pkt_num, s2c_pkt_num, c2s_byte_len, s2c_byte_len,
|
||||
stat_time
|
||||
</sql>
|
||||
<!-- 查询最近时间 -->
|
||||
<select id="getMaxStatTime" resultType="com.nis.domain.restful.dashboard.TrafficAppStatistic">
|
||||
SELECT MAX(stat_time) statTime FROM galaxy.traffic_app_statistic WHERE app_type != 0
|
||||
</select>
|
||||
<select id="appChart" resultType="java.util.HashMap">
|
||||
SELECT app_type appType, SUM(link_num) count, (SUM(c2s_pkt_num)+SUM(s2c_pkt_num)) pktNum,(SUM(c2s_byte_len)+SUM(s2c_byte_len)) byteLen
|
||||
FROM galaxy.traffic_app_statistic
|
||||
WHERE app_type !=0 and stat_time = (SELECT MAX(stat_time) FROM galaxy.traffic_app_statistic WHERE app_type != 0)
|
||||
SELECT app_type appType, SUM(link_num) count FROM galaxy.traffic_app_statistic
|
||||
WHERE app_type !=0 and stat_time = #{statTime}
|
||||
GROUP BY app_type order by count desc limit 0,10
|
||||
</select>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user