Quick MySQL tip: add comments

MySQL allows comments to be added with the standard /* */ syntax. If your application is getting more complex, it can become more difficult to figure out where certain queries originate from.

By simply adding a comment in front of your query, it will be very easy to spot the origin of some of your queries.

/* recent blogposts */ SELECT id, title, time FROM blogposts ORDER BY time DESC limit 10

The comment will show up as the first thing in SHOW [FULL] PROCESSLIST, MySQL administrator and your log/slow-log files.