pg_queryid
Compute configurable external query fingerprints for PostgreSQL
pg_queryid · Compute configurable external query fingerprints for PostgreSQL
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 100480 | pg_queryid | pg_queryid | 0.0.1 | STAT | PostgreSQL | C |
PostgreSQL · 14, 15, 16, 17, 18
Usage
Sources:
- README at the reviewed commit
- Extension control file
- SQL function definition
- Fingerprinting implementation
pg_queryid is a proof-of-concept external query-fingerprinting module for PostgreSQL 14 and later. When preloaded, it replaces core query-ID calculation and can fingerprint referenced objects by name rather than OID, optionally ignoring schemas or queries that touch temporary tables. Creating the extension also exposes pg_queryid(text) returns bigint for one statement at a time.
Configuration and Query
The module must be the last entry in shared_preload_libraries, and upstream requires core compute_query_id to be disabled when the replacement hook is active.
After restarting PostgreSQL:
Caveats
- Upstream labels version
0.0.1a proof of concept that is not ready for production. The reviewed source was last updated in 2022 and provides no current compatibility statement beyond PostgreSQL 14 or later. - Name-based fingerprinting can add substantial overhead. With
pg_queryid.ignore_schema = on, same-named objects in different schemas intentionally share a fingerprint. - Changing any fingerprint option changes query IDs seen by consumers. Reset
pg_stat_statementsand any other query-ID-indexed state after a change. - With
pg_queryid.ignore_temp_tables = on, statements that reference temporary relations are deliberately left without this module’s fingerprint and can disappear from query-ID-based monitoring. - Automatic replacement requires preloading and a restart. Merely running
CREATE EXTENSIONonly installs the SQL helper and does not install the parser hook.