Fearless Extension Development With Rust and PGRX
summary
Rust bindings (pgrx) let extensions call the Postgres C API safely, compile to native shared libraries, and run against Postgres 12–17 using the cargo-pgx tool which downloads PG binaries, runs instances, runs unit tests and creates deployable tarballs via cargo PGX package. Claims: near-C throughput with a modest FFI overhead (benchmarks show ~50% worst‑case overhead on tiny ops), panics convert to SQL errors not crashes (no segfaults). Used in production by TimeScale, Supabase, AWS, Microsoft; some teams report ~5× faster development and thousands of lines ported with extensive tests. Missing: some index/table access hooks still incomplete.
AI-written summary · about
chapters (20)
- 0:00Introduction
- 1:09What is Rust
- 3:37What is PGX
- 5:50History of Rust in PostgreSQL
- 8:37Benefits of PGX
- 10:00PGX Features Overview
- 14:13Simple PGX Function Demo
- 15:16Why Not Just Use C
- 16:42Developer Perspectives
- 18:07Community Feedback
- 20:42Setting Up PGX Environment
- 21:47Creating a New Extension
- 22:51Running and Testing Extensions
- 25:20Building Aggregate Functions
- 26:53Performance Comparison
- 28:38Background Worker Example
- 31:51Custom Type Implementation
- 34:39Parallel Processing with Rayon
- 35:43Future of PGX and PostgreSQL
- 39:19Q&A Session
related talks
26mCan We Use Rust to Develop Extensions for PostgreSQL?
39mDeveloping a Postgres Extension in Rust
26mState of the Postgres Extension Ecosystem
40mPerformance is a feature: accelerating Postgres
28mBeyond Postgres: Insights about the PostgreSQL Extensibility
31mPostgres without SQL: Natural language queries using GPT-3 & Rust
21mExtending the horizons of R with Rust
43mBlazingly Fast Message Queue on Postgres with Rust
