-2

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

Pierre-Alexandre Moller
  • 2,354
  • 1
  • 20
  • 29

1 Answers1

0

Grep your source code for SELECT * FROM Users WHERE id=.

Change the PHP code to include a comment (/*...*/) in each SELECT to say where it came from. (If the slowlog strips comments, then add on AND 'page5'='page5' as a harmless, but useful, bit of info.)

tstenner
  • 10,080
  • 10
  • 57
  • 92
Rick James
  • 135,179
  • 13
  • 127
  • 222