Bangkok, Thailand - June 12, 2026

## pg_kpart - Reject queries that scan all partitions without using the 
partition key

`pg_kpart` is a PostgreSQL extension that rejects queries which would scan 
every partition of a partitioned table without a usable predicate on the 
partition key. It prevents accidental full-hierarchy scans caused by missing 
WHERE/JOIN conditions on the partition key.

As a DBA, you have almost certainly run into queries that hit a partitioned 
table without using the partition key. On tables holding hundreds of millions 
or billions of rows, it is a disaster: PostgreSQL has no choice but to scan 
every partition, the server's I/O subsystem saturates, and overall performance 
collapses for everyone connected to the instance.

The rule it enforces is simple: if a query against a protected partitioned 
table cannot prune *any* partitions, it is not allowed to run. The author gets 
a clear error instead of a server-wide I/O storm, and the query has to be 
rewritten to filter on the partition key — which is exactly the access pattern 
partitioning is meant to encourage.

`pg_kpart` turns "please always filter on the partition key" from a fragile 
convention that depends on every developer remembering it into a guarantee 
enforced by the database itself. With an audit mode to ease the rollout, 
blacklist/whitelist scoping to target exactly the tables that matter, and a 
dedicated SQLSTATE so applications can react to violations cleanly, it slots 
neatly into a production workflow. If you run large partitioned tables and you 
would rather not be at the mercy of the next query that forgets the partition 
key, this extension is for you.

See this blog post for more information: 
[https://hexacluster.ai/blog/pg-kpart-postgresql-extension](https://hexacluster.ai/blog/pg-kpart-postgresql-extension)

## Links & Credits

pg_kpart is an open project. Any contribution to build a better
tool is welcome. You just have to send your ideas, features requests
or patches using the GitHub tools.

Thank to the developers who submitted patches and users who reported
bugs and feature requests, they are all cited in the ChangeLog file.

Links:

* Documentation: 
[https://github.com/HexaCluster/pg_kpart/blob/main/README.md](https://github.com/HexaCluster/pg_kpart/blob/main/README.md)
* Download: 
[https://github.com/hexacluster/pg_kpart/releases](https://github.com/hexacluster/pg_kpart/releases)
* Development: 
[https://github.com/hexacluster/pg_kpart](https://github.com/hexacluster/pg_kpart)
* Changelog: 
[https://github.com/hexacluster/pg_kpart/blob/master/ChangeLog]([https://github.com/hexacluster/pg_kpart/blob/master/ChangeLog)

-----------------

**About pg_kpart**

The objective of pg_kpart is to have a tool to help PostgreSQL
DBAs to enforce the correct use of PostgreSQL partitioning. 

Tool created at HexaCluster Corp and maintained by Gilles Darold.

pg_kpart works on Linux platform and is available under the PostgreSQL license.

Reply via email to