Select a documentation version: <button class="button button-with-icon cloud-select-dropdown__button button-primary" aria-haspopup="true">16.9.0</button>

- [Current (18.4.0)](https://docs.cloud.google.com/alloydb/omni/containers/current/docs/columnar-engine/maintain-content-freshness.md.txt)
- [18.4.0](https://docs.cloud.google.com/alloydb/omni/containers/18.4.0/docs/columnar-engine/maintain-content-freshness.md.txt)
- [18.3.0](https://docs.cloud.google.com/alloydb/omni/containers/18.3.0/docs/columnar-engine/maintain-content-freshness.md.txt)
- [18.1.0](https://docs.cloud.google.com/alloydb/omni/containers/18.1.0/docs/columnar-engine/maintain-content-freshness.md.txt)
- [17.10.0](https://docs.cloud.google.com/alloydb/omni/containers/17.10.0/docs/columnar-engine/maintain-content-freshness.md.txt)
- [17.9.0](https://docs.cloud.google.com/alloydb/omni/containers/17.9.0/docs/columnar-engine/maintain-content-freshness.md.txt)
- [17.7.0](https://docs.cloud.google.com/alloydb/omni/containers/17.7.0/docs/columnar-engine/maintain-content-freshness.md.txt)
- [17.5.0](https://docs.cloud.google.com/alloydb/omni/containers/17.5.0/docs/columnar-engine/maintain-content-freshness.md.txt)
- [16.14.0](https://docs.cloud.google.com/alloydb/omni/containers/16.14.0/docs/columnar-engine/maintain-content-freshness.md.txt)
- [16.13.0](https://docs.cloud.google.com/alloydb/omni/containers/16.13.0/docs/columnar-engine/maintain-content-freshness.md.txt)
- [16.11.0](https://docs.cloud.google.com/alloydb/omni/containers/16.11.0/docs/columnar-engine/maintain-content-freshness.md.txt)
- [16.9.0](https://docs.cloud.google.com/alloydb/omni/containers/16.9.0/docs/columnar-engine/maintain-content-freshness.md.txt)
- [16.8.0](https://docs.cloud.google.com/alloydb/omni/containers/16.8.0/docs/columnar-engine/maintain-content-freshness.md.txt)
- [16.3.0](https://docs.cloud.google.com/alloydb/omni/containers/16.3.0/docs/columnar-engine/maintain-content-freshness.md.txt)
- [15.18.0](https://docs.cloud.google.com/alloydb/omni/containers/15.18.0/docs/columnar-engine/maintain-content-freshness.md.txt)
- [15.17.0](https://docs.cloud.google.com/alloydb/omni/containers/15.17.0/docs/columnar-engine/maintain-content-freshness.md.txt)
- [15.15.0](https://docs.cloud.google.com/alloydb/omni/containers/15.15.0/docs/columnar-engine/maintain-content-freshness.md.txt)
- [15.13.0](https://docs.cloud.google.com/alloydb/omni/containers/15.13.0/docs/columnar-engine/maintain-content-freshness.md.txt)
- [15.12.0](https://docs.cloud.google.com/alloydb/omni/containers/15.12.0/docs/columnar-engine/maintain-content-freshness.md.txt)
- [15.7.1](https://docs.cloud.google.com/alloydb/omni/containers/15.7.1/docs/columnar-engine/maintain-content-freshness.md.txt)
- [15.7.0](https://docs.cloud.google.com/alloydb/omni/containers/15.7.0/docs/columnar-engine/maintain-content-freshness.md.txt)

<br />

This page describes how to maintain the freshness of data in the columnar engine's column store in AlloyDB Omni in a container.

<br />

As table rows are added, deleted, or updated, the columnar engine doesn't
immediately update data in the column store. Instead, it marks
affected content in the column store as invalid, and queries are planned
and executed using both column-oriented data from the
column store and row-oriented data from the row cache and database storage.

Over time, as more and more data blocks become invalid, query performance
improvements provided by the columnar engine are reduced to the point where the
columnar data needs to be refreshed to regain query performance improvements. When this
*refresh threshold* is reached, the columnar engine uses a background job to refresh the invalid data in the
column store. By default, the columnar engine uses a refresh threshold of
50, indicating that given content in the column store gets marked for refresh
when 50% of its content has become invalid. You can [change this refresh
threshold](https://docs.cloud.google.com/alloydb/omni/containers/16.9.0/docs/columnar-engine/maintain-content-freshness#change-refresh-threshold) to adjust the overhead of the automatic
refresh and potentially gain better ongoing query performance
for your application workload.

Additionally, you can [manually refresh a table's data](https://docs.cloud.google.com/alloydb/omni/containers/16.9.0/docs/columnar-engine/maintain-content-freshness.md.txt#manual-refresh) in the
column store at any time. Usually, you perform a manual refresh when you
want changes to a table to be reflected in the column store as soon as
possible after making the changes.

## Change the refresh threshold of the columnar engine

Edit the value of the
`google_columnar_engine.refresh_threshold_percentage` database flag to
change the refresh threshold of the columnar engine.

```
    ALTER SYSTEM SET google_columnar_engine.refresh_threshold_percentage=THRESHOLD;
```

`THRESHOLD`: an integer value between `1` and
`100`. This value specifies the percentage of data blocks in content
that must become invalid for the content to be marked for refresh.

## Manually refresh a table's data in the column store

Execute the `google_columnar_engine_refresh` SQL function to manually
refresh a table's data in the in-memory column store.

```
SELECT google_columnar_engine_refresh(TABLE_NAME);
```

`TABLE_NAME`: a string containing the name of the table or the materialized view. If the table or the view is in a schema other
than `public`, specify the name of the schema using the format
`SCHEMA_NAME.TABLE_NAME`---for example, `myschema.mytable`.