Wednesday, September 14, 2016

database running slow

Very often we get concern that database is running slow. Below are the checks what we can perform:

1> Ask the developer/tester/Designer - What particularly is running slow? or whole system as such slow?
2> Logon to database. And check following:
   - slow_query_log (Edit long_query_time/log_queries_not_using_indexes accordingly.)
   - select * from information_schema.processlist;
   - select * from information_schema.innodb_trx;
   - select * from information_schema.innodb_lock_waits; //To check for any transaction locks
3> Execute show engine innodb status\G
   - Check for log movement
   - Transaction timeout.
4> Check how much memory been taken by MySQL process as such. 'free -m' / 'top'
5> Check for disk utilization 'df -h'
6> Check for error.log
7> Check for NW latency (from app server or replicated server).
8> Check for SELECT statement is taking time, or some DML command or particularly 'COMMIT' / 'ROLLBACK' is taking time.
   - What is the cause for this? And its solution?
   Ans> If 1000s of transactions are coming and trying to Commit;
   Use: innodb_flush_log_at_trx=2
9> Check for nagios/cacti/AWS graphs. Any spike in the system. Inbound/Outbound traffic.     
10> If any query provided - Explain plan of that query.

No comments:

Post a Comment