Skip to content

Commit 2871aa9

Browse files
authored
Update failing-backup-restore.mdx (#3907)
1 parent ece2975 commit 2871aa9

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

serverless/sql-databases/troubleshooting/failing-backup-restore.mdx

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,30 @@ These issues are caused by using `pg_dump` and `pg_restore` versions that are no
2828
To solve these issues, upgrade your `pg_dump` and/or `pg_restore` modules:
2929

3030
- You can upgrade them by installing PostgreSQL 16 which includes these tools.
31-
- If you are using a third-party tool that includes these libraries, upgrade your tool. For instance, pgAdmin supports PostgreSQL 16 ecosystem from version 7.8.
31+
- If you are using a third-party tool that includes these libraries, upgrade your tool. For instance, pgAdmin supports PostgreSQL 16 ecosystem from version 7.8.
32+
33+
## Automated backup fails due to long-running queries
34+
35+
### Problem
36+
37+
When performing long-running queries (lasting several hours or days), backup operations might not be performed successfully. Backup status will then appear as `error` or `unknown_status`.
38+
39+
### Cause
40+
41+
These issues are caused by queries locking database rows (usually long running transactions), preventing logical backup operations from reading database rows.
42+
43+
### Solution
44+
45+
To solve these issues, stop these queries:
46+
47+
- List PostgreSQL processes and identify the ones that have been running transactions since several hours ('xact_start' colmun) with the following command:
48+
```
49+
SELECT pid, state, usename, query, xact_start, query_start FROM pg_stat_activity ORDER BY xact_start;
50+
```
51+
- Stop the corresponding queries with:
52+
```
53+
SELECT pg_cancel_backend({pid});
54+
```
55+
Where `{pid}` is the process id from the long-running query causing the issue (`pid` column of the previous step).
56+
57+
Alternatively, you can also stop long-running queries using a graphical PostgreSQL client such as [pgAdmin](https://www.pgadmin.org/) or [DBeaver](https://dbeaver.io/).

0 commit comments

Comments
 (0)