pg_stat_kcache
Kernel statistics gathering
pg_stat_kcache : Kernel statistics gathering
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 6220 | pg_stat_kcache | pg_stat_kcache | 2.3.2 |
STAT | BSD-3-Clause | C |
| Attribute | Has Binary | Has Library | Need Load | Has DDL | Relocatable | Trusted |
|---|---|---|---|---|---|---|
| --sLd-r | No | Yes | Yes | Yes | yes | no |
| Relationships | |
|---|---|
| Requires | pg_stat_statements |
| See Also | pgnodemx system_stats pgmeminfo pgmonitor pg_stat_ch pg_datasentinel pgsentinel |
Packages
| Type | Repo | Version | PG Major Compatibility | Package Pattern | Dependencies |
|---|---|---|---|---|---|
| EXT | PGDG | 2.3.2 |
18 17 16 15 14 | pg_stat_kcache |
pg_stat_statements |
| RPM | PGDG | 2.3.1 |
18 17 16 15 14 | pg_stat_kcache_$v |
- |
| DEB | PGDG | 2.3.2 |
18 17 16 15 14 | postgresql-$v-pg-stat-kcache |
- |
| Linux / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
| el8.x86_64 | PGDG 2.3.1 | PGDG 2.3.1 | PGDG 2.3.1 | PGDG 2.3.1 | PGDG 2.3.1 |
| el8.aarch64 | PGDG 2.3.1 | PGDG 2.3.1 | PGDG 2.3.1 | PGDG 2.3.1 | PGDG 2.3.1 |
| el9.x86_64 | PGDG 2.3.1 | PGDG 2.3.1 | PGDG 2.3.1 | PGDG 2.3.1 | PGDG 2.3.1 |
| el9.aarch64 | PGDG 2.3.1 | PGDG 2.3.1 | PGDG 2.3.1 | PGDG 2.3.1 | PGDG 2.3.1 |
| el10.x86_64 | PGDG 2.3.1 | PGDG 2.3.1 | PGDG 2.3.1 | PGDG 2.3.1 | PGDG 2.3.1 |
| el10.aarch64 | PGDG 2.3.1 | PGDG 2.3.1 | PGDG 2.3.1 | PGDG 2.3.1 | PGDG 2.3.1 |
| d12.x86_64 | PGDG 2.3.2 | PGDG 2.3.2 | PGDG 2.3.2 | PGDG 2.3.2 | PGDG 2.3.2 |
| d12.aarch64 | PGDG 2.3.2 | PGDG 2.3.2 | PGDG 2.3.2 | PGDG 2.3.2 | PGDG 2.3.2 |
| d13.x86_64 | PGDG 2.3.2 | PGDG 2.3.2 | PGDG 2.3.2 | PGDG 2.3.2 | PGDG 2.3.2 |
| d13.aarch64 | PGDG 2.3.2 | PGDG 2.3.2 | PGDG 2.3.2 | PGDG 2.3.2 | PGDG 2.3.2 |
| u22.x86_64 | PGDG 2.3.2 | PGDG 2.3.2 | PGDG 2.3.2 | PGDG 2.3.2 | PGDG 2.3.2 |
| u22.aarch64 | PGDG 2.3.2 | PGDG 2.3.2 | PGDG 2.3.2 | PGDG 2.3.2 | PGDG 2.3.2 |
| u24.x86_64 | PGDG 2.3.2 | PGDG 2.3.2 | PGDG 2.3.2 | PGDG 2.3.2 | PGDG 2.3.2 |
| u24.aarch64 | PGDG 2.3.2 | PGDG 2.3.2 | PGDG 2.3.2 | PGDG 2.3.2 | PGDG 2.3.2 |
| u26.x86_64 | PGDG 2.3.2 | PGDG 2.3.2 | PGDG 2.3.2 | PGDG 2.3.2 | PGDG 2.3.2 |
| u26.aarch64 | PGDG 2.3.2 | PGDG 2.3.2 | PGDG 2.3.2 | PGDG 2.3.2 | PGDG 2.3.2 |
Source
github.com/powa-team/pg_stat_kcache
Install
Make sure PGDG repo available:
Install this extension with pig:
Config this extension to shared_preload_libraries:
Create this extension with:
Usage
pg_stat_kcache gathers statistics about real reads and writes done by the filesystem layer, as well as CPU usage per query. It requires pg_stat_statements.
Views
pg_stat_kcache – aggregated per-database statistics:
| Column | Type | Description |
|---|---|---|
datname |
name | Database name |
exec_user_time |
double precision | User CPU time executing statements (seconds) |
exec_system_time |
double precision | System CPU time executing statements (seconds) |
exec_reads |
bigint | Bytes read by filesystem layer |
exec_reads_blks |
bigint | 8K blocks read by filesystem layer |
exec_writes |
bigint | Bytes written by filesystem layer |
exec_writes_blks |
bigint | 8K blocks written by filesystem layer |
plan_user_time |
double precision | User CPU time planning (if tracking enabled) |
plan_system_time |
double precision | System CPU time planning (if tracking enabled) |
pg_stat_kcache_detail – per-query statistics including query text, role, and database.
Functions
Configuration
| Parameter | Default | Description |
|---|---|---|
pg_stat_kcache.linux_hz |
-1 | Linux CONFIG_HZ (auto-detected) |
pg_stat_kcache.track |
top |
Track: top, all, or none |
pg_stat_kcache.track_planning |
off |
Track planning statistics (PG 13+) |