Query Execution Modes (Data Refresh Strategies)
Knowi supports four query execution modes: Scheduled Intervals, Direct Query with Cache, Direct Query without Cache, and Run Once. Each mode offers different trade-offs between performance, freshness, reliability, and system load. Understanding how they work can help you make the best choice for your data strategy.
Scheduled Intervals
Scheduled Intervals run queries automatically at defined intervals (e.g., every two hours). The results are stored in Knowi’s Elasticstore and persists until the next scheduled run. This ensures data is always available and allows for fast dashboard loads, since the data is preprocessed and ready. It also provides resiliency—if the data source goes offline, users will still see the last successful result. This mode is ideal when you want consistent updates and reliable access to data, independent of user activity.
NOTE: You can also trigger a dataset to run based off of an existing dataset's schedule. This mode is only available if querying against a dataset from the Knowi Elasticstore.
Direct Query with Cache
Direct Query with Cache runs the query when a dashboard is loaded, and caches the result for a defined period. While the cache is valid, Knowi serves the cached data to reduce query overhead and speed up performance. Once the cache expires, the next user interaction will re-execute the query and update the cache.
This approach provides fresher data on demand, while limiting load on the source database. It’s important to note that during the cache period, Knowi does not re-query the data source in the background. If the source becomes unavailable after the cache expires, widgets will display empty data. However, when the source is available, performance is dependent entirely on how fast your underlying query runs. A well-optimized query can make Direct Query just as performant as preloaded data.
Direct Query without Cache
Direct Query without Cache executes the query live every time the dashboard or report is accessed. There is no caching layer, so the user always sees the most current data. Like the cached version, this mode's performance is directly tied to the efficiency of your query and the responsiveness of your database. This means that performance is as fast (or slow) as your source query allows. This mode is ideal when real-time accuracy is critical and your queries are tuned for speed. However, since each load triggers a fresh query, it may increase strain on your data store if dashboards are being loaded constantly.
Run Once
Run Once means the query is executed a single time manually. The resulting dataset is persisted in Knowi and used in dashboards or reports until another manual refresh is triggered. This mode behaves similarly to Scheduled Intervals in that the data is cached and preprocessed, making it fast and resilient—even if the data source is later unavailable. Run Once is especially useful for static or rarely changing datasets, where continuous updates are unnecessary.
Each mode offers flexibility based on your needs. If guaranteed availability and low latency are key, Scheduled or Run Once is often preferable. If you need fresher data and your queries are well-optimized, Direct Query modes offer real-time accuracy with acceptable performance.
Please sign in to leave a comment.
0 comments