Skip to main content
Version: v4

Cache Settings

Cache Setting lets you keep data in memory instead of reading from the database every time, so you get data faster. When caching is enabled, data is read from memory, so it may lag behind the live data in the database. How often the data is refreshed is up to your settings.

info

When to use a cache: Caching suits datasets that need complex computation to produce results (e.g. recursive queries), or situations with high query concurrency.

Enable caching​

Step 1: Open the settings​

On the Datasets tab of the workspace page, find the dataset you want to cache, click the three-dot icon to its right, and select "Cache Setting" to open the settings page.

Step 2: Set the dataset's cache refresh frequency​

  • Cache: When enabled, you can set the following refresh frequencies. Your dataset's cached data is refreshed at the frequency you set.
    1. Second - refresh the cache every N seconds.
    2. Minute - refresh the cache every N minutes.
    3. Hour - refresh the cache every N hours.
    4. Day - refresh the cache every N days.

If the cached dataset is a Materialized View, the cache refresh automatically follows the Materialized View's refresh time and does not need to be set separately. That is, for a Materialized View with a refresh frequency, enabling Cache does not show the cache refresh frequency option.

Step 3: Finish​

Click Submit to finish. The configured dataset is shown on the Datasets tab.

  1. A lightning icon next to a dataset's name means the dataset has caching enabled
  2. If a dataset has caching enabled, the Status column shows the cache status
    • Cache Success: Caching succeeded; the dataset's last refresh time is shown in the Data Freshness column
    • Cache Fail: Caching failed, and the dataset falls back to a live connection. If your dataset's cache fails, you can restore it by resetting the cache schedule, or by turning caching off and setting it up again.

Why caching fails​

  1. If your table has no data, only column names, caching fails.
  2. If your dataset contains data types not listed below, caching fails.
    • Types supported by the cache: BOOLEAN, BIGINT, INTEGER, SMALLINT, TINYINT, REAL, DOUBLE, VARCHAR, CHAR, VARBINARY, TIMESTAMP, TIMESTAMP_WITH_TIMEZONE, DATE, DECIMAL, UUID, ARRAY, ROW, MAP.