PostgreSQL 18 · Performance and maintenance

Cancel a running query

Ask a backend to stop its current query, using a pid from pg_stat_activity.

SELECT pg_cancel_backend(12345);

Official PostgreSQL 18 documentation

More performance and maintenance commands

All performance and maintenance commands · PostgreSQL 18 cheatsheet

Was this page helpful?