Skip to content

feat: expose PGLZ compression bindings + add pglz_inspect example #2326

Open
isdaniel wants to merge 2 commits into
pgcentralfoundation:developfrom
isdaniel:feat/pglz-bindings-and-inspect
Open

feat: expose PGLZ compression bindings + add pglz_inspect example #2326
isdaniel wants to merge 2 commits into
pgcentralfoundation:developfrom
isdaniel:feat/pglz-bindings-and-inspect

Conversation

@isdaniel

@isdaniel isdaniel commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a safe Rust wrapper around PostgreSQL's in-tree PGLZ compressor (common/pg_lzcompress.h) and ships a companion example extension that uses it to advise DBAs on column-level compression decisions.

Motivation

pglz_compress / pglz_decompress / pglz_maximum_compressed_size are stable, palloc-free, elog-free C functions that ship with every supported PostgreSQL version. Extension authors today have no first-class way to call them from pgrx — they have to either reach into pg_sys and write their own unsafe, or shell out to SQL and pay the round-trip. Exposing a vetted safe wrapper lets the ecosystem build TOAST-aware tooling, custom storage layouts, compression-aware indexes.

Benefit

Real-world utility out of the box — pglz_inspect answers "should I compress this column?" with one query, lowering the barrier for DBAs evaluating PG14+'s per-column compression.

add example pglz_inspect
- scaffold extension and add pglz_size()
- add pglz_analyze_column() SRF
- add pglz_recommend() and finalize README
@isdaniel isdaniel force-pushed the feat/pglz-bindings-and-inspect branch 2 times, most recently from 135a8dd to 155a01a Compare June 18, 2026 08:05
refactor: update PGLZ usage to use module path for consistency
refactor: reorganize PGLZ module structure and move implementation to pglz_inspect
@isdaniel isdaniel force-pushed the feat/pglz-bindings-and-inspect branch from 155a01a to b85921a Compare June 19, 2026 00:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant