How can i know the page from where slow query was hitting in MySQL, like
"SELECT * FROM Users WHERE id=123"
Lets say this query was written on page user.php and on many other pages and this query caught in slow log
Now i need to know the exact page on which this was run from error log
Grep your source code for
SELECT * FROM Users WHERE id=
.Change the PHP code to include a comment (
/*...*/
) in eachSELECT
to say where it came from. (If the slowlog strips comments, then add onAND 'page5'='page5'
as a harmless, but useful, bit of info.)