티스토리 뷰
mysql 에서 쿼리별로 실행한 빈도 찾는법
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | select now(), SUBSTRING(VARIABLE_NAME, 5) as query_type, VARIABLE_VALUE as total_count, round(VARIABLE_VALUE / ( select VARIABLE_VALUE from information_schema.GLOBAL_STATUS where VARIABLE_NAME = 'Uptime_since_flush_status'), 2) as per_second, round(VARIABLE_VALUE / ((select VARIABLE_VALUE from information_schema.GLOBAL_STATUS where VARIABLE_NAME = 'Uptime_since_flush_status') / (60))) as per_minute, round(VARIABLE_VALUE / ((select VARIABLE_VALUE from information_schema.GLOBAL_STATUS where VARIABLE_NAME = 'Uptime_since_flush_status') / (60*60))) as per_hour, round(VARIABLE_VALUE / ((select VARIABLE_VALUE from information_schema.GLOBAL_STATUS where VARIABLE_NAME = 'Uptime_since_flush_status') / (60*60*24))) as per_day, FROM_UNIXTIME(round(UNIX_TIMESTAMP(sysdate()) - (select VARIABLE_VALUE from information_schema.GLOBAL_STATUS where VARIABLE_NAME = 'Uptime_since_flush_status'))) report_period_start, sysdate() as report_period_end, TIME_FORMAT(SEC_TO_TIME((select VARIABLE_VALUE from information_schema.GLOBAL_STATUS where VARIABLE_NAME = 'Uptime_since_flush_status')),'%Hh %im') as report_period_duration from information_schema.GLOBAL_STATUS where VARIABLE_NAME in ('Com_select', 'Com_delete', 'Com_update', 'Com_insert'); | cs |
db에 부하가 걸렸을때 알아보는 법이다.
728x90
'개발 > Database' 카테고리의 다른 글
linux에 mongodb 설치 (0) | 2018.02.02 |
---|---|
mysql 5.7 .zip window10에서 다운로드 받고 실행하기 (0) | 2018.01.10 |
foreign key 걸린 테이블 데이터 지우는 법 (0) | 2017.05.20 |
없는 record 지우기 (0) | 2017.04.22 |
sql db table 중복 찾아내기 (0) | 2017.04.21 |
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- 이직
- 도커티슈케이스
- docker container tissue
- 2017 티스토리 결산
- docker container
- 도커컨테이너
- 개발자
- 도커각티슈박스
- 도커티슈박스
- Linux
- docker container tissue box
- vim
- docker container case
- docker container whale
- Sh
- 싱가폴
- shellscript
- 도커각티슈케이스
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
글 보관함