> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify-poc.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# timescaledb_pre_restore()

> Prepare the database for a restore operation

export const TIMESCALE_DB = 'TimescaleDB';

<Icon icon="tag" iconType="duotone" /> Since [0.9.0][tsdb-0.9.0]

Perform the required operations so that you can restore the database using `pg_restore`. Specifically, this sets the
`timescaledb.restoring` GUC to `on` and stops any background workers which could have been performing tasks.

The background workers are stopped until the [`timescaledb_post_restore()`][timescaledb_post_restore] function is run,
after the restore operation is complete.

For more information, see [Migrate using pg\_dump and pg\_restore][pg-dump-restore].

<Warning>
  After using `timescaledb_pre_restore()`, you need to run [`timescaledb_post_restore()`][timescaledb_post_restore] before
  you can use the database normally.
</Warning>

## Samples

Prepare to restore the database:

```sql theme={"dark"}
SELECT timescaledb_pre_restore();
```

## Returns

| Column  | Type    | Description                                  |
| ------- | ------- | -------------------------------------------- |
| success | BOOLEAN | TRUE if the operation completed successfully |

[pg-dump-restore]: /migrate/postgres/pg-dump-and-restore

[timescaledb_post_restore]: /api-reference/timescaledb/administration/timescaledb_post_restore

[tsdb-0.9.0]: https://github.com/timescale/timescaledb/releases/tag/0.9.0
