2 Replies Latest reply on Jun 15, 2018 3:42 AM by Yuriy Fal

    Initial SQL stops working on Tableau server

    Dizzy Techie



      I'm using  Tableau server with Oracle. I've written a simple insert query in the db connection initial SQL section - to insert the name of the tableau server user and timestamp into a table. Yes initial SQL is enabled in tableau server settings.


      The insert works for all users who navigate to the tableau dashboard for the first time. If a user visits the dashboard again a little later, the initial SQL doesn't execute again and another row of data isn't inserted for the same user again.


      Apart from this - the dashboard refreshes correctly, updated data is shown in all the visualisations (so it doesn't seem to be a problem with cache). Also cache setting is - Refresh more often: query database on each page load.


      I am at my wits end why initial SQL won't execute every time a dashboard is accessed. I even tried replacing the SQL insert statement in the Intel SQL with a stored procedure call to insert the tableau username and timestamp with the same result - it executes for each different user just once, but not subsequently.


      However data is inserted absolutely fine from tableau desktop, though not from tableau server.

        • 1. Re: Initial SQL stops working on Tableau server
          Santiago Sanchez

          Hi Dizzy,


          Initial SQL is executed only when opening a connection to the Data Source. In Tableau Server, connections are kept open for a period of time as to not impact performance for the end user (opening a new connection can be expensive in both time & resources). This period of time is different from the cache's retention period. My guess is if you try on Tableau Server after a long time (not sure how long are connections kept open on Oracle), you'll see a new row of data written.


          Curious to hear from others in the community as to how they've approached this.


          Hope this helps!


          • 2. Re: Initial SQL stops working on Tableau server
            Yuriy Fal

            Hi Dizzy,


            My understanding is the Initial SQL to be requested just ones --

            in the beginning of a user session.


            The session would end up on logout,

            or it is terminated after some period of user inactivity.


            The default value for the latter is 30 minutes, and it is defined by the


            system configuration option of Tableau Server instance:


            tabadmin configuration options


            Please tell your TS SysAdmin to lower the value

            and see if it would make any difference.