Change or Set MySQL Long Query Time Value for log-slow-queries
If you enable slow queries log of MySQL database server, you will notice that from the slow query log file contains only SQL statements and queries that took more than query_time of 10 seconds to execute or run. This is the default value or query time threshold for log_slow_queries function, which is 10 seconds. 10 seconds is way too long for a SQL query to complete, so the value may be too high to capture any meaningful data. You can alter or change the slow query time to lower value or number of seconds.
You can set a new long_query_time in the MySQL configuration file, namely my.cnf or my.ini, normally located in /etc directory. Simply add the following line to the configuration file:
long_query_time = 5
Above option will set the slow or long query limit as 5 seconds, which means MySQL will capture and log all SQL queries that took longer than 5 seconds to execute and finish running to the log file.
Share and contribute or get technical support and help at My Digital Life Forums.
Related Articles
- Enable Logging of Slow Queries (Slow Query Log) in MySQL Database
- WordPress MySQL SQL Query Error in WPDB Class
- Change and Reset MySQL root Password
- How to Escape Characters in Oracle PL/SQL Queries
- You Are Not Authorized to Execute SQL Queries in vBulletin Maintenance
- AskEraser to Delete Private Search Queries in Ask.com
- Google Alert Tool to Keep You Notified with the Latest News with Customizable Query
- FreeBSD 6.0 on VMware Server Time and Clock Slow Down
- Slow sFTP Transfer Speed with SSH Connection (SSH2)
- Outlook 2007 Slow While Downloading POP3 Email


























June 20th, 2007 00:43
Stating that “10 seconds is way too long for a SQL query to complete” is slightly irresponsible, as 10 seconds might be perfectly reasonable for some queries to complete given the dataset and hardware being queried against combined with the complexity of the query.
Seeing as how this page is ranking quite high for people having performance issues with MySQL, I feel it is important to set this straight. One should not read this article and assume that their queries are performing unreasonably slow simply because they take over 10 seconds.