Add pgrust#983
Open
alexey-milovidov wants to merge 1 commit into
Open
Conversation
pgrust is a rewrite of PostgreSQL in Rust targeting Postgres 18.3 compatibility (https://github.com/malisper/pgrust). Runs from the official Docker image (malisper/pgrust:v0.1); schema and queries are identical to the postgresql entry. pgrust v0.1 has a COPY input-buffer bug that rejects valid UTF-8 when a 64 KiB buffer refill boundary splits a multi-byte character, so the load script splits the TSV into line-aligned <=64 KiB pieces and loads each with its own COPY statement. See pgrust/README.md. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Adds pgrust, a rewrite of PostgreSQL in Rust targeting compatibility with Postgres 18.3 (AGPL-3.0,
SELECT version()reportspgrust 18.3).Setup
malisper/pgrust:v0.1(pinned launch release, multi-arch amd64+arm64), which is a drop-in replacement for the officialpostgresimage. The container entrypoint applies the settings the upstream README requires (io_method=sync,max_stack_depth=60000, enlarged stack limits); no further tuning.create.sqlandqueries.sqlare copied verbatim from thepostgresqlentry.cedardbpattern (Docker daemon, hostpsql, PGDATA on a host mount sodata-sizeis aduincluding WAL). Uses the shared driver withBENCH_DURABLE=yes; true cold runs, so nolukewarm-cold-runtag. The concurrent QPS test is kept (process-per-connection daemon, like Postgres).Complication: pgrust v0.1 cannot COPY the dataset as-is
COPY hits FROM 'hits.tsv'fails withinvalid byte sequence for encoding "UTF8"even though the dataset is valid UTF-8 (verified byte-by-byte with iconv and Python). Root cause, isolated against both the Docker image and a source build:З(0xd0 0x97); an equal-size pure-ASCII file loads fine; any line-aligned input ≤ 64 KiB (a single buffer fill) always loads.\copyfails the same way (wire-chunk boundaries instead of file-read boundaries).COPY ... WITH (ENCODING 'SQL_ASCII')also fails — impossible for a verifier that accepts every byte — so the defect is in the buffer bookkeeping around refills, not in the encoding verifier proper.Workaround (documented in
pgrust/README.md):loadsplits the TSV into line-aligned ≤ 64 KiB pieces (split -C 64k; max row in the dataset is ~6 KB, so pieces never oversize) and loads each with its own COPY statement, single session, single transaction, with FREEZE, thenVACUUM ANALYZE. The data itself is not modified. Per-statement overhead measured at ~5-7 ms, which adds roughly an hour over a hypothetical single COPY for the ~1.2M pieces of the full dataset. A minimal reproducer and analysis are ready to be filed upstream.Validation performed (1M-row sample)
VACUUM ANALYZEand in-transactionTRUNCATE+COPY ... FREEZEwork.PG_VERSIONexists — so the driver's per-query cold cycles (container recreation) are safe./datamount,du-based data-size.Expected performance
pgrust's own README says v0.1 is "not performance optimized" (their unpublished next version claims ~300x faster analytics). Concretely:
{"error": "<issue url>"}result convention applies; larger machines have a better chance of completing.No results files yet — to be produced by
system=pgrust ./run-benchmark.shper machine.🤖 Generated with Claude Code