The best method for testing queries is using Tableau Desktop. It has two benefits over Tableau Server — (1) You can very quickly clear out your log files from My Documents\My Tableau Repository\Logs (2) Only your actions are written into the logs with a single VizQL session going. Server logs have multiple processes and you don’t want to go deleting them to single things out.
Note: You should always test with a Live Connection that is embedded into the workbook i.e. don’t use a source that is published to Data Server. This will show you the SQL queries. If you use a Published Data Source, you’ll see an XML ‘theoretical query’ in the Desktop logs and Performance Recording. If you use an extract, you’ll see TQL, the proprietary Extract Engine query language that is not documented anywhere.
One method to see the queries that are sent is to use the Performance Recorder, documented well on the Tableau website. There is also a document on interpreting the performance recording. The only thing I’ll add, is that the Query is often cut off in the viz, so you should do “See Underlying Data” and then copy the results into a text editor or your SQL management tool of choice.
The other method is to look at the Tableau logs. As mentioned earlier, the logs for Desktop live in My Documents\My Tableau Repository\Logs . You want to look for the ones labeled ‘tabprotosrv‘ to see the details of the querying, although sometimes log has the basic query and elapsed time. Since Tableau 8.2 or so, the logs are in JSON format for ease of processing using machine reading tools. I recommend using a tool that cleans up the JSON and makes it easy to read through. The equivalent logs for Tableau Server live in C:\ProgramData\Tableau\Tableau Server\data\tabsvc\logs\vizqlserver\ or the equivalent of that in the zipped up log files (they will be directly under vizqlserver ).
- Close Tableau Desktop
- Delete all the log files in the Logs directory
- Open up Tableau Desktop. Do whatever action gets you to the query where you see slowness.
- Stop doing anything in Tableau, minimize it
- Go to the log file and look for the latest end-query.
You want to look for the keys that say end-query . These show the full query that was sent and the elapsed time. You can take that query and put it into your SQL tools (using EXPLAIN or other tools) to see why in particular it is running slow. You can only affect the query Tableau generates by changing what you show in the viz — and sometimes a slight change can make all the difference. However, most people then go to their DBA(s) and have them work out optimizations — whether that is doing maintenance, adding indexes, or creating views to move more of the logic down into the database.