Skip to content
All work

B2B SaaS, 2024

Relay

A reporting rebuild that took an analytics product's slowest dashboard from 14 seconds to under one.

Sector
B2B SaaS
Year
2024
Duration
3 months
Team
2 engineers

Architecture, 6 components

DashboardsQuery APICacheRollupsPostgresEvents
  • Client
  • Service
  • Queue or log
  • Data store
  • External system

The problem

Customer dashboards ran aggregate queries across hundreds of millions of rows on every page load. Large accounts timed out, and support tickets about slow reports were the product's top churn signal.

What we built

  1. 01Profiled the twenty slowest queries against a production-sized copy of the data.
  2. 02Introduced incremental rollup tables maintained by a background worker.
  3. 03Added covering indexes that matched the real filter and sort order of each report.
  4. 04Cached hot report fragments with explicit, event-driven invalidation.

What changed.

p95 dashboard load, from 14 s
0.8 s
database CPU at peak
−48%
report timeouts in the last two quarters
0

Stack

  • Node.js
  • PostgreSQL
  • Prisma
  • Redis

Have a system that needs to carry more?

Tell us what you are building and where it strains. We will reply with how we would approach it.