SQLSTATE 57014 ERROR Class 57: Operator Intervention

query_canceled canceling autovacuum task — 57014

PostgreSQL error “canceling autovacuum task — 57014” (SQLSTATE 57014): what it means, common causes, and how to fix it.

PG 9.6, 10, 11, 12, 13, 14, 15, 16, 17, 18 Official docs
Last reviewed Jun 2026 Grounded in source

Diagnostic Queries

Symptoms

An autovacuum task was canceled — commonly because it conflicted with a lock request, or was interrupted. PostgreSQL reports SQLSTATE 57014 (query_canceled).

  • Autovacuum on a relation was canceled.
  • Often yields to a conflicting lock request (e.g. DDL).
  • Repeated cancellations let bloat and XID age grow.

What the server log shows

LOG:  canceling autovacuum task
CONTEXT:  automatic vacuum of table "production.public.orders"

Why PostgreSQL raises this — what the manual says

Section 24.1.5 Preventing Transaction ID wraparound">Transaction ID Wraparound Failures:

“However, if the autovacuum is running to prevent transaction ID wraparound (i.e., the autovacuum query name in the pg_stat_activity view ends with (to prevent wraparound)), the autovacuum is not automatically interrupted.”

Regular autovacuum is a low-priority background task; it yields to user commands needing conflicting locks (e.g. ALTER TABLE) by canceling itself with 57014. Frequent cancellations mean tables don’t get vacuumed, allowing bloat and XID age to climb.

Common causes

  • Frequent DDL or lock-heavy operations on a table preventing autovacuum from finishing.
  • Manual cancellation of a vacuum.
  • A busy table that autovacuum repeatedly starts and abandons.

How to fix it

  1. Schedule DDL during quiet windows so autovacuum can complete.
  2. Run a manual VACUUM off-peak for chronically canceled tables.
  3. Note anti-wraparound vacuums are not auto-canceled — don’t let regular cancellations mask growing XID age.

Related & next steps

Reference: PostgreSQL 18 Section 25.1 “Routine Vacuuming”.

Was this helpful?