We can troubleshoot and determine if it's a Custom SQL issue by checking:
- Add "Limit 100" at the end of Custom SQL.
- Remove "WHERE" clauses
If one of the information above resolves the issue, we can use the following options.
Option 1: Use materialized view.
A materialized view is a “select query” with "join, where" performed on the database and the end result set is stored as a table in the database. The materialized view can be kept in sync with database updates. Instead of performing multiple joins, Tableau connects directly to the materialized view, allowing the database to perform the bulk of the processing of the initial query. Please see: https://kb.tableau.com/articles/issue/custom-sql-performance-issues
Option 2: Optimize the Custom SQL.
If you still see the issue after applying a filter on Tableau Desktop, you may need to add more filters to reduce the data size.
- Limit the fields/rows selected