HOW PROCESSLIST显示哪些线程正在运行
SELECT COUNT(*) from kajia_vehicle_entertimes;
服务站统计
SELECT COUNT(1) from kajia_ss_product_statistic WHERE START_TIME > '2017-12-20 20:00';
SELECT COUNT(1) from kajia_ss_overtime_statistic WHERE START_TIME > '2017-12-20 20:00';
SELECT COUNT(1) from kajia_vehicle_alarm_msg WHERE POS_TIME > '2017-12-20 20:00';
SELECT COUNT(1) from kajia_vehicle_entertimes;
TIME_TO_SEC 是把 时分秒转为 秒,并不会对年月日进行处理
UNIX_TIMESTAMP这个函数返回的是自1970年以来的秒数,所以时间计算用这个是靠谱的
一分钟内收到的数据
SELECT count(*) from kajia_position.device_position_his1712 dph where pos_time >='2017-12-29 20:22:00' and pos_time <='2017-12-29 20:23:00';
前100条最新数据
SELECT pos_time,RECIVED_TIME,send_kafka, CREATE_TIME,insert_time from kajia_position.device_position_his1712 dph order by pos_time desc limit 0,100;
查看数据库1,2的慢查询
select * from information_schema.processlist where state !='' ;