Data Platform

Developer Experience

Enterprise

7 tips to make your dashboards faster

Want to speed up your data visualizations? Here are seven tried and true tips to improve dashboard performance.

What makes a dashboard slow?

The core causes of slow dashboards can be boiled down to seven common themes:

  1. Poorly constructed SQL queries
  2. Using the wrong database
  3. Failing to pre-filter and pre-aggregate data views
  4. Failing to cache query results
  5. Slow network performance
  6. Using scheduled ETLs instead of event-driven architecture
  7. Using batch processing instead of real-time processing

Fortunately, many of these are relatively easy to fix.

How to improve dashboard performance

Here are seven ways you can make your dashboards faster:

  1. Optimize your SQL queries
  2. Move raw data to a real-time database
  3. Create pre-filtered and pre-aggregated views
  4. Cache query responses
  5. Host your data closer to your users
  6. Use event-driven architectures
  7. Utilize real-time processing engines

Tip #1: Optimize your SQL queries

Bad queries are the top cause of slow dashboards. Simply optimizing reads to process less data can increase dashboard performance by orders of magnitude.

Unoptimized SQL queries are common, but fortunately, they are relatively easy to fix. Here are five generalized rules:

  1. Filter first - Can massively reduce the amount of data your queries must read.
  2. Join second - Performing joins before filtering adds unnecessary load.
  3. Aggregate last - Save aggregating for last after necessary pre-processing.
  4. Pre-filter your joins - Use subqueries to minimize the memory required to perform a join.
  5. Only select the columns you actually need - Be specific about your columns to minimize processed data.

Example of SQL Query Optimization

BAD SQL QUERY
WITH (
  SELECT
    products.product_name,
    products.product_manufacturer,
    toStartOfDay(events.timestamp) AS day,
    sum(events.sales_price) AS total_revenue
  FROM products
  INNER JOIN events on events.product_id = products.id
) AS product_totals
SELECT
  product_name,
  total_revenue
FROM product_totals
WHERE day >= now() - INTERVAL 7 day
AND product_name like '%shoes%'
GOOD SQL QUERY
SELECT
  products.product_name,
  sum(events.sales_price) AS total_revenue
FROM events
INNER JOIN
  (
    SELECT product_name, id
    FROM products
    WHERE product_name like '%shoes%'
  ) AS shoes ON shoes.id = events.product_id
WHERE events.timestamp >= now() - INTERVAL 7 day

Tip #2: Move raw data to a real-time database

Fast dashboards require data storage technologies that are optimized for analytical queries and real-time data ingestion.

If you can't use a cache and you need a fast underlying data layer, copy or move your data to a real-time database like ClickHouse® or a real-time data platform like Tinybird.

Tip #3: Create pre-filtered and pre-aggregated views

Consider creating dedicated tables or views to support your dashboards that only contain the data your dashboard needs. This will limit the amount of data your dashboard requests must read.

Tip #4: Cache query responses

Utilize a cache to store query responses in memory, which will speed up your dashboard if your source data set changes infrequently.

Tip #5: Host data closer to your users

Reduce network latency by hosting your data near your users.

Tip #6: Use event-driven architectural principles

This can improve the freshness of your data, allowing for more responsive dashboards.

Tip #7: Utilize real-time processing engines

The more you process and transform your data in real time, the less work your dashboard will need to do at query time.

Get started making your dashboards faster

By following these seven tips, improve the performance of your dashboards, reduce query latency, and enhance data freshness.