{"slug": "show-hn-uplpgsql-pl-pgsql-compiled-to-native-code", "title": "Show HN: uplpgsql – PL/pgSQL compiled to native code", "summary": "A new open-source compiler, uplpgsql, compiles PL/pgSQL stored procedures to native code using LLVM JIT, achieving 2-4x speedups on ordinary procedures and up to 22x on heavy numerical work. Developed by Joshua Drake and the original author, it is Apache-licensed and available for PostgreSQL 20devel, though still in super-pre-alpha stage.", "body_md": "uplpgsql compiles PL/pgSQL to native code. It took over twenty years to get here, but here it is.\n\nOn July 19, 2005, I demoed my optimizing PL/SQL compiler to Andy Astor, Denis Lussier, and Jim Mlodgenski at EnterpriseDB; PL/SQL packages, procedures, and functions ran on Postgres at native speed, not interpreted. While they didn't acquire it, they brought me on as a founding engineer focused on Oracle Database compatibility and performance.\n\nThen, on November 20, 2014, long after we'd both left, Denis suggested I make it a universal PL compiler that didn't care which dialect it was handed, with front-ends for PL/pgSQL, PL/SQL, SQL/PSM, and T-SQL. \"Build it on top of your compiler,\" he said, \"and call it the Universal Procedural Language.\" I did, but I kept it closed.\n\nuplpgsql is the modern PL/pgSQL version of that compiler, built using AI-assisted analysis and reconstruction of my prior work, now JIT-based and Apache licensed.\n\nWhy? Because normal PL/pgSQL is a tree-walking interpreter: every IF, every loop iteration, every assignment costs a switch dispatch and call through exec_stmt. Postgres' built-in JIT doesn't help. uplpgsql compiles the control flow itself to native code through its own LLJIT instance. It has multi-tiered optimizations from truly native to direct Postgres function calls to helpers to an interpreted worst case. Postgres doesn't even need to be built --with-llvm.\n\nIndependent benchmarks show 2-4x on ordinary stored procedures and up to 22x on heavy procedural and numerical work. Some functions are currently slower than interpreted; we're working on those regressions.\n\nSuper-pre-alpha WIP. Building against 20devel. Keep it away from anything and everything you care about. It's under heavy development by Joshua Drake (JD) of Command Prompt and me, with several other Postgres companies joining the effort.\n\nStill want to play with it? Build and use LANGUAGE uplpgsql instead of plpgsql. Docker coming soon.\n\nComments URL: [https://news.ycombinator.com/item?id=48932582](https://news.ycombinator.com/item?id=48932582)\n\nPoints: 1\n\n# Comments: 0", "url": "https://wpnews.pro/news/show-hn-uplpgsql-pl-pgsql-compiled-to-native-code", "canonical_source": "https://github.com/nextgres/uplpgsql", "published_at": "2026-07-16 10:19:33+00:00", "updated_at": "2026-07-16 10:24:56.869271+00:00", "lang": "en", "topics": ["developer-tools", "ai-infrastructure"], "entities": ["EnterpriseDB", "Command Prompt", "Joshua Drake", "PostgreSQL", "LLVM"], "alternates": {"html": "https://wpnews.pro/news/show-hn-uplpgsql-pl-pgsql-compiled-to-native-code", "markdown": "https://wpnews.pro/news/show-hn-uplpgsql-pl-pgsql-compiled-to-native-code.md", "text": "https://wpnews.pro/news/show-hn-uplpgsql-pl-pgsql-compiled-to-native-code.txt", "jsonld": "https://wpnews.pro/news/show-hn-uplpgsql-pl-pgsql-compiled-to-native-code.jsonld"}}