Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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:

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?

share|improve this question
No, MySQL logs only what a client has sent – akuzminsky Jun 8 '14 at 14:09
@akuzminsky Yes, it looks like that's the case. found some loops that will make lots of queries that look for the same thing over and over and this function is called several times from other files. Informed the original developer as I'm not going to touch that code base because I'm putting my efforts in re creating the site. – HMR Jun 9 '14 at 2:35

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.