metabase / metabase/metabase

Lazy load dashboard cards

Open
#71,105 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

.Auto triaged .Team/UXWest Reporting/Dashboards Type:New Feature
Dominant language
Clojure
Stars
49.3k
Forks
6.8k
Avg merge
1d 13h
Merged PRs (30d)
653

Description

**What problem will this feature request solve?**

When a dashboard tab loads, we immediately fire off queries for all the dashboard cards, even those that aren't visible in the viewport:

Image

This puts unnecessary peak load on Metabase and customer databases, since we're loading possibly expensive queries that will never be seen by a human, all at once.

As an entirely unscientific test, we can compare loading either the whole dashboard, or just the first 3 cards.

This is the dashboard loaded as usual (running on my local machine, with a local H2 database):

Image

This is the same dashboard, but only with the first 3 cards to simulate lazy loading:

Image

After 30 refreshes, we can observe generally faster and less variable loading times. I would expect the difference to be greater with a remote Metabase and/or database:

Image

**Describe the solution you'd like.**

Lazy load dashboard cards so that they're only loaded when they are in the viewport, or just outside of it. This should also work correctly with PDF exports.

Some users could argue this is a breaking change, depending on their workflow. Because of this, there should be a dashboard-level option which is disabled for existing dashboards, but enabled for new dashboards.

**How does this feature request impact you?**

It's difficult to gauge how much of a performance improvement this could be. It should make dashboards feel more snappy, and reduce the peak load on Metabase and customer databases. This especially helps customers using expensive databases, who will appreciate the cost saving.

One way to measure the potential impact would be to look at customer dashboard cards where the vertical grid position is at least ~16:

Image

**Additional information**

https://metaboat.slack.com/archives/C05MPF0TM3L/p1773849739368819

Prior art: Grafana [introduced lazy loading in 2019](https://grafana.com/blog/a-closer-look-at-lazy-loading-grafana-dashboards/), with an [option to disable it per dashboard](https://github.com/grafana/grafana/issues/17257).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue identifies dashboard card loading and PDF exports as the relevant entry points, but names no files or tests. Start by tracing how dashboard cards are rendered and how exports request them. Done means cards load only near the viewport, PDF exports remain correct, and the dashboard-level default preserves existing behavior while enabling the feature for new dashboards.

Written by the indexing model from the issue text.

Assessment

Tech stack
clojure
Domain
frontend, performance
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.