PostgreSQL Multiple Precision Arithmetic¶
pgmp is a PostgreSQL extension to add the GMP data types and functions directly into the database.
The extension adds the types mpz
(arbitrary size integers) and mpq
(arbitrary precision rationals) to PostgreSQL and exposes to the database all
the functions available in the GMP library for these data types, allowing:
higher performance arithmetic on integers respect to the
numeric
data typea rational data type for absolute precision storage and arithmetic
using specialized functions to deal with prime numbers, random numbers, factorization directly into the database.
Here you can find a more detailed list of goals for this extension.
See the performance page for comparison tests between GMP data types and PostgreSQL builtins.
[Ab]using PostgreSQL to calculate pi, a pgmp demo showing how to generate millions of digits of \(\pi\) using PL/pgSQL and Python to run concurrent backends.
The library is released under LGPL License.
References¶
Homepage: https://www.varrazzo.com/pgmp/
Project page: https://github.com/dvarrazzo/pgmp/
Download: https://pgxn.org/dist/pgmp/