Highlights
New query parser
We rewrote the query parser to use our in-house library: https://github.com/pgdogdev/pg_raw_parse/. It's based on pg_query but maps Rust structs directly to the arena-allocated MemoryContext allocated by the Postgres parser. This brings our (de)ser cost for parsing queries to 0.
Early metrics:
- 2x improvement in parsing speed vs
query_parser_engine = "pg_query_raw" - 8x improvement in parsing speed vs
query_parser_engine = "pg_query_protobuf"(used by default, so most users will see this) - 90% (6x) reduction in memory usage (eliminates the OOM problems we've been having with large queries e.g., #854 #1061)
It's entirely generated using Rust build scripts directly from Postgres C code and allows us to do major version upgrades in one, 5 line PR. More on this soon on our blog.
How to use
The new parser is experimental and disabled by default. We are building a separate Docker image for each release / commit in main. To use it, just append -new-parser prefix to the tag, for example:
image:
tag: v0.1.49-new-parserby @sgrif
New plugin interface
The plugins system was rewritten to use safer primitives and simpler API. This is a breaking change. We ported all in-tree plugins to the new interface, so no impact on any plugins we currently ship with PgDog in the Docker image. If you wrote your own plugins, reach out to us and we'll help you fix them. New documentation coming soon.
by @sgrif
Changelog
- fix: skip multi-statement SET validation in session mode by @zefixlluja
- fix: add default to engine in
[[query_parsers]]by @levkk - fix:
include_primary_if_replica_bannedignored primary if it was the only candidate by @levkk @kzemek - fix: role detector deadlocked when new databases with
role = "auto"were added at runtime by @levkk - feat: allow
read_write_splitwhen parser is disabled to direct traffic by default @levkk - fix: query parser ran regex twice by @levkk
- test: disable copy_data retry_tests temporarily by @meskill
- fix(replication): fix
wait_for_replicationlogic for unrelated changes by @meskill - fix: LSN detector can now correctly identify replica-only deployments by @levkk
- fix: support
psycopg2(handleSETcommands) in admin DB by @levkk - feat(breaking): use a less horrendously unsafe FFI interface for plugins by @sgrif
- chore(config): save file content for
ConfigAndUsersfor diff handling in EE by @meskill - refactor: remove fingerprinting from our codebase by @sgrif
- feat: update the parser to support Postgres 18 by @sgrif
New Contributors
- @zefixlluja made their first contribution in #1157
Full Changelog: v0.1.48...v0.1.49