690 shaares
3 liens privés
3 liens privés
Un ensemble de requêtes pour utiliser le schéma de perf :
http://www.markleith.co.uk/ps_helper/#statements_with_runtimes_in_95th_percentile
http://www.markleith.co.uk/ps_helper/#statements_with_full_table_scans
Pour les requêtes :
SELECT * FROM performance_schema.events_statements_summary_by_digest;
Top par SUM :
SELECT schema_name, digest, digest_text, count_star, round(AVG_TIMER_WAIT/1000000000), sum_errors, sum_warnings, sum_rows_affected, sum_rows_sent, sum_rows_examined FROM `events_statements_summary_by_digest` ORDER BY `events_statements_summary_by_digest`.`SUM_TIMER_WAIT` DESC
Top par SUM avec Full Scan :
SELECT DIGEST_TEXT AS query,
IF(SUM_NO_GOOD_INDEX_USED > 0 OR SUM_NO_INDEX_USED > 0, '*', '') AS full_scan,
COUNT_STAR AS exec_count,
SUM_ERRORS AS err_count,
SUM_WARNINGS AS warn_count,
ROUND(SEC_TO_TIME(SUM_TIMER_WAIT/1000000000000)) AS exec_time_total_second,
ROUND(SEC_TO_TIME(MAX_TIMER_WAIT/1000000000000)) AS exec_time_max_second,
ROUND((AVG_TIMER_WAIT/1000000000)) AS exec_time_avg_ms,
SUM_ROWS_SENT AS rows_sent,
ROUND(SUM_ROWS_SENT / COUNT_STAR) AS rows_sent_avg,
SUM_ROWS_EXAMINED AS rows_scanned,
DIGEST AS digest
FROM performance_schema.events_statements_summary_by_digest ORDER BY SUM_TIMER_WAIT DESC LIMIT 15