Amazon Relational Database Service (Amazon RDS) for PostgreSQL now supports trusted PL/Rust, allowing developers to safely build high-performance data

Build high-performance functions in Rust on Amazon RDS for PostgreSQL

submited by
Style Pass
2023-05-23 23:30:03

Amazon Relational Database Service (Amazon RDS) for PostgreSQL now supports trusted PL/Rust, allowing developers to safely build high-performance database functions in the Rust programming language. PL/Rust is an open-source project that lets you write Rust code that runs directly inside a PostgreSQL database, and provides support for PostgreSQL features such as running queries, writing trigger functions, and logging output. You can also use PL/Rust to build Trusted Language Extensions for PostgreSQL with performance benefits that are comparable to writing code in C without the risk of unsafe memory access. For more information on how PL/Rust works, see the PL/Rust Guide.

Stored procedures in databases help developers build code that can perform calculations on data and reduce latency to the application, apply follow-up actions on data modifications, and simplify data visualization. PostgreSQL gives developers choices in what programming languages you can use through its procedural language system, and the open-source community maintains a wiki page that lists available procedural languages. PostgreSQL designates languages as “trusted” or “untrusted,” where a “trusted” language is safe for an unprivileged user to use without risk of privilege escalation. The property of being a “trusted” programming language in PostgreSQL makes it possible to build Trusted Language Extensions for PostgreSQL, using the open-source pg_tle project, and safely run them in production systems.

In addition to PL/Rust, Amazon RDS for PostgreSQL supports several trusted programming languages, including PL/pgSQL, PL/Perl, PL/v8 (JavaScript), and PL/Tcl. Each programming language has benefits, and choosing a language may come down to what problem you’re solving or your familiarity with the programming language. For example, PL/pgSQL, PostgreSQL’s native procedural language, is convenient for writing trigger functions and multi-step procedures that may interface with built-in PostgreSQL functions. Also, all of these languages are interpreted, which means that there may be performance overhead when executing functions written in these languages.

Leave a Comment