Follow below steps:
select Help → Settings and Performance → Start Performance Recordingfrom the Tableau toolbar.
Then right click on the source in the Data toolbar and select ‘Refresh’. This will force Tableau to re-run the query.
Once the query completes, select Help → Settings and Performance → Stop Performance Recording from the Tableau toolbar.
This should result in a new Tableau window opening with a workbook called ‘Tableau — PerformanceRecording’
Right-click anywhere in the bar next to ‘Executing Query’ and select ‘View data’
Source of the article:
Below URL gives a very good idea about this
https://blog.openbridge.com/7-steps-to-export-sql-statements-from-tableau-7e51a2fd4277