2 Replies Latest reply on Jan 5, 2018 7:15 AM by Isaac Kunen

    Order of Joins vs Data Source filters?

    Victor Sanabia

      Does Tableau filter out each table individually and then do the joins? Specifically LEFT JOINS.


      If I have Two Tables joining both joining to a third table. And I apply a filter to each one, does it filter each table and THEN do the join or does it filter each table separately then JOIN.


      I tried googling for documentation on this but on found order of operations for filters.


      In SQL the order of processing is FROM (JOIN), WHERE, GROUP BY, HAVING, SELECT, ORDER BY, TOP.

        • 1. Re: Order of Joins vs Data Source filters?
          Mark Bradbourne

          If you look as the SQL that runs via the Performance Recorder, it matches the order you've listed as the SQL order.

          • 2. Re: Order of Joins vs Data Source filters?
            Isaac Kunen

            Hi Victor,


            It might help to understand why you're asking. Logically, the filter happens after the join, as Mark indicated. As you're probably aware, for a left join, this will be semantically different than doing the filter beforehand.


            That said, in the case of an inner join, the order of the join and the filter is generally irrelevant. When that's the case, the query processor may decide to "push" the filter through the join. This is particularly important for federation cases, where pushing the filter may keep Tableau from sucking down a whole lot of data to join locally. This should just be a perf thing: the system shouldn't do this unless the reordering is semantically equivalent to the original query.