Posted under » Drupal on 02 May 2022
Views are great at filtering and showing stuff. It is basically drupal asking SQL to do stuff without you having to do SQL.
Navigate to admin/structure/views/settings/ In Drupal 10 the settings are in the List / Settings tabs.
Then you will be shown the Basic / Advanced tab. Choose the Basic tab
Under Live Preview Settings. Choose the 'Show the SQL query' option.
You can choose to show the SQL query above the preview or below it.
Under advanced mode, there is an option where all Views-generated queries will include the name of the views and display 'view-name:display-name' as a string at the end of the SELECT clause. This makes identifying Views queries in database server logs simpler, but should only be used when troubleshooting.