I have temporarily switched on logging on the server. The site is used in the US and local time there was 4 in the morning so not many people are using it at that time.
What I did was delete any logs (there weren't any):
truncate table mysql.general_log; Activate logging: SET global general_log = 1; SET global log_output = 'table'; Open the page and as soon as it's loaded disable the log again: SET global general_log = 0; Then I wait one or two minutes so the mysql activity of the page are separated. Then switched on log: SET global general_log = 1; Open page Switched off log as soon as the page was loaded SET global general_log = 0;
Opened 7 pages and have 54317 entries in the log both on the server and after I dumped it and imported it locally.
mysqldump --lock-tables=0 -u root -p..... mysql general_log > log.sql
I was wondering if something could have caused repeatedly logging a query that was actually performed only once. It is unlikely though because the following:
SELECT * FROM `general_log` WHERE argument LIKE 'SET global general_log%' ORDER BY event_time ASC LIMIT 0 , 30
Gives me only 8 entries. I know the application was written by someone early in their career and it's using Joomla 1.5 but thousands of queries for one page visit seems a bit much to me.
These are logged by mysql so they are actually requested by the application, I suspect mysql sees the queries are the same so won't actually search or the site would have crashed a long time ago.
Server version: 5.1.73-cll MySQL Community Server (GPLv2)
So the question is:
Could mysql be logging queries multiple times that are actually only made once by the application?