Caching stores query results so subsequent views load instantly without re-querying your database. This dramatically improves performance for data that doesn’t change frequently.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/metabase/metabase/llms.txt
Use this file to discover all available pages before exploring further.
- Data updates once daily or less frequently
- Complex queries that take minutes to run
- High-traffic dashboards viewed by many users
- Reports shared across teams
How caching works
Understand the caching lifecycle to configure policies effectively.First query execution
Query and cache
Cache validity period
Subsequent queries
Cache expiration
Cache invalidation policies
Policies determine how long cached results remain valid before expiring.Duration caching policy
How duration policies work
How duration policies work
- First query: Runs against database, caches for 24 hours
- Hour 12: Returns cached results (still valid)
- Hour 25: Cache expired, runs against database, caches for another 24 hours
- Data with predictable update frequency
- Consistent performance requirements
- Simple cache management
Schedule caching policy
How schedule policies work
How schedule policies work
- First query at 8 AM: Runs against database, caches until 6 AM next day
- Query at 11 AM: Returns cached results
- Query at 7 AM next day: Cache expired (invalidated at 6 AM), runs against database
- Data that updates on a regular schedule (nightly ETL jobs)
- Aligning cache invalidation with data freshness
- Coordinating multiple cached items
- Hourly: Specific minute each hour
- Daily: Specific time each day
- Weekly: Specific day and time each week
- Monthly: Specific day and time each month
Adaptive caching policy
Automatically determine cache duration based on query execution time.How adaptive policies work
How adaptive policies work
- Minimum duration: 10 seconds
- Multiplier: 100
- Only queries averaging >10 seconds are cached
- This query’s results are cached for 50 minutes
- Average execution time recalculates with each database query
- Mixed query performance (fast and slow queries)
- Automatically prioritizing expensive queries
- Adapting to changing query performance
| Parameter | Description | Example |
|---|---|---|
| Minimum query duration | Only cache queries taking longer than this (seconds) | 10 |
| Multiplier | Multiply average execution time by this number for cache duration | 100 |
Don’t cache results
Disable caching to always query the database for fresh results.When to disable caching
When to disable caching
- Real-time data requirements
- Frequently changing data
- Compliance requiring live data
- Low-traffic items where caching overhead isn’t worth it
- Every view queries the database
- Slower load times
- Higher database load
- Always current data
Refresh cache automatically
Benefits
Why use automatic refresh
Why use automatic refresh
- Cache expires at 6 AM
- First viewer at 8 AM waits for query to run
- Cache refreshes
- Subsequent viewers get cached results
- Cache expires at 6 AM
- Metabase automatically queries database at 6 AM
- Cache refreshes
- All viewers at 8 AM get cached results immediately
Configuration
Compatibility limitations
Parameter handling
Metabase intelligently caches parameter combinations.How parameter caching works
How parameter caching works
- Results with default parameter values
- Up to 10 most frequently used parameter value combinations from the last caching period
Doohickey)Last 24 hours usage:Widget: 50 viewsGizmo: 30 viewsGadget: 5 views
Doohickey(default)Widget(most frequent)Gizmo(second most frequent)
Monitoring automatic refresh
Track automatic cache refreshes in the query log:Caching policy hierarchy
Metabase applies the first available policy in this priority order:- Question policy (highest priority)
- Dashboard policy
- Database policy
- Default policy (lowest priority)
Example policy interaction
Example policy interaction
- Default policy: Don’t cache
- Sales database policy: 24-hour duration
- Executive Dashboard policy: 12-hour duration
- Revenue Question policy: 1-hour duration
- Revenue Question on Executive Dashboard: Uses 1-hour (question policy wins)
- Other questions on Executive Dashboard: Use 12-hour (dashboard policy)
- Questions in Sales database (not on dashboard): Use 24-hour (database policy)
- Questions in other databases: No caching (default policy)
Configuring caching policies
Default caching policy
Set a site-wide default for all databases.Open performance settings
Cmd/Ctrl + K and search “Performance”, or navigate to Admin > PerformanceSet default policy
Database caching policy
Set policy
Dashboard caching policy
Select new policy
Optional: Clear cache
Question caching policy
Configure caching
Optional: Enable automatic refresh
Clearing cached results
Manually invalidate caches to force fresh queries.Clear question or dashboard cache
Clear database cache
Cache storage location
Self-hosted Metabase: Cached results are stored in your application database. Metabase Cloud: Cached results are stored on Metabase’s servers in the United States (Metabase manages your application database).Best practices
Align cache with data freshness
Use automatic refresh for dashboards
Monitor cache effectiveness
Start with database-level policies
Performance optimization strategies
For infrequently updated data
For infrequently updated data
- Use Schedule policy: Daily at 2:30 AM
- Enable automatic cache refresh
- Set on database or dashboard level
For mixed-frequency updates
For mixed-frequency updates
- Database default: Adaptive policy (min 5 sec, multiplier 100)
- Fast-changing tables: Don’t cache (question level)
- Executive dashboards: Schedule policy (question level)
For high-traffic dashboards
For high-traffic dashboards
- Dashboard policy: Duration 1 hour
- Enable automatic cache refresh
- Monitor query log for parameter usage patterns
For development environments
For development environments
- Default policy: Don’t cache
- Or use very short duration (5 minutes)
- Clear cache after each deployment
Troubleshooting
Cached results seem stale
Cached results seem stale
- Caching policy duration/schedule
- When cache was last refreshed
- If automatic refresh is enabled
- Database timezone settings
Caching not improving performance
Caching not improving performance
- Cache policy is active (not “Don’t cache”)
- Questions are being viewed more than once
- Parameters remain consistent between views
- Application database has adequate storage
Automatic refresh not working
Automatic refresh not working
- Permission setup (row/column security, impersonation, routing)
- Scheduled tasks are running
- Metabase server time is correct
- Query log shows cache-refresh source entries
Cache storage consuming too much space
Cache storage consuming too much space
- Review caching policies on large result sets
- Shorten cache duration for infrequently accessed items
- Use “Don’t cache” for low-value queries
- Clear caches for unused items
- Consider application database storage limits