PostgreSQL GMP bindings

Daniele Varrazzo daniele.varrazzo at
Wed Mar 16 01:17:56 CET 2011


I've recently started the pgmp project: a PostgreSQL extension to add
support for the GMP data types directly into the database.

For people who don't know it, PostgreSQL is an extremely extensible
database, and it is relatively easy to add custom data types,
functions (including aggregation functions) and operators. GMP data
types can (rather obviously) be stored in the database and also used
in indexes. Fetching values is extremely fast as the limbs are stored
on the disk with the same layout they have in memory, so read-only
values can be obtained just populating the mpz_t structure on the
stack, pointing into the pages mapped from the disk by the database,
without further mallocs.

The project is just started: I've wrapped many mpz operators and have
preliminary disk I/O for mpz and mpq (the very next step will be to
give it a final form). The initial goal is to support everything the
GMP exposes for mpz and mpq. About mpf, I will probably follow the
advise in the GMP homepage and wrap the mpfr library instead, but this
will happen later.

The project includes tests and documentation. A micro-framework for
benchmarks is also included. Everything is released under LGPL
license. I think it could be an interesting project for university
students. Collaboration in any form is welcome.

Further references can be found in the project homepage:


-- Daniele

More information about the gmp-discuss mailing list