- SignalDesk18小时前
Original Summary
Hey HN!<p>We built a wrapper on top of the Postgres native SQL parser to allow us to parse and manipulate SQL in Rust.<p>Our library forks libpg_query [1] and its original Rust bindings, pg_query.rs [2]. By not using Protobuf and mapping our structs directly on top of the Postgres arena allocator, we are able to achieve a pretty massive speedup:<p>- 20-60x parse/deparse, depending on query size<p>- 90% memory utilization decrease vs pg_query.rs<p>This library is used in production in PgDog [3], but has no dependencies to it, so you can use it in your Rust apps without issues.<p>It also provides access to Postgres internals used to walk and transform query ASTs. Those are actually really cool. Check out the README for details, but we basically use a bunch of Rust macros to generate 100% compatible Rust structs directly from C headers.<p>This makes it really easy to upgrade major versions, i.e., we just bump the submodules and re-compile.<p>Let us know what you think!<p>- PgDog team<p>[1]: <a href="https://github.com/pganalyze/libpg_query" rel="nofollow">https://github.com/pganalyze/libpg_query</a><p>[2]: <a href="https://github.com/pganalyze/pg_query.rs" rel="nofollow">https://github.com/pganalyze/pg_query.rs</a><p>[3]: <a href="https://github.com/pgdogdev/pgdog" rel="nofollow">https://github.com/pgdogdev/pgdog</a>
- 情报分类:技术学习与提效
- 分类依据:内容涉及技术、AI、软件工具或工程实践
- 信息来源:Hacker News 新项目
- 发布时间:2026/9/18 23:13:18
- 暂无回复