OS 접근이 불가능할 때 대략적인
OS에서 MySQL 데이터파일 사이즈 계산하기 ...
SET profiling = 1;
SELECT * FROM your_table WHERE some_column = 'some_value';
SHOW PROFILES;
SHOW PROFILE FOR QUERY 1;
SET profiling = 0;
쿼리 프로파일 수집 및 조회 예시:
mysql> set profiling=1;
Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql> select * from a order by a desc limit 20;
+---------+----------------------+------+------+------+------+
| a | b | c | d | e | f |
+---------+----------------------+------+------+------+------+
| 2424796 | aasdwqtniowqtniowqnt | NULL | NULL | NULL | NULL |
| 2424795 | aasdwqtniowqtniowqnt | NULL | NULL | NULL | NULL |
| 2424794 | aasdwqtniowqtniowqnt | NULL | NULL | NULL | NULL |
| 2424793 | aasdwqtniowqtniowqnt | NULL | NULL | NULL | NULL |
| 2424792 | aasdwqtniowqtniowqnt | NULL | NULL | NULL | NULL |
| 2424791 | aasdwqtniowqtniowqnt | NULL | NULL | NULL | NULL |
| 2424790 | aasdwqtniowqtniowqnt | NULL | NULL | NULL | NULL |
| 2424789 | aasdwqtniowqtniowqnt | NULL | NULL | NULL | NULL |
| 2424788 | aasdwqtniowqtniowqnt | NULL | NULL | NULL | NULL |
| 2424787 | aasdwqtniowqtniowqnt | NULL | NULL | NULL | NULL |
| 2424786 | aasdwqtniowqtniowqnt | NULL | NULL | NULL | NULL |
| 2424785 | aasdwqtniowqtniowqnt | NULL | NULL | NULL | NULL |
| 2424784 | aasdwqtniowqtniowqnt | NULL | NULL | NULL | NULL |
| 2424783 | aasdwqtniowqtniowqnt | NULL | NULL | NULL | NULL |
| 2424782 | aasdwqtniowqtniowqnt | NULL | NULL | NULL | NULL |
| 2424781 | aasdwqtniowqtniowqnt | NULL | NULL | NULL | NULL |
| 2424780 | aasdwqtniowqtniowqnt | NULL | NULL | NULL | NULL |
| 2424779 | aasdwqtniowqtniowqnt | NULL | NULL | NULL | NULL |
| 2424778 | aasdwqtniowqtniowqnt | NULL | NULL | NULL | NULL |
| 2424777 | aasdwqtniowqtniowqnt | NULL | NULL | NULL | NULL |
+---------+----------------------+------+------+------+------+
20 rows in set (0.02 sec)
mysql> show profiles;
+----------+------------+------------------------------------------+
| Query_ID | Duration | Query |
+----------+------------+------------------------------------------+
| 1 | 0.01157325 | select * from a order by a desc limit 20 |
+----------+------------+------------------------------------------+
1 row in set, 1 warning (0.00 sec)
mysql> show profile for query 1;
+----------------------+----------+
| Status | Duration |
+----------------------+----------+
| starting | 0.002565 |
| checking permissions | 0.000406 |
| Opening tables | 0.000430 |
| init | 0.000609 |
| System lock | 0.000282 |
| optimizing | 0.000098 |
| statistics | 0.000302 |
| preparing | 0.002321 |
| Sorting result | 0.000119 |
| executing | 0.000033 |
| Sending data | 0.003081 |
| end | 0.000120 |
| query end | 0.000189 |
| closing tables | 0.000128 |
| freeing items | 0.000433 |
| cleaning up | 0.000458 |
+----------------------+----------+
16 rows in set, 1 warning (0.03 sec)