2

Magento 2.3.4 version using. Can we print SQL query when product search from admin product grid? i can print sql query in our custom or product collection in frontend using $collection->getSelect()->__toString();

but I want to print the SQL query in the admin product grid.

0

You can use magento cli command: bin/magento dev:query-log:enable

This will enable logging for all sql queries. It's not a perfect solution, but you will be possible to find needed sql.

Magento docs: https://devdocs.magento.com/guides/v2.4/config-guide/cli/logging.html#to-enable-database-logging

| improve this answer | |
  • it is not print SQL query,it just show json fields and their values – sumeet bajaj Oct 20 at 14:42
  • No, please check var/debug/db.log in your project. There you can see all sql queries which were executed after db query logging enabling. – Vladyslav Sikailo Oct 21 at 8:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.