8 Replies Latest reply on Jun 26, 2015 12:12 AM by Manish Vyas

    Connection Stuck in "Loading Metadata"

    Alexander Jaffe

      Hi all,

       

      I've been having a persistent issue with Tableau for the past few days, and I'm completely stumped. Occasionally, when connecting to a data source that uses a custom Oracle SQL query, it will hang on the "Loading Metadata" dialog box indefinitely. I've seen the clock on this go well over 30 minutes, multiple times. This is despite the fact that the query runs almost instantly when run through Oracle SQL Developer.

       

      So far, I've only seen the problem occur when using a union in a subquery. It also only occurs in a pretty large database, having over 50,000 rows returned by the query. This is pretty specific, but I can make the problem occur with a very simple query. Sorry, I can't give testable data, for legal reasons.

       

      SELECT id

      FROM (

        SELECT t1.id, t1.age, t2.height

        FROM t1, t2

        WHERE t1.id = t2.id

        UNION ALL

        SELECT t1.id, t1.age, t2.height

        FROM t1, t2

        WHERE t1.id = t2.id

      )

      GROUP BY id, age, height

       

      Note that the two queries in the union are identical. This itself is not a problem; I've also made this work with differing queries, but this is simpler. What's interesting is that if I change the "UNION ALL" to a simple "UNION", the problem disappears. One might think this is due to the size of the table decreasing, since each row would now appear only once, rather than twice, going into the "GROUP BY". Yet even if I modify the query by adding a fixed distinguishing variable to the two parts of the UNION, the problem still occurs.

       

      SELECT id

      FROM (

        SELECT t1.id, t1.age, t2.height, 0 as test

        FROM t1, t2

        WHERE t1.id = t2.id

        UNION ALL

        SELECT t1.id, t1.age, t2.height, 1 as test

        FROM t1, t2

        WHERE t1.id = t2.id

      )

      GROUP BY id, age, height

       

      Again, it works with UNION, but does not work with UNION ALL. I assume this has something to do with the query plan changing, since the uniqueness of the UNION can give some guarantees on the data going into the group by.

       

      Note that I have seen the problem occur with a straight UNION, in different contexts.

       

      Whatever's happening is completely opaque to me! If anyone has any idea what the cause might be, I'd really appreciate to hear it. Without free use of Unions it's very hard to do a lot of things!

       

      Thanks,

       

      - Alex