Mysql – Slow query log on production

MySQLperformancequery-performanceslow-log

What are the best practices regarding the slow query log? Should it be active in production environment? If so, what would be a reasonable long query time? I know its different for every application, but on general, what would you set it in a data warehouse application with a mysql database of 15gb? Thank you very much

Best Answer

"I know its different for every application"

15G is not a large data-set unless you tell me it's a single table! Your data can be contained in innodb-buffer-pool and performance should be better.

Importantly, you should make sure your queries are well written and tables are indexed correctly. (log-queries-not-using-indexes)

I'd start with 1 Sec and review the amount of queries getting logged and work on improvements. long-queyr0time is dynamic and you should be able to play with it depending on load it generates.