Repository navigation
Optimize Dashboard Filter Performance via Precomputed/Extract-based Caching #41852
Replies: 2 comments
|
The challenge you describe is fundamental to SQL-based analytical engines (Trino, Presto, Hive) where query compilation and data scanning incur significant latency on every modified WHERE clause. While Superset core does not currently feature an internal in-memory columnar query engine (like Tableau Data Engine / Hyper or DuckDB WASM in the browser), you can achieve extract-like performance and avoid query storms through several existing architectural capabilities: 1. Celery Cache Warmup with Pre-warmed CombinationsSuperset provides a built-in background cache warming task located in # In superset_config.py
from celery.schedules import crontab
CELERYBEAT_SCHEDULE = {
"cache-warmup-hourly": {
"task": "cache-warmup",
"schedule": crontab(minute=0), # hourly
"kwargs": {
"strategy_name": "DashboardTagsStrategy",
"tags": ["warmup", "executive_kpis"],
},
},
}This primes the Redis cache ( 2. Intermediate Semantic Extract Acceleration (Trino / Iceberg / ClickHouse)Rather than caching raw data in Redis key-value blobs and trying to filter JSON client-side, the scalable architecture for Presto/Trino consists of creating materialized extract tables or Iceberg views:
3. Client-Side Cross-Filtering and In-Memory FilteringFor high-interactivity dashboards with moderately sized datasets (under 50,000 rows):
4. Jinja Macro Optimization with Cache Key NormalizationIf specific filter values do not alter the broader dataset aggregation, you can use Jinja templating with SELECT
dimension,
SUM(metric)
FROM my_extract_table
WHERE 1=1
{% if filter_values('region') %}
AND region IN {{ filter_values('region') | where_in }}
{% endif %}
GROUP BY dimensionCombining these strategies provides sub-second interactive response times while shielding your data warehouse from redundant query loads. |
|
A quick syntax note regarding the Celery Beat configuration: |
Uh oh!
There was an error while loading. Please reload this page.
Context
In the current Apache Superset implementation, any alteration to dashboard filter values (e.g., column dropdowns, date range pickers) modifies the WHERE clause of the underlying chart queries. This forces Superset to regenerate the SQL, submit a completely new query to the target data source, and allocate a fresh cache key in Redis.
While this ensures data accuracy, it creates massive performance and infrastructure bottlenecks for large enterprise deployments utilizing engines like Presto, Hive, or Trino.
The Problem
Proposed Solution
We propose implementing a Data Extract and Advanced Caching Mechanism in Superset—conceptually similar to Tableau Data Extracts—to drastically improve dashboard interactivity and reduce database footprint.
Key Capabilities:
Implementation Strategy & Technical Breakdown
To ensure data transparency, we propose adding the following UI components to the dashboard level:
Business & Performance Benefits
All reactions