User Tools

Site Tools


dba:mysql:mysql_basic_queries

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
mysql:mysql_basic_queries [2018/04/17 09:11] dodgerdba:mysql:mysql_basic_queries [2022/02/17 17:54] dodger
Line 48: Line 48:
  
  
 +====== Memory ======
 +===== 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>1
 +ORDER BY count_alloc
 +;
 +</code>
 +
 +===== per user =====
 +<code sql>
 + SELECT IFNULL(user, 'mysqld_background') AS user,
 +        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<>0
 +  ORDER BY current_number_of_bytes_used DESC;
 +</code>
  
  
Line 92: Line 120:
 <code sql>SHOW INDEX FROM tbl_name [FROM db_name] <code sql>SHOW INDEX FROM tbl_name [FROM db_name]
 </code> </code>
 +<code sql>
 +SELECT DISTINCT
 +    TABLE_NAME,
 +    INDEX_NAME
 +FROM INFORMATION_SCHEMA.STATISTICS
 +WHERE TABLE_SCHEMA = 'your_schema';
 +</code>
 +
  
 ===== DDL/Metadata ===== ===== DDL/Metadata =====
dba/mysql/mysql_basic_queries.txt · Last modified: 2022/02/17 17:57 by dodger