#813·databasus

Constant high CPU usage

Author: lapo-ghCreated Sep 30, 2026Updated Sep 30, 2026
Labelsbug

Databasus version (screenshot)

Image

v3.60.0

Operating system and architecture

NAME="AlmaLinux Kitten" VERSION="10 (Lion Cub)" RELEASE_TYPE=stable ID="almalinux" ID_LIKE="rhel centos fedora" VERSION_ID="10" PLATFORM_ID="platform:el10" PRETTY_NAME="AlmaLinux Kitten 10 (Lion Cub)" ANSI_COLOR="0;34" LOGO="fedora-logo-icon" CPE_NAME="cpe:/o:almalinux:almalinux:10::baseos" HOME_URL="https://almalinux.org/" DOCUMENTATION_URL="https://wiki.almalinux.org/" VENDOR_NAME="AlmaLinux" VENDOR_URL="https://almalinux.org/" BUG_REPORT_URL="https://bugs.almalinux.org/"

ALMALINUX_MANTISBT_PROJECT="AlmaLinux-10" ALMALINUX_MANTISBT_PROJECT_VERSION="10" REDHAT_SUPPORT_PRODUCT="AlmaLinux" REDHAT_SUPPORT_PRODUCT_VERSION="10" 10, x86_64 (kernel 6.12), Docker. Host CPU: 4 threads.

Database type and version (optional, for DB-related bugs)

PostgreSQL 18 in Docker (4 databases: Immich, n8n, Joplin, Mealie), same host as Databasus. Databasus internal DB: bundled PostgreSQL 17.11.

Describe the bug (please write manually, do not ask AI to summarize)

What happened:

What I expected:

Steps to reproduce

  1. Add 4 PostgreSQL 18 databases with backup type "Full + incremental + WAL streaming" (full daily, incremental cron 0 1-23/12 * * *), NAS storage, healthcheck every 1 min.
  2. Let the initial backups complete and leave the system idle (no backup running).
  3. Watch docker stats databasus: CPU stays at ~60% of one core. Count activity in the internal DB via pg_stat_database.xact_commit and pg_stat_user_tables deltas over 10 s.

Have you asked AI how to solve the issue?

  • Claude Sonnet 4.6 or newer
  • ChatGPT 5.2 or newer
  • No

Additional context / logs

CPU (2-min average, 10 s samples): databasus 61–63% of one core, steady. Source DBs 0.8–1.7%. docker top: ./main ~34%, internal Postgres backends ~30%, pg_receivewal ~0.

Internal DB over 10 s: 443 committed transactions/sec.

Table Scans/sec Rows read/sec Rows/scan
physical_full_backups 287 14,487 50
physical_wal_segments 80 535,368 6,667
physical_incremental_backups 65 1,205 19
all other tables ≤ 2 ~0 –

Active query in pg_stat_activity (always this one):

sql
SELECT * FROM "physical_wal_segments" WHERE database_id = $1 AND timeline_id = $2 AND end_lsn > $3::pg_lsn AND start_lsn < $4::pg_lsn ORDER BY start_lsn ASC

physical_wal_segments: 568 live / 126 dead rows, 8.4 MB heap + 6.2 MB indexes, last_autovacuum null.

Ruled out:

  • WAL streaming disabled on all 4 DBs → CPU unchanged (startup log: startup physical backup slot cleanup complete: 4 dropped)
  • Restart → back to ~62% within minutes (not an accumulating leak)
  • Docker healthcheck interval change → no effect
  • No FATAL log lines in steady state (only 3 at startup, from pg_hba socket rejects in start.sh)

Side note: docker stop with the default 10 s grace period leaves the internal Postgres not properly shut down (crash recovery on the next start, which resets table stats).

Possibly related: #798