However, if query execution time is slow and presentation of data, delayed by certain time, is acceptable, the report query can be easily switched to cached data with automatic updates based on specified interval.
As an example, the following is an adhoc query:
This query is always executed in realtime. To engage cache mode, query has to be switched to SQL script, which allows to enter cache metadata:
Return to script edit page and add the following metadata (highlighted):
After saving, metadata will be automatically moved to its own editing section:
Metadata key cache configures report's query to be evaluated for expiration each 1200 seconds and if cache has expired, then the SQL query will be automatically executed at the background, updating cache data. If report is not executed during the last 86400 seconds since the last request, its cache and schedule will be evicted. With the absence of the cache the first request will initialize cache, execute the query, produce data and start the scheduler.