DEV Community

Jung Kim
Jung Kim

Posted on

Tracking Tableau Server Storage Over Time with PostgreSQL

Tableau's admin views show you storage at a single point in time, but they don't give you a trend line. If you want to know whether your server's footprint is growing, shrinking, or holding steady, you need to snapshot it yourself. Here's the query I run daily to do that.

The SQL

SELECT
    CURRENT_DATE                                        AS snapshot_date,
    ROUND(SUM(CASE WHEN content_type = 'Workbook'
        THEN size ELSE 0 END) / 1000.0^3, 2)           AS workbook_storage_gb,
    ROUND(SUM(CASE WHEN content_type = 'Datasource'
        THEN size ELSE 0 END) / 1000.0^3, 2)           AS datasource_storage_gb,
    ROUND(SUM(size) / 1000.0^3, 2)                     AS total_storage_gb
FROM (
    SELECT
        'Workbook'                                      AS content_type,
        size
    FROM _workbooks

    UNION ALL

    SELECT
        'Datasource'                                    AS content_type,
        size
    FROM (
        SELECT DISTINCT ON (id)                         -- one row per datasource, dropping duplicate connection rows
            size
        FROM _datasources
        ORDER BY id, created_at                         -- deterministic pick when duplicates exist
    ) deduped
) content
Enter fullscreen mode Exit fullscreen mode

The use case

I run this once a day and store the output, turning a single point-in-time snapshot into an actual trend line — workbook storage, datasource storage, and a combined total, all in GB. Over time this becomes the backbone for answering questions like "is our cleanup effort actually reducing our footprint?" or "how fast is storage growing month over month?" — the kind of thing that's easy to ask and impossible to answer from the Tableau UI alone.

Setup is just publishing this as an extract with incremental refresh turned on, scheduled daily. I cover the mechanics of why that combination works so well — and other metrics you can track the same way — in The Easiest Way to Snapshot Tableau's PostgreSQL Repository Over Time.

Pair this with viewership tracking from my last post and you've got both sides of the story — who's using your content, and how much room it's taking up.

Things to know before you use this

  • _datasources overcounts without deduplication. Each data connection on a multi-connection datasource gets its own row, all carrying the same size value. Without handling this, a datasource with three connections gets counted three times. The DISTINCT ON (id) subquery above collapses that back to one row per datasource. Before trusting this in production, run a quick sanity check:
SELECT id, COUNT(*), MIN(size), MAX(size)
FROM public._datasources
GROUP BY id
HAVING COUNT(*) > 1
Enter fullscreen mode Exit fullscreen mode

If MIN(size) equals MAX(size) for every duplicated id, deduplication is safe as written. If they differ, you'll need to decide which value to trust before summing.

  • Tableau Server uses decimal, not binary, storage units. Divide by 1000 (not 1024) at each step to convert bytes → KB → MB → GB and match what the Tableau UI itself reports.

Top comments (0)