首页 > 代码库 > 测试SQL

测试SQL

/*select TAGS,count(TAGS) as EXCEPTION_COUNT,TIMESTAMP        from        EXCEPTION_RESULT e        where e.TASK_ID=‘1467859122980‘ and        date(TIMESTAMP)>=DATE_SUB(CURDATE(), INTERVAL 30 DAY)        group by TAGS,left(TIMESTAMP, 10)        order by TIMESTAMP        DESC;*//*select TAGS,PROCESS_NAME,AVG(PCPU),TIMESTAMP  from process_res          where TASK_ID=‘1470880530333‘ and        date(TIMESTAMP)>=DATE_SUB(CURDATE(), INTERVAL 30 DAY)        group by TAGS,left(TIMESTAMP, 16)        order by TIMESTAMP        DESC;*//*SELECT * FROM process_res WHERE TASK_ID=‘1470880530333‘ and TAGS =‘10.62.44.211‘ and PROCESS_NAME=‘zte_cluster1‘;*//* 数据库连接数统计*/select TAGS,DB_CONN_NUM,count(*),TIMESTAMP  from io_db          where TASK_ID=1470880529732 and        date(TIMESTAMP)>=DATE_SUB(CURDATE(), INTERVAL 30 DAY)        group by TAGS,left(TIMESTAMP, 16)        order by TAGS,TIMESTAMP        ASC;select MIN(DB_CONN_NUM) DB_CONN_NUM_MIN,max(DB_CONN_NUM)        DB_CONN_NUM_MAX,TIMESTAMP from        io_db        where TASK_ID=1470880529732        and        TAGS=10.62.44.209 and        date(TIMESTAMP)>=DATE_SUB(CURDATE(), INTERVAL 30        DAY)        group by left(TIMESTAMP, 16)        order by TIMESTAMP        ASC;/* IO数据统计*/select MAX(TPS) TPS_MAX,MIN(TPS) TPS_MIN,MAX(RTPS) RTPS_MAX,MIN(RTPS) RTPS_MIN,MAX(WTPS) WTPS_MAX,MIN(WTPS) WTPS_MIN,ROUND(AVG(TPS),2) TPS_AVG,count(*),TIMESTAMP  from io_db          where TASK_ID=1470880529732 and TAGS=10.62.44.209 and        date(TIMESTAMP)>=DATE_SUB(CURDATE(), INTERVAL 30 DAY)        group by left(TIMESTAMP, 16)        order by TIMESTAMP        ASC;select ROUND(AVG(TPS),2) TPS_AVG,ROUND(AVG(RTPS),2) RTPS_AVG,ROUND(AVG(WTPS),2) WTPS_AVG,count(*),TIMESTAMP  from io_db          where TASK_ID=1470880529732 and TAGS=10.62.44.209 and        date(TIMESTAMP)>=DATE_SUB(CURDATE(), INTERVAL 30 DAY)        group by left(TIMESTAMP, 16)        order by TIMESTAMP        ASC;select TPS,RTPS,RTPS,TIMESTAMP  from io_db          where TASK_ID=1470880529732 and TAGS=10.62.44.209 and TIMESTAMP LIKE %2016-08-15 14:41%         order by TIMESTAMP ASC;-- select scoreid,chinese,math max_math from -- (-- select * from lkscore order by math desc-- ) T -- group by scoreid;-- select  TPS max_tps,TIMESTAMP,count(*)  from  --  (--     SELECT * FROM io_db  WHERE TASK_ID=‘1470880529732‘ and TAGS=‘10.62.44.209‘  and TIMESTAMP LIKE ‘%2016-08-15 14:40%‘   ORDER BY TPS desc -- ) as t-- GROUP BY left (TIMESTAMP, 16);-- -- -- SELECT * FROM io_db i WHERE i.TPS = -- (SELECT MAX(TPS) from io_db WHERE TASK_ID=‘1470880529732‘ and TAGS=‘10.62.44.209‘ --  and TIMESTAMP LIKE ‘%2016-08-15 14:40%‘ ) order by TPS asc;-- 

 

测试SQL