# Retrieving Data From a Replica Database

- Updated on Oct 7, 2025
- Published on Sep 26, 2025

- 1 minute(s) read

This feature is available in v42 and later.

In v42 and later, you can set up a replica database to read reporting and audit-log data in on-premise instances. Doing so prevents system latency and timeouts when attempting to retrieve these kinds of data, particularly in instances processing a high volume of submissions.

This feature is built on a “leader/follower” (a.k.a. “main/replica,” “read/write”) architecture and reduces the load on the main database, allowing you to retrieve read-only data as frequently as needed without slowing the processing of incoming submissions.

## Setting up a replica database

To set up a replica database for reading reporting and audit-log data:

1. Provision an additional database in your instance.
   - We **strongly recommend** that the replica database be of the same type and version as the main database. For information on supported database types and versions, see [Infrastructure Requirements](https://help.hyperscience.ai/deployment/docs/infrastructure-requirements#database).
2. Add the following values to your “.env” file (Docker-based deployments), or append it to `dotenv` in `values.yaml` (Kubernetes-based deployments):

```bash
USE_RO_REPLICA_DB=true
FORMS_RO_REPLICA_DB_NAME=<replica db name>
FORMS_RO_REPLICA_DB_HOST=<replica db host>
FORMS_RO_REPLICA_DB_PORT=<replica db port>
FORMS_RO_REPLICA_DB_USER=<user>
FORMS_RO_REPLICA_DB_PASS=<password>
```

When editing the “.env” file, follow the instructions in [Editing the “.env” file and running the application](https://help.hyperscience.ai/deployment/docs/editing-the-env-file-and-running-the-application).

> The application does not keep the replica database synchronized with the main database; your system administrator needs to configure this synchronization outside of Hyperscience.
