How do I print the SQL query of a view in front end?
You can enable on "Show the SQL query" and "Show other queries run during render during live preview" on "www.example.com/admin/structure/views/settings"



Hope it will help you.