System Design · medium

A dashboard is slow to load. Where do you look?

Asked in BI Developer interviews, in the System Design round.

Short answer

Usually the query, not the tool: too fine a grain pulled to the client, a live query where an extract would do, or unfiltered scans. Pre-aggregate in the warehouse to the grain the dashboard actually shows, push filters down, and cache or extract where freshness allows. Row-level detail behind a summary should load on demand, not upfront.

How to answer it

Isolate the layer first

A dashboard is three things stacked, and the fix is completely different in each. Establish which one before touching anything.

1. The query      run it directly against the warehouse. If it takes
                  40 seconds there, the dashboard is not the problem

2. The transport  a fast query and a slow dashboard means volume: the tool
                  is pulling a million rows to render a chart of twelve

3. The rendering  many charts, each firing its own query, or a browser
                  struggling with an enormous table widget

Timing the query alone takes a minute and tells you which of the three you are in. Skipping that step is how people spend a day optimizing the wrong layer.

Common causes by layer

The usual fixes

Key points

FAQ

The 30-second answer

I would separate the three layers before changing anything: run the query directly against the warehouse and time it. If it is slow there, the dashboard is not the problem. If it is fast there but the page is slow, I am looking at how much data is being shipped, or at rendering.
On the query side the usual causes are a missing partition filter causing a full scan, views stacked on views, or a join fanning out. On the transport side it is almost always returning raw rows when the chart needs aggregates. On rendering it is twenty widgets each firing their own query.
The fixes I would reach for are pre-aggregating into a purpose-built table, pushing the group-by down so the tool receives twelve rows rather than a million, and setting a sensible default date filter, because defaulting to all time is the most common self-inflicted version of this.

In the interview

Practice this for real