3 liens privés
Sur mon système qui n'a pas apparmor, mysqld démarré en ligne de commande, mais pas via systemd.
Systemd a des fonctionnalités pour protéger certains filesystem :
Change variable "ProtectHome" by "false" on "/etc/systemd/system/mysqld.service"
Reload systemd by "sudo systemctl daemon-reload"
Et pour ne pas perdre ses modifs, suivre plutôt ce lien : https://dba.stackexchange.com/questions/185302/mysql-mariadb-cannot-change-default-datadir-on-debian-9-1-server/191174
"According to Debian policy rules, you should set this option value in a custom file like /etc/systemd/system/mariadb.service.d/YOUR_CUSTOM_FILE.conf containing:"
[Service]
# Prevent accessing /home, /root and /run/user
ProtectHome=false
Les variables innodb
mysql / mariadb performance tip
pour afficher les informations qui sont tracées dans le schéma de performance.
select * from setup_consumers;
events_stages_current NO
events_stages_history NO
events_stages_history_long NO
events_statements_current YES
events_statements_history NO
events_statements_history_long NO
events_waits_current NO
events_waits_history NO
events_waits_history_long NO
global_instrumentation YES
thread_instrumentation YES
statements_digest YES
Vider les tables du schéma de performances :
truncate table events_statements_current;
truncate table events_statements_history;
truncate table events_statements_summary_by_digest;
- dans la page, affichage des requêtes pendant 60 secondes :
use performance_schema;
update setup_consumers set enabled='YES' where name IN ('events_statements_history','events_statements_current','statements_digest');
truncate table events_statements_current; truncate table events_statements_history; truncate table events_statements_summary_by_digest;
do sleep(60);
select now(),(count_star/(select sum(count_star) FROM events_statements_summary_by_digest) * 100) as pct, count_star, left(digest_text,150) as stmt, digest from events_statements_summary_by_digest order by 2 desc;
update setup_consumers set enabled='NO' where name IN ('events_statements_history','events_statements_current','statements_digest');
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
build mariadb dans un répertoire spécifique (pour être à coté de mysql) :
cmake -DCMAKE_INSTALL_PREFIX=/home/myapps/mariadb-10.0.8 .
mariadb et mysql côte à côte...
Intéressant : select * from file_summary_by_instance order by count_read desc,count_write desc limit 5
Réservé Mysql 5.6 / MariaDB 10.0
1) USE performance_schema;
2) select * from performance_schema.events_waits_summary_global_by_event_name where count_star>0 order by count_star desc limit 25;