Is it possible to display all the query strings in Magento? I really like to see what queries are executed.
Thanks
Activate the Zend SQL Profiler with the following node in your local.xml
1
Then you can access the profiler somewhere in your code and retrieve a lot of informations about all executed queries:
$profiler = Mage::getSingleton('core/resource')->getConnection('core_write')->getProfiler();
To simply output all queries:
print_r($profiler->getQueryProfiles());
You can add these two lines at the end of index.php to see all queries at the bottom of each page. Be aware that this will break AJAX requests that return a JSON response, so you might consider logging the queries instead of printing them, with this code (again, add it at the end of index.php):
$profiler = Mage::getSingleton('core/resource')->getConnection('core_write')->getProfiler();
Mage::log(print_r($profiler->getQueryProfiles(), true), null, 'queries.log', true);
Then you will find all queries in var/log/queries.log
Don't forget to remove the lines again after you finished debugging!