
CEO & Co-founder of Visivo
Building Lightning-Fast Analytics Dashboards with Visivo
Learn how to optimize Visivo dashboards for maximum performance using efficient data models, smart visualization choices, and proven configuration patterns.

A dashboard that takes seconds to load gets opened less, and a dashboard nobody opens does not inform a decision. MIT research reports that "Companies using data-driven strategies have 5-6% higher productivity," but that advantage depends on people using the data, and slow dashboards get in the way.
Visivo defines dashboards as code, so performance is something you can tune, test, and review before a dashboard ships. This post covers the patterns that keep a Visivo dashboard fast: aggregate in the model, pick chart types that match the data volume, order the layout so the important rows load first, and test payload sizes before you deploy.
Why dashboard performance matters
Teams expect analytics to respond like the rest of their applications. As Gartner notes, "Only 20% of analytics insights will deliver business outcomes through 2022," and a slow dashboard is one reason an insight never turns into an action.
Slow dashboards cause problems that feed each other:
- Avoidance: teams stop opening dashboards that make them wait
- Lower adoption: users lose confidence in the analytics
- Broken focus: waiting for charts to load interrupts the work
- Frustrated stakeholders: executives abandon data reviews
Because a Visivo project is YAML with a local development server, you can tune every part of a dashboard's performance before you deploy it.
What Visivo gives you by default
Two parts of the architecture do performance work before you tune anything:
Local development with hot reload
# Start development server for instant feedback
visivo serve
# Dashboard available at http://localhost:8000
visivo serve builds the project, watches the project files, and hot-reloads on changes, so you see the effect of an optimization as soon as you save it. A slow query shows up on your machine, not in production. It is the same faster feedback cycles argument that applies to the rest of the code-first workflow.
Separate data from rendering
Visivo separates data transformation from visualization rendering. A SQL model defines the data once, and any number of Insights and charts build on it:
name: Performance Demo
models:
- name: optimized_sales
sql: |
SELECT
DATE_TRUNC('month', order_date) as month,
product_category,
SUM(amount) as revenue,
COUNT(*) as order_count,
COUNT(DISTINCT customer_id) as unique_customers
FROM orders
WHERE status = 'completed'
AND order_date >= CURRENT_DATE - INTERVAL '2 years'
GROUP BY 1, 2
ORDER BY 1, 2
One model can power several Insights. Each Insight compiles to one query against the model when the project runs, and the result is stored, so opening the dashboard reads the stored data instead of querying your database again:
name: Performance Insights
models:
- name: optimized_sales
sql: SELECT month, revenue, product_category FROM sales
insights:
- name: revenue_trend
props:
type: scatter
mode: lines
x: ?{ ${ref(optimized_sales).month} }
y: ?{ ${ref(optimized_sales).revenue} }
- name: category_breakdown
props:
type: scatter
mode: lines
x: ?{ ${ref(optimized_sales).month} }
y: ?{ ${ref(optimized_sales).revenue} }
interactions:
- split: ?{ ${ref(optimized_sales).product_category} }
One model, two Insights: lineage for optimized_sales+ in Visivo 2.3.0.
Database-level optimization
Aggregate before you chart
Before: Slow, unoptimized query (row-level joins across four tables)
name: Slow Query Example
models:
- name: slow_customer_analysis
sql: |
SELECT
o.order_date,
c.customer_name,
c.segment,
p.product_name,
p.category,
o.quantity * p.price as revenue
FROM orders o
JOIN customers c ON o.customer_id = c.id
JOIN order_items oi ON o.id = oi.order_id
JOIN products p ON oi.product_id = p.id
WHERE o.order_date > '2022-01-01'
ORDER BY o.order_date DESC
After: Optimized with aggregation (reads a pre-aggregated view)
name: Fast Query Example
models:
- name: fast_customer_analysis
sql: |
SELECT
DATE_TRUNC('week', order_date) as week,
segment,
category,
SUM(revenue) as total_revenue,
COUNT(DISTINCT customer_id) as customer_count,
AVG(revenue) as avg_revenue
FROM customer_revenue_summary -- Pre-aggregated materialized view
WHERE order_date > '2022-01-01'
GROUP BY 1, 2, 3
ORDER BY 1, 2, 3
Use one source per workload
Visivo supports multiple data sources, so each workload can run on the database that suits it: serve aggregates from DuckDB and reserve the operational database for rows that must be current. The reasoning is in modern data stack alignment and DuckDB dashboard visualization:
name: Multi Source Performance
sources:
# Fast analytics database for aggregated data
- name: analytics_db
type: duckdb
database: ./analytics.duckdb
# Operational database for detailed queries
- name: postgres_prod
type: postgresql
database: production
host: db.company.com
username: ${env.DB_USER}
password: ${env.DB_PASS}
models:
# Use DuckDB for fast analytical queries
- name: monthly_metrics
source: ${ref(analytics_db)}
sql: |
SELECT * FROM monthly_summary_mv
WHERE month >= CURRENT_DATE - INTERVAL '12 months'
# Use PostgreSQL only when you need the latest operational rows
- name: live_orders
source: ${ref(postgres_prod)}
sql: |
SELECT * FROM orders
WHERE created_at >= CURRENT_DATE
LIMIT 100
Visualization patterns
Choose the chart type for the data volume
Chart types differ in how much data they render well:
High Performance for Large Datasets:
name: Large Dataset Viz
models:
- name: million_points
sql: SELECT timestamp, value FROM large_dataset
insights:
- name: large_dataset_scatter
props:
type: scattergl # WebGL accelerated for 100k+ points
mode: markers
x: ?{ ${ref(million_points).timestamp} }
y: ?{ ${ref(million_points).value} }
marker:
size: 2
opacity: 0.6
Efficient Aggregated Views:
name: Bar Chart Example
models:
- name: aggregated_metrics
sql: SELECT category_name, total_amount FROM metrics
insights:
- name: performance_bar_chart
props:
type: bar # Fast rendering for categorical data
x: ?{ ${ref(aggregated_metrics).category_name} }
y: ?{ ${ref(aggregated_metrics).total_amount} }
marker:
color: "#2E86C1"
Memory-Efficient Heatmaps:
name: Heatmap Example
models:
- name: correlation_matrix
sql: SELECT var_1, var_2, correlation FROM correlations
insights:
- name: correlation_heatmap
props:
type: heatmap
x: ?{ ${ref(correlation_matrix).var_1} }
y: ?{ ${ref(correlation_matrix).var_2} }
z: ?{ ${ref(correlation_matrix).correlation} }
colorscale: RdBu
hoverongaps: false # Improves performance
Limit the data
Use filter interactions to limit data at the query level:
name: Filtered Data Example
models:
- name: time_series_data
sql: SELECT date, value FROM time_series
insights:
- name: recent_trends
props:
type: scatter
mode: lines
x: ?{ ${ref(time_series_data).date} }
y: ?{ ${ref(time_series_data).value} }
interactions:
- filter: ?{ ${ref(time_series_data).date} >= CURRENT_DATE - 90 } # Last 90 days only
- filter: ?{ ${ref(time_series_data).value} > 0 } # Exclude zeros
- sort: ?{ ${ref(time_series_data).date} DESC }
Dashboard layout
Put the critical rows first
Order the rows so the information people came for loads first:
name: Dashboard Layout
models:
- name: kpi_data
sql: SELECT metric, value FROM kpis
- name: trend_data
sql: SELECT date, value FROM trends
- name: category_data
sql: SELECT category, total FROM categories
- name: detailed_data
sql: SELECT * FROM details
insights:
- name: revenue_kpi_insight
props:
type: indicator
value: ?{ ${ref(kpi_data).value} }[0]
- name: orders_kpi_insight
props:
type: indicator
value: ?{ ${ref(kpi_data).value} }[0]
- name: growth_kpi_insight
props:
type: indicator
value: ?{ ${ref(kpi_data).value} }[0]
- name: revenue_trend_insight
props:
type: scatter
x: ?{ ${ref(trend_data).date} }
y: ?{ ${ref(trend_data).value} }
- name: top_categories_insight
props:
type: bar
x: ?{ ${ref(category_data).category} }
y: ?{ ${ref(category_data).total} }
charts:
- name: revenue_kpi
insights:
- ${ref(revenue_kpi_insight)}
- name: orders_kpi
insights:
- ${ref(orders_kpi_insight)}
- name: growth_kpi
insights:
- ${ref(growth_kpi_insight)}
- name: revenue_trend
insights:
- ${ref(revenue_trend_insight)}
- name: top_categories
insights:
- ${ref(top_categories_insight)}
tables:
- name: detailed_table
data: ${ref(detailed_data)}
rows_per_page: 25
dashboards:
- name: performance_optimized_dashboard
rows:
# Critical KPIs load first: the viewer loads the top rows at once and the rest as they scroll into view
- height: small
items:
- width: 1
chart: ${ref(revenue_kpi)}
- width: 1
chart: ${ref(orders_kpi)}
- width: 1
chart: ${ref(growth_kpi)}
# Main visualization - moderate complexity
- height: large
items:
- width: 2
chart: ${ref(revenue_trend)}
- width: 1
chart: ${ref(top_categories)}
# Detailed views - most complex queries
- height: medium
items:
- width: 3
table: ${ref(detailed_table)}
Keep each chart small
One question per chart, and a fixed layout so the browser does not reflow it:
name: Chart Layout Example
models:
- name: metrics_data
sql: SELECT date, value FROM metrics
insights:
- name: primary_metric
props:
type: scatter
x: ?{ ${ref(metrics_data).date} }
y: ?{ ${ref(metrics_data).value} }
- name: secondary_metric
props:
type: scatter
x: ?{ ${ref(metrics_data).date} }
y: ?{ ${ref(metrics_data).value} }
charts:
- name: optimized_trend_chart
insights:
- ${ref(primary_metric)}
# Limit to 2-3 insights per chart for best performance
- ${ref(secondary_metric)}
layout:
height: 400 # Fixed height prevents layout thrashing
margin:
l: 50
r: 20
t: 30
b: 50
showlegend: true
legend:
orientation: h # Horizontal legend saves vertical space
y: -0.2
Development workflow
Profile locally
Use the development server to profile a project:
# Start with verbose logging
visivo --verbose serve
# Or write a cProfile dump (visivo-profile.dmp) on exit
visivo --profile serve
# Test dashboard responsiveness
# Open browser developer tools
# Check network tab for query timing
# Monitor memory usage during interactions
Test payload size
Before deploying, add Visivo tests that keep each Insight's payload small. A test asserts on the computed values of an Insight, so it can check how many points the Insight sends to the browser:
tests:
- name: revenue-trend-has-data
assertions:
- ">{ len( ${ref(revenue_trend).props.x} ) > 0 }"
- name: revenue-trend-stays-small
assertions:
- ">{ len( ${ref(revenue_trend).props.x} ) < 10000 }"
Visivo tests check the data, not the load time. Measure load time in your browser's developer tools.
Run the tests before you deploy:
# Run all tests, including the payload-size checks
visivo test
# Compile to check for configuration issues
visivo compile
Deployment
One project file per environment
Keep one project file and change the connection per environment with environment variables. Visivo reads ${env.VAR_NAME} in source connection fields and loads a .env file from the project directory:
# project.visivo.yml
name: Production Config
sources:
- name: database
type: postgresql
host: ${env.DB_HOST}
database: ${env.DB_NAME}
username: ${env.DB_USER}
password: ${env.DB_PASSWORD}
defaults:
source_name: database
Point a run at a different environment with a different env file, for example visivo --env-file .env.staging run.
Check a staging stage first
Test on production-sized data before you go live:
# Deploy to a staging stage with production data volume
visivo deploy -s staging
# Open the staging stage in Visivo Cloud and check load times
# in your browser's developer tools
# Deploy to production only after validation
visivo deploy -s production
Two more patterns
Calculate in the model, not the chart
Pre-calculate complex metrics in your models so the computation runs once, then bind the columns in Insights:
name: Calculated Columns Example
models:
- name: operational_data
sql: SELECT report_date, total_revenue, total_costs, order_count FROM operations
insights:
- name: efficiency_metrics
props:
type: scatter
x: ?{ ${ref(operational_data).report_date} }
y: ?{ ${ref(operational_data).total_revenue} }
hovertemplate: |
Date: %{x}<br>
Value: %{y}<br>
<extra></extra>
Split summary from detail
Give the common case a light summary dashboard and move the heavy views to a second one:
name: Multi Dashboard Navigation
models:
- name: revenue_data
sql: SELECT metric, value FROM revenue
- name: trend_data
sql: SELECT date, value FROM trends
- name: sales_data
sql: SELECT * FROM sales
- name: performers_data
sql: SELECT * FROM top_performers
insights:
- name: total_revenue_indicator_insight
props:
type: indicator
value: ?{ ${ref(revenue_data).value} }[0]
- name: trend_summary_insight
props:
type: scatter
x: ?{ ${ref(trend_data).date} }
y: ?{ ${ref(trend_data).value} }
- name: detailed_sales_analysis_insight
props:
type: scatter
x: ?{ ${ref(sales_data).date} }
y: ?{ ${ref(sales_data).amount} }
charts:
- name: total_revenue_indicator
insights:
- ${ref(total_revenue_indicator_insight)}
- name: trend_summary
insights:
- ${ref(trend_summary_insight)}
- name: detailed_sales_analysis
insights:
- ${ref(detailed_sales_analysis_insight)}
tables:
- name: top_performers_table
data: ${ref(performers_data)}
markdowns:
- name: executive_header
content: |
# Executive Dashboard
Summary metrics. Open the Sales Details dashboard for the full breakdown.
- name: sales_header
content: |
# Sales Details
The detailed views behind the Executive Dashboard.
dashboards:
- name: executive_summary
rows:
- height: compact
items:
- markdown: ${ref(executive_header)}
# Fast-loading summary metrics
- height: small
items:
- width: 1
chart: ${ref(total_revenue_indicator)}
- width: 2
chart: ${ref(trend_summary)}
- name: sales_details
rows:
- height: compact
items:
- markdown: ${ref(sales_header)}
# More detailed, but still optimized views
- height: large
items:
- width: 2
chart: ${ref(detailed_sales_analysis)}
- width: 1
table: ${ref(top_performers_table)}
Monitoring
Alert when a check fails
Visivo does not collect dashboard load times. What you can monitor is the data behind each dashboard. Alerts fire after a visivo test run, so pair the payload-size tests above with an alert that posts to Slack when any test fails:
name: Performance Alerts
alerts:
- name: dashboard_performance_alert
if: ">{ anyTestFailed() }"
destinations:
- type: slack
webhook_url: ${env.SLACK_WEBHOOK}
Run visivo test in CI or on a schedule, and an Insight that grows past its limit reaches your team before it slows a dashboard down.
What these patterns target
Applied together, the patterns above aim at:
- Sub-second load times for executive dashboards
- Less database query time through smart aggregation
- Faster development cycles with local hot reload
- Fewer performance regressions, caught by automated tests
- Lower infrastructure costs through efficient queries
They also speak to a finding from Forrester research: between 60% and 73% of enterprise data goes unused for analytics, often because performance barriers discourage exploration.
Getting started
Start with a Visivo install:
# Install the Visivo CLI
curl -fsSL https://visivo.sh | bash
# Create a project without starting the server
visivo init --project-dir my-fast-dashboard --bare
cd my-fast-dashboard
# Start development with verbose logging
visivo --verbose serve
A performance-first starter project
# project.visivo.yml - Performance-optimized starter
name: High-Performance Analytics
cli_version: "2.3.0"
defaults:
source_name: optimized_db
sources:
- name: optimized_db
type: duckdb # Fast analytical database
database: ./analytics.duckdb
models:
- name: key_metrics
sql: |
SELECT
DATE_TRUNC('day', event_date) as date,
metric_type,
SUM(value) as total_value,
COUNT(*) as event_count
FROM events
WHERE event_date >= CURRENT_DATE - 90
GROUP BY 1, 2
ORDER BY 1, 2
insights:
- name: performance_optimized_trend
props:
type: scattergl # WebGL for performance
mode: lines
x: ?{ ${ref(key_metrics).date} }
y: ?{ ${ref(key_metrics).total_value} }
interactions:
- filter: ?{ ${ref(key_metrics).total_value} > 0 }
charts:
- name: fast_dashboard_chart
insights:
- ${ref(performance_optimized_trend)}
layout:
height: 400
margin:
l: 50
r: 20
t: 30
b: 50
dashboards:
- name: lightning_fast_dashboard
rows:
- height: large
items:
- chart: ${ref(fast_dashboard_chart)}
Next steps
Performance tuning does not end at the first deploy. Because the project is code, the loop is the same one you already run on the rest of your codebase:
- Measure: profile with the development server and your browser's developer tools
- Test: keep the payload-size tests in CI
- Iterate: track each optimization in version control, where the diff explains the change
- Deploy: ship to a staging stage, check it, then deploy to production
For related topics, read customizable embedded analytics, dbt™ local development, and test before dashboard deployment.
Try Visivo for free or share your own optimization patterns with other practitioners on GitHub.
A dashboard that loads fast is a dashboard people open. Build the next one as code, and keep it fast the same way you keep the rest of your code correct: measure it, test it, and review it.