# 30.2. Data Checksums

By default, data pages are not protected by checksums, but this can optionally be enabled for a cluster. When enabled, each data page includes a checksum that is updated when the page is written and verified each time the page is read. Only data pages are protected by checksums; internal data structures and temporary files are not.

Checksums are normally enabled when the cluster is initialized using [initdb](https://www.postgresql.org/docs/15/app-initdb.html#APP-INITDB-DATA-CHECKSUMS). They can also be enabled or disabled at a later time as an offline operation. Data checksums are enabled or disabled at the full cluster level, and cannot be specified individually for databases or tables.

The current state of checksums in the cluster can be verified by viewing the value of the read-only configuration variable [data\_checksums](https://www.postgresql.org/docs/15/runtime-config-preset.html#GUC-DATA-CHECKSUMS) by issuing the command `SHOW data_checksums`.

When attempting to recover from page corruptions, it may be necessary to bypass the checksum protection. To do this, temporarily set the configuration parameter [ignore\_checksum\_failure](https://www.postgresql.org/docs/15/runtime-config-developer.html#GUC-IGNORE-CHECKSUM-FAILURE).

## 30.2.1. Off-line Enabling of Checksums

The [pg\_checksums](https://www.postgresql.org/docs/15/app-pgchecksums.html) application can be used to enable or disable data checksums, as well as verify checksums, on an offline cluster.


---

# Agent Instructions: 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:

```
GET https://docs.postgresql.tw/server-administration/reliability-and-the-write-ahead-log/30.2.-data-checksums.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
