I have a LAMP stack(mysql and php) wordpress site and I want to know the number of database connections opened when a page loads. I can find other numbers but I can't figure out the number for a specific page.

1 Answer 1


One would hope that the answer is "1".

I don't think there is a way to get that answer easily...

Turn on the "general log". Make sure that that page is loaded (and moved away from) at least once. Turn off the general log.

Now look at the log. Part of the info is a "connection number". Try to decipher which queries apply to your page load and which came from others. You may need help from the Apache log to see which pages were loaded, when. If the general log is too 'busy', try again again.

You may be surprised (even appalled) at list of queries that show up. It might be more than just "number of connections" that is 'inefficient'. Start a new Question with the list; let's poke at it to see what could be improved. (And tag it with [wordpress], too.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.