To find the query you should enable _PS_DEBUG_PROFILING_ in /config/defines.in.php
It will generate below the page that you are looking at a long list of queries that have been run. With a text search in the browser it should be easy to find your query. At the end of each line (you likely will need to scroll to the right) you find the filenames and line numbers.