It just happened I had profile SQL query in my hanami application. And I want to save this knowledge that’s why I created this post.
If you are using ROM, this post will be helpful for you too, because hanami-module uses ROM. So, in hanami, you have a simple ability for profiling your SQL queries.
For that, you need to use some methods for Sequel::Dataset instance.
Fox example, if you want to get pure sql sting you can use #sql method:
or if you need to call ANALYZE or EXPLAIN psql methods you can use similar methods: