Tableau Performance Tips #5 : Sort only with element(s) in the view

You want to sort data ? using a field ? Avoid to use a sort field that is not in the view !

A performance issue that is not well known is that Tableau sorts is not done by the datasource but by tableau itself. And this even if you ask a sort based on a field. Tableau will use his own internal sort based on data retrieved for the view if the sort is on a field included in the view. If the field used for the sort is not in the view then Tableau will use a separate query to the datasource to build the order. The main issue is this query for sorting is done sequentially after the query that retrieve the data !

Tableau Performance Bad Practice : use a sort on an element not in the view

On this exemple, let’s take a sort based on a field that is not in the view and see the performance recording dahsboard result :

Performance recording of a Tableau Sort Bad Practice

As I said, the query to retrieve the sort order is done sequentially after the query to retrieve the data themselves. You can also notice that the query for obtain the sort order element are not sorted by the source : they is no ORDER BY clause : Tableau will sort the data with an internal algorithm.

The performance impact will increase when you combine several views having "bad" sorts on one dashboard

The problem of a bad sort is even worse if you have several views with bad sorts on a single dashboard : the data retrieval for sorting elements are run sequentially, one after another, after the main data retrieval who are done in parallel.

You could easily double you time  🙁

Alternative

Sometime it is a forget that come from a too fast development, and the sort metric become de-synchronised from the metric displayed  in the view. In this case, you « just » have to synchronize the sorted metric and the displayed one.

Sort Alternative

But sometime you really want to sort on a element that is not displayed in the view. In this case, you should include your sorted calculated field in the view, as a discrete field in the first place of the row or column panel and hide it (uncheck « show header »)

Conclusion

As we have seen in this article, performance issue can come from sorting elements in your view. Synchronizing sorted and at least one element is mandatory to avoid post-sequential queries.

The question will now be : how can I detect that in my 1000 workbooks repository ? !