feat: expose PGLZ compression bindings + add pglz_inspect example #2326
Open
isdaniel wants to merge 2 commits into
Open
feat: expose PGLZ compression bindings + add pglz_inspect example #2326isdaniel wants to merge 2 commits into
isdaniel wants to merge 2 commits into
Conversation
add example pglz_inspect - scaffold extension and add pglz_size() - add pglz_analyze_column() SRF - add pglz_recommend() and finalize README
135a8dd to
155a01a
Compare
refactor: update PGLZ usage to use module path for consistency refactor: reorganize PGLZ module structure and move implementation to pglz_inspect
155a01a to
b85921a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.