pgfincore
pgfincore
pgfincore : examine and manage the os buffer cache
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 5060 | pgfincore
|
pgfincore
|
1.3.1 |
ADMIN
|
BSD 3-Clause
|
C
|
| Attribute | Has Binary | Has Library | Need Load | Has DDL | Relocatable | Trusted |
|---|---|---|---|---|---|---|
--s-d-r
|
No
|
Yes
|
No
|
Yes
|
yes
|
no
|
| Relationships | |
|---|---|
| See Also | pg_cooldown
pgcozy
fio
pg_prewarm
pgmeminfo
pg_buffercache
pg_repack
pg_rewrite
|
pg18 el fixed by vonng
Packages
| Type | Repo | Version | PG Major Compatibility | Package Pattern | Dependencies |
|---|---|---|---|---|---|
| EXT | PGDG
|
1.3.1 |
18
17
16
15
14
|
pgfincore |
- |
| RPM | PGDG
|
1.3.1 |
18
17
16
15
14
|
pgfincore_$v |
- |
| DEB | PGDG
|
1.3.1 |
18
17
16
15
14
|
postgresql-$v-pgfincore |
- |
| Linux / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
el8.x86_64
|
PIGSTY 1.3.1
|
PGDG 1.3.1
|
PGDG 1.3.1
|
PGDG 1.3.1
|
PGDG 1.3.1
|
el8.aarch64
|
PIGSTY 1.3.1
|
PGDG 1.3.1
|
PGDG 1.3.1
|
PGDG 1.3.1
|
PGDG 1.3.1
|
el9.x86_64
|
PIGSTY 1.3.1
|
PGDG 1.3.1
|
PGDG 1.3.1
|
PGDG 1.2.4
|
PGDG 1.2.4
|
el9.aarch64
|
PIGSTY 1.3.1
|
PGDG 1.3.1
|
PGDG 1.3.1
|
PGDG 1.2.4
|
PGDG 1.2.4
|
el10.x86_64
|
PIGSTY 1.3.1
|
PGDG 1.3.1
|
PGDG 1.3.1
|
PGDG 1.3.1
|
PGDG 1.3.1
|
el10.aarch64
|
PIGSTY 1.3.1
|
PGDG 1.3.1
|
PGDG 1.3.1
|
PGDG 1.3.1
|
PGDG 1.3.1
|
d12.x86_64
|
PGDG 1.3.1
|
PGDG 1.3.1
|
PGDG 1.3.1
|
PGDG 1.3.1
|
PGDG 1.3.1
|
d12.aarch64
|
PGDG 1.3.1
|
PGDG 1.3.1
|
PGDG 1.3.1
|
PGDG 1.3.1
|
PGDG 1.3.1
|
d13.x86_64
|
PGDG 1.3.1
|
PGDG 1.3.1
|
PGDG 1.3.1
|
PGDG 1.3.1
|
PGDG 1.3.1
|
d13.aarch64
|
PGDG 1.3.1
|
PGDG 1.3.1
|
PGDG 1.3.1
|
PGDG 1.3.1
|
PGDG 1.3.1
|
u22.x86_64
|
PGDG 1.3.1
|
PGDG 1.3.1
|
PGDG 1.3.1
|
PGDG 1.3.1
|
PGDG 1.3.1
|
u22.aarch64
|
PGDG 1.3.1
|
PGDG 1.3.1
|
PGDG 1.3.1
|
PGDG 1.3.1
|
PGDG 1.3.1
|
u24.x86_64
|
PGDG 1.3.1
|
PGDG 1.3.1
|
PGDG 1.3.1
|
PGDG 1.3.1
|
PGDG 1.3.1
|
u24.aarch64
|
PGDG 1.3.1
|
PGDG 1.3.1
|
PGDG 1.3.1
|
PGDG 1.3.1
|
PGDG 1.3.1
|
Source
pig build pkg pgfincore; # build rpm/debInstall
Make sure PGDG repo available:
pig repo add pgdg -u # add pgdg repo and update cacheInstall this extension with pig:
pig install pgfincore; # install via package name, for the active PG version
pig install pgfincore -v 18; # install for PG 18
pig install pgfincore -v 17; # install for PG 17
pig install pgfincore -v 16; # install for PG 16
pig install pgfincore -v 15; # install for PG 15
pig install pgfincore -v 14; # install for PG 14Create this extension with:
CREATE EXTENSION pgfincore;Usage
pgfincore provides functions to inspect and manage OS page cache contents for PostgreSQL relations using mincore and POSIX_FADVISE.
Inspect Cache State
SELECT * FROM pgfincore('pgbench_accounts');Returns per-segment info: relpath, segment, os_page_size, rel_os_pages, pages_mem (pages in OS cache), group_mem, os_pages_free, pages_dirty, group_dirty.
Use pgfincore('relation', true) to include the databit varbit map for snapshot/restore.
System Info
SELECT * FROM pgsysconf(); -- os_page_size, os_pages_free, os_total_pages
SELECT * FROM pgsysconf_pretty(); -- same with human-readable outputPreload into OS Cache
SELECT * FROM pgfadvise_willneed('pgbench_accounts');Evict from OS Cache
SELECT * FROM pgfadvise_dontneed('pgbench_accounts');Other POSIX_FADVISE Flags
SELECT * FROM pgfadvise_normal('relation');
SELECT * FROM pgfadvise_sequential('relation');
SELECT * FROM pgfadvise_random('relation');Snapshot and Restore Cache State
-- Snapshot
CREATE TABLE pgfincore_snapshot AS
SELECT 'pgbench_accounts'::text AS relname, *, now() AS date_snapshot
FROM pgfincore('pgbench_accounts', true);
-- Restore
SELECT * FROM pgfadvise_loader('pgbench_accounts', 0, true, true,
(SELECT databit FROM pgfincore_snapshot
WHERE relname = 'pgbench_accounts' AND segment = 0));Direct Page Cache Control
-- Load first 3 pages, unload next 3
SELECT * FROM pgfadvise_loader('pgbench_accounts', 0, true, true, B'111000');
-- Load only
SELECT * FROM pgfadvise_loader('pgbench_accounts', 0, true, false, B'111000');
-- Unload only
SELECT * FROM pgfadvise_loader('pgbench_accounts', 0, false, true, B'111000');Last updated on