dba:mysql:mysql_basic_queries
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
mysql:mysql_basic_queries [2018/04/17 09:11] – dodger | dba:mysql:mysql_basic_queries [2022/02/17 17:57] (current) – [per user] dodger | ||
---|---|---|---|
Line 48: | Line 48: | ||
+ | ====== Memory ====== | ||
+ | ===== Global summary ===== | ||
+ | |||
+ | <code sql> | ||
+ | | ||
+ | sys.format_bytes(current_number_of_bytes_used) curr_alloc, | ||
+ | count_alloc, | ||
+ | sys.format_bytes(sum_number_of_bytes_alloc) total_alloc, | ||
+ | count_free, | ||
+ | sys.format_bytes(sum_number_of_bytes_free) total_free | ||
+ | FROM performance_schema.memory_summary_global_by_event_name; | ||
+ | </ | ||
+ | |||
+ | |||
+ | ===== memory by event ===== | ||
+ | |||
+ | <code sql> | ||
+ | SELECT EVENT_NAME, | ||
+ | COUNT_ALLOC, | ||
+ | COUNT_FREE, | ||
+ | SUM_NUMBER_OF_BYTES_ALLOC, | ||
+ | SUM_NUMBER_OF_BYTES_FREE | ||
+ | FROM performance_schema.memory_summary_global_by_event_name | ||
+ | where count_alloc> | ||
+ | ORDER BY count_alloc | ||
+ | ; | ||
+ | </ | ||
+ | |||
+ | ===== per user ===== | ||
+ | <code sql> | ||
+ | | ||
+ | current_count_used AS curr_count, | ||
+ | sys.format_bytes(current_number_of_bytes_used) curr_alloc, | ||
+ | count_alloc, | ||
+ | sys.format_bytes(sum_number_of_bytes_alloc) total_alloc, | ||
+ | count_free, | ||
+ | sys.format_bytes(sum_number_of_bytes_free) total_free | ||
+ | FROM performance_schema.memory_summary_by_user_by_event_name | ||
+ | where current_number_of_bytes_used> | ||
+ | ORDER BY current_number_of_bytes_used DESC; | ||
+ | </ | ||
Line 92: | Line 133: | ||
<code sql>SHOW INDEX FROM tbl_name [FROM db_name] | <code sql>SHOW INDEX FROM tbl_name [FROM db_name] | ||
</ | </ | ||
+ | <code sql> | ||
+ | SELECT DISTINCT | ||
+ | TABLE_NAME, | ||
+ | INDEX_NAME | ||
+ | FROM INFORMATION_SCHEMA.STATISTICS | ||
+ | WHERE TABLE_SCHEMA = ' | ||
+ | </ | ||
+ | |||
===== DDL/ | ===== DDL/ |
dba/mysql/mysql_basic_queries.txt · Last modified: 2022/02/17 17:57 by dodger