plan_filter
Overview
| Package | Version | Category | License | Language |
|---|---|---|---|---|
pg_plan_filter | 1.0.0 | FEAT | PostgreSQL | C |
| ID | Extension | Bin | Lib | Load | Create | Trust | Reloc | Schema |
|---|---|---|---|---|---|---|---|---|
| 2810 | plan_filter | No | Yes | Yes | No | No | No | - |
| Related | pg_hint_plan pg_kpart pg_command_fw hypopg index_advisor pg_qualstats online_advisor block_copy_command pg_stat_plans pg_readonly |
|---|
Maintained RPM/DEB recipes and versioned source are 1.0.0; local package matrix on 2026-10-10 has RPM 1.0.0 and DEB 0.0.1. Retain maintained DEB 1.0.0; repository publication is a separate check.
Version
| Type | Repo | Version | PG Ver | Package | Deps |
|---|---|---|---|---|---|
| EXT | PIGSTY | 1.0.0 | 1817161514 | pg_plan_filter | - |
| RPM | PIGSTY | 1.0.0 | 1817161514 | pg_plan_filter_$v | - |
| DEB | PIGSTY | 1.0.0 | 1817161514 | postgresql-$v-pg-plan-filter | - |
Build
You can build the RPM / DEB packages for pg_plan_filter using pig build:
Install
You can install pg_plan_filter directly. First, make sure the PGDG and PIGSTY repositories are added and enabled:
Install the extension using pig or apt/yum/dnf:
Preload:
Usage
Sources:
plan_filter is the loadable library in pg_plan_filter 1.0.0. It rejects statements or transactions whose estimated plan cost exceeds configured limits. It supports PostgreSQL 14–18 and has no SQL extension to create.
Core Workflow
Operational Boundaries
Append the library to the existing preload list and restart; LOAD is also supported for development and testing. Both cost limits default to zero, disabling enforcement. plan_filter.statement_cost_limit caps a single plan and can also reject expensive plain EXPLAIN. plan_filter.transaction_cost_limit charges every execution, including repeated prepared statements; rolling back to a savepoint does not refund the budget. Plain EXPLAIN does not consume the transaction budget, while plan-bearing utility commands do.
plan_filter.filter_select_only applies both limits only to SELECT when true; SELECT can still have side effects. plan_filter.module_loaded is a read-only presence signal. The limit settings require superuser or explicitly granted parameter-setting privileges. Rejection uses SQLSTATE 54001. Cost is an estimate rather than elapsed time, and ordinary roles can lower planner cost settings to evade the threshold. Use this as cooperative protection against accidental load, not as the sole security boundary against hostile sessions.
Was this page helpful?
Thanks—your feedback helps us improve this page.
What got in the way? (optional)