pg_qualstats
An extension collecting statistics about quals
pg_qualstats : An extension collecting statistics about quals
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 6240 | pg_qualstats | pg_qualstats | 2.1.4 |
STAT | BSD-3-Clause | C |
| Attribute | Has Binary | Has Library | Need Load | Has DDL | Relocatable | Trusted |
|---|---|---|---|---|---|---|
| --sLd-- | No | Yes | Yes | Yes | no | no |
| Relationships | |
|---|---|
| See Also | online_advisor hypopg index_advisor pg_hint_plan pg_stat_plans plan_filter pg_relusage pg_track_optimizer pg_regresql pg_strom |
Packages
| Type | Repo | Version | PG Major Compatibility | Package Pattern | Dependencies |
|---|---|---|---|---|---|
| EXT | PGDG | 2.1.4 |
18 17 16 15 14 | pg_qualstats |
- |
| RPM | PGDG | 2.1.4 |
18 17 16 15 14 | pg_qualstats_$v |
- |
| DEB | PGDG | 2.1.4 |
18 17 16 15 14 | postgresql-$v-pg-qualstats |
- |
| Linux / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
| el8.x86_64 | PGDG 2.1.4 | PGDG 2.1.4 | PGDG 2.1.4 | PGDG 2.1.4 | PGDG 2.1.4 |
| el8.aarch64 | PGDG 2.1.4 | PGDG 2.1.4 | PGDG 2.1.4 | PGDG 2.1.4 | PGDG 2.1.4 |
| el9.x86_64 | PGDG 2.1.4 | PGDG 2.1.4 | PGDG 2.1.4 | PGDG 2.1.4 | PGDG 2.1.4 |
| el9.aarch64 | PGDG 2.1.4 | PGDG 2.1.4 | PGDG 2.1.4 | PGDG 2.1.4 | PGDG 2.1.4 |
| el10.x86_64 | PGDG 2.1.4 | PGDG 2.1.4 | PGDG 2.1.4 | PGDG 2.1.4 | PGDG 2.1.4 |
| el10.aarch64 | PGDG 2.1.4 | PGDG 2.1.4 | PGDG 2.1.4 | PGDG 2.1.4 | PGDG 2.1.4 |
| d12.x86_64 | PGDG 2.1.4 | PGDG 2.1.4 | PGDG 2.1.4 | PGDG 2.1.4 | PGDG 2.1.4 |
| d12.aarch64 | PGDG 2.1.4 | PGDG 2.1.4 | PGDG 2.1.4 | PGDG 2.1.4 | PGDG 2.1.4 |
| d13.x86_64 | PGDG 2.1.4 | PGDG 2.1.4 | PGDG 2.1.4 | PGDG 2.1.4 | PGDG 2.1.4 |
| d13.aarch64 | PGDG 2.1.4 | PGDG 2.1.4 | PGDG 2.1.4 | PGDG 2.1.4 | PGDG 2.1.4 |
| u22.x86_64 | PGDG 2.1.4 | PGDG 2.1.4 | PGDG 2.1.4 | PGDG 2.1.4 | PGDG 2.1.4 |
| u22.aarch64 | PGDG 2.1.4 | PGDG 2.1.4 | PGDG 2.1.4 | PGDG 2.1.4 | PGDG 2.1.4 |
| u24.x86_64 | PGDG 2.1.4 | PGDG 2.1.4 | PGDG 2.1.4 | PGDG 2.1.4 | PGDG 2.1.4 |
| u24.aarch64 | PGDG 2.1.4 | PGDG 2.1.4 | PGDG 2.1.4 | PGDG 2.1.4 | PGDG 2.1.4 |
| u26.x86_64 | PGDG 2.1.4 | PGDG 2.1.4 | PGDG 2.1.4 | PGDG 2.1.4 | PGDG 2.1.4 |
| u26.aarch64 | PGDG 2.1.4 | PGDG 2.1.4 | PGDG 2.1.4 | PGDG 2.1.4 | PGDG 2.1.4 |
Source
github.com/powa-team/pg_qualstats
Install
Make sure PGDG repo available:
Install this extension with pig:
Config this extension to shared_preload_libraries:
Create this extension with:
Usage
pg_qualstats keeps statistics on predicates found in WHERE clauses and JOIN conditions. It tracks which columns are most frequently queried and which are queried together, enabling index recommendations.
Viewing Predicate Statistics
Index Advisor
Generate index suggestions based on collected predicate statistics:
Utility Functions
Configuration
| Parameter | Default | Description |
|---|---|---|
pg_qualstats.enabled |
true |
Enable/disable collection |
pg_qualstats.track_constants |
true |
Track individual constant values |
pg_qualstats.max |
1000 | Maximum tracked predicates and query texts |
pg_qualstats.resolve_oids |
false |
Resolve OIDs at query time (uses more space) |
pg_qualstats.track_pg_catalog |
false |
Track predicates on pg_catalog objects |
pg_qualstats.sample_rate |
-1 | Fraction of queries to sample (-1 = auto: 1/max_connections) |