Se chegou até aqui é porque viu minha palestra e ela te despertou interesse de alguma forma. Aqui separei algumas queries úteis para avaliar a performance do seu banco caso não disponha de nenhuma ferramenta de monitoramento. Aqui você tem um arquivo SQL com um banco com duas tabelas já indexadas e populadas com 1M de linhas cada.
SELECT
DIGEST_TEXT AS query_text,
COUNT_STAR AS execution_count,
SUM_TIMER_WAIT / 1000000000000 AS total_exec_time_sec,
AVG_TIMER_WAIT / 1000000000000 AS avg_exec_time_sec
FROM
performance_schema.events_statements_summary_by_digest
ORDER BY
execution_count DESC
LIMIT 10;
SELECT
s.TABLE_SCHEMA,
s.TABLE_NAME,
s.INDEX_NAME,
s.SEQ_IN_INDEX,
s.COLUMN_NAME
FROM
information_schema.STATISTICS s
LEFT JOIN
performance_schema.table_io_waits_summary_by_index_usage ps
ON s.TABLE_SCHEMA = ps.OBJECT_SCHEMA
AND s.TABLE_NAME = ps.OBJECT_NAME
AND s.INDEX_NAME = ps.INDEX_NAME
WHERE
ps.INDEX_NAME IS NULL
OR ps.COUNT_READ = 0
AND s.NON_UNIQUE = 1
ORDER BY
s.TABLE_SCHEMA, s.TABLE_NAME, s.INDEX_NAME
LIMIT 10;
SELECT
OBJECT_SCHEMA AS schema_name,
OBJECT_NAME AS table_name,
INDEX_NAME AS index_name,
COUNT_READ AS total_read,
COUNT_WRITE AS total_write,
SUM_TIMER_READ / 1000000000000 AS total_read_time_sec,
SUM_TIMER_WRITE / 1000000000000 AS total_write_time_sec
FROM
performance_schema.table_io_waits_summary_by_index_usage
WHERE
INDEX_NAME IS NOT NULL
ORDER BY
total_read DESC
LIMIT 10;
Desde já muito obrigado 🤗