How to find the view/page/module that's generating a SQL statement
I suspect your logs are are the output from the MySQL Slow Query Log.  What ends up here varies based on server configuration, but they general culprits are


Queries that take a long time
Queries that don't use indexes


My suggestion is to try to match up the timestamps (start time) to the Apache access_log to get a page.  Then, use the Devel module and enable "Display query log" from admin/config/development/devel.  This will record queries and log them along with execution times.



It looks like that bad query is tied to a view.  For these, enable "Add Views signature to all SQL queries" on the Advanced settings page.  When you do this you can identify which view is slow.

To resolve the "slowness", copy the query and hand edit to add in the parameters.  Then open a MySQL tool, and use the EXPLAIN statement.  Look at what it tells you and go from there.