pg_plan_filter 1.0.0 released for PostgreSQL
Key Takeaway
A new loadable module allows PostgreSQL administrators to block queries based on the planner's estimated cost.
Summary
The pg_plan_filter 1.0.0 module has been released to help administrators protect production databases from expensive queries. It works by testing statements against configured cost criteria before they are executed. The module is compatible with PostgreSQL versions 14 through 18.
Cost-based query filtering
- statement_cost_limit: Refuses individual statements if their plan cost exceeds a set threshold.
- transaction_cost_limit: Caps the total combined cost of all statements within a single transaction.
- filter_select_only: An optional setting to apply these restrictions exclusively to SELECT statements.
- Supports PostgreSQL versions 14, 15, 16, 17, and 18.
Why it matters
This module provides a mechanism for database administrators to prevent resource exhaustion caused by poorly optimized or runaway queries in production environments.
Original reference: www.postgresql.org →