WebReport with scheduled query results updates

May 6, 2023 by Igor Lozhkin
Arnica WebReport executes adhoc query in realtime and displays data from its results.

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:

report_adhoc_query.png

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:

switch_report_source_to_sql_script.png

Return to script edit page and add the following metadata (highlighted):

update_sql_query_metadata.png

After saving,  metadata will be automatically moved to its own editing section:

report_sql_query_with_cache_options.png

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.