流量统计优化sql查询速度
This commit is contained in:
@@ -15,8 +15,12 @@
|
||||
stat_id, proto_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.TrafficProtocolStatistic">
|
||||
SELECT MAX(stat_time) statTime FROM galaxy.traffic_protocol_statistic WHERE proto_type != 0
|
||||
</select>
|
||||
<select id="protocolChart" resultType="java.util.HashMap">
|
||||
SELECT proto_type protoType, 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_protocol_statistic WHERE proto_type != 0
|
||||
AND stat_time = (SELECT MAX(stat_time) FROM galaxy.traffic_protocol_statistic WHERE proto_type != 0) GROUP BY proto_type ORDER BY count DESC LIMIT 0, 10
|
||||
SELECT proto_type protoType, SUM(link_num) count FROM galaxy.traffic_protocol_statistic WHERE proto_type != 0
|
||||
AND stat_time = #{statTime} GROUP BY proto_type ORDER BY count DESC LIMIT 0, 10
|
||||
</select>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user