> For the complete documentation index, see [llms.txt](https://docs.codatum.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.codatum.com/data-exploration/appendix-cache.md).

# (Appendix) Query Execution and Cache

In various scenes, we create and utilize caches with each query execution to prevent redundant background jobs.

This helps in reducing the amount of data scanned and in obtaining execution results faster.

## **Query Execution**

Queries are executed in the following features:

* [Doc Page](/data-exploration/notebook/doc-page.md)
  * Run all, Run all with fresh data
  * [SQL Block](/data-exploration/notebook/sql-block.md)
    * Run, Run with fresh data
* [Grid Page](/data-exploration/notebook/grid-page.md)
  * Run all, Run all with fresh data
* [Report](/sharing/report.md) & [Signed Embed](/sharing/signed-embed.md)
  * Refresh
  * Automatically run
* Query
  * Run
* Table preview features across various functions

## **Warehouse-side Cache**

If the SQL statement does not change, the warehouse-side cache (e.g., [cached query results in BigQuery](https://cloud.google.com/bigquery/docs/cached-results)) is used. When using SQL Chain, intermediate SQL results are automatically rewritten to use the cache table.

## **Small Cache for Notebooks and Reports**

* SQL results of up to 1000 rows are stored as a cache with the notebook. Charts and other components can utilize these results up to 1000 rows.
* If the same SQL is executed again within 24 hours, the saved display-ready data is retrieved and shown without running a new job.
  * To execute with a new job, select `Run all with fresh data` to update the results.
* Report cache expiration time can be changed from the report settings.

{% hint style="info" %}
Table preview features retrieve data each time they are viewed, so cache is not utilized.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.codatum.com/data-exploration/appendix-cache.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
