You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# ODER
# Alternative: Step 1a
mysql>SET GLOBAL slow_query_log = 1
mysql>SET slow_query_log = 1
# Step 2:
# Zeit festlegen, ab wann eine query langsam ist
# global für den Server (greift erst bei der nächsten Session)
mysql>SET GLOBAL long_query_time = 0.000001;
# und für die aktuelle Session
mysql>SET long_query_time = 0.000001
# Step 3
# run some time / data
# and look into your slow-query-log
/var/lib/mysql/hostname-slow.log
# Step 2: restart server
systemctl restart mariadb
mysql
-- Step 3: set long_query_time (global and in session)
select @@slow_query_log;
-- set and show global
set global long_query_time = 0.000001;
select @@global.long_query_time;
show global variables like '%long%';
-- (Optional) set and show session (for this session)
set long_query_time = 0.000001;
select @@long_query_time;
show variables like '%long%';
# Step 4: Import data
cd /usr/src/sakila-db
mysql < sakila-schema.sql
mysql < sakila-data.sql
# Step 5: what did we log
cd /var/lib/mysql
ls -la server1-slow.log
less server1-slow.log
Show queries that do not use indexes
SET GLOBAL log_queries_not_using_indexes=ON;
Geschwätzigkeit (Verbosity) erhöhen
SET GLOBAL log_slow_verbosity='query_plan,explain'