2 Replies Latest reply on May 28, 2015 12:38 PM by Matt Coles

    Is it possible to obtain view cache information from the PostgreSQL repository?

    Matt Coles

      In the PostgreSQL repository database "workgroup", in the "views" table, there is a field called "for_cache_updated_at", which is a timestamp type.


      This field is not described on the Data Dictionary for the database, but within the SQL definition for the field, there is a suppressed comment:


      -- Column: for_cache_updated_at


      -- ALTER TABLE views DROP COLUMN for_cache_updated_at;


      ALTER TABLE views ADD COLUMN for_cache_updated_at timestamp without time zone;

      ALTER TABLE views ALTER COLUMN for_cache_updated_at SET DEFAULT '2000-01-01 00:00:00'::timestamp without time zone;

      COMMENT ON COLUMN views.for_cache_updated_at IS 'SUPPRESS_DOC_OUTPUT: The last time at which something changed that should invalidate an existing cache of relevant view data.';


      So the questions here are:

      1. Is this field being actively updated and used by Tableau Server?

      2. If the answer to (1) is "yes", then am I correct in understanding that it means "the view cache is no older than this date"?

      3. Is there any other place view (and/or query) cache data is stored in the Repository?

      Thanks for the help!

      Anton Grobman

        • 1. Re: Is it possible to obtain view cache information from the PostgreSQL repository?
          Dan Scott

          The for_cache_updated_at field of the views table is, indeed, actively used, and updated.  When a request for a viz is made by some user, information about the view, and its associated workbook, and relevant permissions are cached.  If the same user makes a later request for that viz, then Tableau Server will attempt to use the cached information, instead of executing another "largish" SQL query against the Repository.  It verifies that it can legitimately use the cached data by comparing the current value of for_cache_updated_at, with the version stored in the existing cached information, and if they are the same, then it is okay to use the cached information---otherwise it re-queries the Repository for all the required information and uses that (and updates the cache information).


          Updating of the for_cache_updated_at field of views happens automatically in the Repository (as a result of both rules and triggers) when a change is made to to the view record, or to the workbook record that it belongs to, or to any of the records in next_gen_permissions that affect the permissions relevant to the view.


          The actual cached information is stored in a combination of on-disk file and in-RAM caching mechanism.  The Repository holds the ultimate source of that information, but I wouldn't say that the cache exists in the Repository, if you see the distinction.


          The reason that the field was left out of the data dictionary is simply because it was judged to be one of those implementation details that would only be confusing, since this is not a field that anyone would ever set themselves.

          • 2. Re: Is it possible to obtain view cache information from the PostgreSQL repository?
            Matt Coles

            Thanks for confirming Dan! Very helpful answer.