Agile performance - Cache Modes

In the previous section you activated the cache in one of your views. Now, it's time to learn more about how the Denodo Cache works. Denodo has the following cache modes:

  • Partial:

    the first time a query over the view is executed, the cache table will be populated with the tuples in the output. At runtime, when a user queries the view, the Denodo server checks if the cache contains the data required to answer the query. If it does not have this data, Denodo will query the data source and populate the cache.

    And when the Time To Live (TTL) of the data is reached, the cache system invalidates the cached data of the view so the next query will hit the data source.

    This mode supports the following options:

    • With explicit loads: if this option is selected, the cache has to be loaded explicitly.
    • Match exact queries only: if this option is selected, the cache stores the result of each query. Then, if the same query is executed and the entries of this query in cache have not expired (TTL), the data returned to the client is retrieved from the cache system.

  • Full:

    the data of the view is always retrieved from the cache engine instead of from the source, this mode always requires explicit cache loads.

    The main benefit of this mode over the partial cache is that complex operations (joins, unions, group by …) involving several views (even from different data sources) can be delegated to the cache database. Therefore, the performance of these operations is significantly improved.

Cache Examples

Let's see how the cache works using an example:

SELECT * FROM client_with_bills
WHERE client_id = "C077"

CODE
  • Cache off

    Denodo server will always query the data sources.

  • Cache partial

    Denodo server will query the data source and subsequent queries will go to cache if possible.

    If different queries are executed:

    • SELECT * FROM client_with_bills WHERE CLIENT_ID = "C066" will query the data source again.
    • SELECT * FROM client_with_bills WHERE CLIENT_ID = "C077" AND CODE = "02" will query the cache.
    • SELECT * FROM client_with_bills WHERE CLIENT_ID = "C066" will query the cache now.
  • Cache partial with explicit loads

    Denodo server will query the data source until the cache is loaded.

    • SELECT * FROM client_with_bills WHERE CLIENT_ID = "C077" will query the data source.
    • SELECT * FROM client_with_bills WHERE CLIENT_ID = "C077" CONTEXT('cache_preload' = 'true') will query the data source and load the cache.
    • SELECT * FROM client_with_bills WHERE CLIENT_ID = "C077" will query the cache.
  • Cache partial and match exact queries only
    • SELECT * FROM client_with_bills WHERE CLIENT_ID = "C077" will query the cache.
    • SELECT * FROM client_with_bills WHERE CLIENT_ID = "C077" AND CODE = "02" will query the data source and load the cache for this query.
  • Cache full

    all queries will go to cache.

    In Full mode, to load the cache you have to execute a query like
    SELECT * FROM <view> CONTEXT('cache_preload'='true')

    TIP

Congrats! You have completed the Basics Tutorial.

This is the first step in understanding Data Virtualization software. Now you are prepared to go to the rest of Denodo Tutorials.

Thank you!