Skip to content

xxhash

xxhash functions for PostgreSQL

pg_xxhash · xxhash functions for PostgreSQL

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
4430xxhashpg_xxhash0.0.1UTILMITC
AttributeHas BinaryHas LibraryNeed LoadHas DDLRelocatableTrusted
--s-d-rNoYesNoYesyesno

Packages

TypeRepoVersionPG Major CompatibilityPackage PatternDependencies
EXTPIGSTY0.0.119 18 17 16 15pg_xxhash-
RPMPIGSTY0.0.119 18 17 16 15pg_xxhash_$v-
DEBPIGSTY0.0.119 18 17 16 15postgresql-$v-pg-xxhash-
Linux / PGPG19PG18PG17PG16PG15
el8.x86_64N/APIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1
el8.aarch64N/APIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1
el9.x86_64PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1
el9.aarch64PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1
el10.x86_64PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1
el10.aarch64PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1
d12.x86_64PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1
d12.aarch64PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1
d13.x86_64PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1
d13.aarch64PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1
u22.x86_64PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1
u22.aarch64PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1
u24.x86_64PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1
u24.aarch64PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1
u26.x86_64PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1
u26.aarch64PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1PIGSTY 0.0.1
PackageVersionOSORGSIZEFile URL
pg_xxhash_190.0.1el9.x86_64pigsty72.4 KiBpg_xxhash_19-0.0.1-1PGSTY.el9.x86_64.rpm
pg_xxhash_190.0.1el9.aarch64pigsty77.8 KiBpg_xxhash_19-0.0.1-1PGSTY.el9.aarch64.rpm
pg_xxhash_190.0.1el10.x86_64pigsty72.5 KiBpg_xxhash_19-0.0.1-1PGSTY.el10.x86_64.rpm
pg_xxhash_190.0.1el10.aarch64pigsty78.2 KiBpg_xxhash_19-0.0.1-1PGSTY.el10.aarch64.rpm
postgresql-19-pg-xxhash0.0.1d12.x86_64pigsty69.4 KiBpostgresql-19-pg-xxhash_0.0.1-1PGSTY~bookworm_amd64.deb
postgresql-19-pg-xxhash0.0.1d12.aarch64pigsty73.1 KiBpostgresql-19-pg-xxhash_0.0.1-1PGSTY~bookworm_arm64.deb
postgresql-19-pg-xxhash0.0.1d13.x86_64pigsty69.3 KiBpostgresql-19-pg-xxhash_0.0.1-1PGSTY~trixie_amd64.deb
postgresql-19-pg-xxhash0.0.1d13.aarch64pigsty73.6 KiBpostgresql-19-pg-xxhash_0.0.1-1PGSTY~trixie_arm64.deb
postgresql-19-pg-xxhash0.0.1u22.x86_64pigsty75.5 KiBpostgresql-19-pg-xxhash_0.0.1-1PGSTY~jammy_amd64.deb
postgresql-19-pg-xxhash0.0.1u22.aarch64pigsty76.7 KiBpostgresql-19-pg-xxhash_0.0.1-1PGSTY~jammy_arm64.deb
postgresql-19-pg-xxhash0.0.1u24.x86_64pigsty62.9 KiBpostgresql-19-pg-xxhash_0.0.1-1PGSTY~noble_amd64.deb
postgresql-19-pg-xxhash0.0.1u24.aarch64pigsty67.5 KiBpostgresql-19-pg-xxhash_0.0.1-1PGSTY~noble_arm64.deb
postgresql-19-pg-xxhash0.0.1u26.x86_64pigsty63.7 KiBpostgresql-19-pg-xxhash_0.0.1-1PGSTY~resolute_amd64.deb
postgresql-19-pg-xxhash0.0.1u26.aarch64pigsty68.4 KiBpostgresql-19-pg-xxhash_0.0.1-1PGSTY~resolute_arm64.deb
PackageVersionOSORGSIZEFile URL
pg_xxhash_180.0.1el8.x86_64pigsty82.5 KiBpg_xxhash_18-0.0.1-1PGSTY.el8.x86_64.rpm
pg_xxhash_180.0.1el8.aarch64pigsty87.0 KiBpg_xxhash_18-0.0.1-1PGSTY.el8.aarch64.rpm
pg_xxhash_180.0.1el9.x86_64pigsty72.4 KiBpg_xxhash_18-0.0.1-1PGSTY.el9.x86_64.rpm
pg_xxhash_180.0.1el9.aarch64pigsty77.8 KiBpg_xxhash_18-0.0.1-1PGSTY.el9.aarch64.rpm
pg_xxhash_180.0.1el10.x86_64pigsty72.5 KiBpg_xxhash_18-0.0.1-1PGSTY.el10.x86_64.rpm
pg_xxhash_180.0.1el10.aarch64pigsty77.9 KiBpg_xxhash_18-0.0.1-1PGSTY.el10.aarch64.rpm
postgresql-18-pg-xxhash0.0.1d12.x86_64pigsty69.4 KiBpostgresql-18-pg-xxhash_0.0.1-1PGSTY~bookworm_amd64.deb
postgresql-18-pg-xxhash0.0.1d12.aarch64pigsty73.1 KiBpostgresql-18-pg-xxhash_0.0.1-1PGSTY~bookworm_arm64.deb
postgresql-18-pg-xxhash0.0.1d13.x86_64pigsty69.2 KiBpostgresql-18-pg-xxhash_0.0.1-1PGSTY~trixie_amd64.deb
postgresql-18-pg-xxhash0.0.1d13.aarch64pigsty73.6 KiBpostgresql-18-pg-xxhash_0.0.1-1PGSTY~trixie_arm64.deb
postgresql-18-pg-xxhash0.0.1u22.x86_64pigsty75.4 KiBpostgresql-18-pg-xxhash_0.0.1-1PGSTY~jammy_amd64.deb
postgresql-18-pg-xxhash0.0.1u22.aarch64pigsty76.7 KiBpostgresql-18-pg-xxhash_0.0.1-1PGSTY~jammy_arm64.deb
postgresql-18-pg-xxhash0.0.1u24.x86_64pigsty62.9 KiBpostgresql-18-pg-xxhash_0.0.1-1PGSTY~noble_amd64.deb
postgresql-18-pg-xxhash0.0.1u24.aarch64pigsty67.5 KiBpostgresql-18-pg-xxhash_0.0.1-1PGSTY~noble_arm64.deb
postgresql-18-pg-xxhash0.0.1u26.x86_64pigsty63.7 KiBpostgresql-18-pg-xxhash_0.0.1-1PGSTY~resolute_amd64.deb
postgresql-18-pg-xxhash0.0.1u26.aarch64pigsty68.4 KiBpostgresql-18-pg-xxhash_0.0.1-1PGSTY~resolute_arm64.deb
PackageVersionOSORGSIZEFile URL
pg_xxhash_170.0.1el8.x86_64pigsty82.4 KiBpg_xxhash_17-0.0.1-1PGSTY.el8.x86_64.rpm
pg_xxhash_170.0.1el8.aarch64pigsty86.8 KiBpg_xxhash_17-0.0.1-1PGSTY.el8.aarch64.rpm
pg_xxhash_170.0.1el9.x86_64pigsty72.0 KiBpg_xxhash_17-0.0.1-1PGSTY.el9.x86_64.rpm
pg_xxhash_170.0.1el9.aarch64pigsty77.8 KiBpg_xxhash_17-0.0.1-1PGSTY.el9.aarch64.rpm
pg_xxhash_170.0.1el10.x86_64pigsty72.5 KiBpg_xxhash_17-0.0.1-1PGSTY.el10.x86_64.rpm
pg_xxhash_170.0.1el10.aarch64pigsty77.7 KiBpg_xxhash_17-0.0.1-1PGSTY.el10.aarch64.rpm
postgresql-17-pg-xxhash0.0.1d12.x86_64pigsty69.2 KiBpostgresql-17-pg-xxhash_0.0.1-1PGSTY~bookworm_amd64.deb
postgresql-17-pg-xxhash0.0.1d12.aarch64pigsty73.1 KiBpostgresql-17-pg-xxhash_0.0.1-1PGSTY~bookworm_arm64.deb
postgresql-17-pg-xxhash0.0.1d13.x86_64pigsty69.2 KiBpostgresql-17-pg-xxhash_0.0.1-1PGSTY~trixie_amd64.deb
postgresql-17-pg-xxhash0.0.1d13.aarch64pigsty73.6 KiBpostgresql-17-pg-xxhash_0.0.1-1PGSTY~trixie_arm64.deb
postgresql-17-pg-xxhash0.0.1u22.x86_64pigsty77.0 KiBpostgresql-17-pg-xxhash_0.0.1-1PGSTY~jammy_amd64.deb
postgresql-17-pg-xxhash0.0.1u22.aarch64pigsty78.8 KiBpostgresql-17-pg-xxhash_0.0.1-1PGSTY~jammy_arm64.deb
postgresql-17-pg-xxhash0.0.1u24.x86_64pigsty62.9 KiBpostgresql-17-pg-xxhash_0.0.1-1PGSTY~noble_amd64.deb
postgresql-17-pg-xxhash0.0.1u24.aarch64pigsty67.5 KiBpostgresql-17-pg-xxhash_0.0.1-1PGSTY~noble_arm64.deb
postgresql-17-pg-xxhash0.0.1u26.x86_64pigsty63.7 KiBpostgresql-17-pg-xxhash_0.0.1-1PGSTY~resolute_amd64.deb
postgresql-17-pg-xxhash0.0.1u26.aarch64pigsty68.4 KiBpostgresql-17-pg-xxhash_0.0.1-1PGSTY~resolute_arm64.deb
PackageVersionOSORGSIZEFile URL
pg_xxhash_160.0.1el8.x86_64pigsty82.4 KiBpg_xxhash_16-0.0.1-1PGSTY.el8.x86_64.rpm
pg_xxhash_160.0.1el8.aarch64pigsty86.8 KiBpg_xxhash_16-0.0.1-1PGSTY.el8.aarch64.rpm
pg_xxhash_160.0.1el9.x86_64pigsty72.0 KiBpg_xxhash_16-0.0.1-1PGSTY.el9.x86_64.rpm
pg_xxhash_160.0.1el9.aarch64pigsty77.8 KiBpg_xxhash_16-0.0.1-1PGSTY.el9.aarch64.rpm
pg_xxhash_160.0.1el10.x86_64pigsty72.5 KiBpg_xxhash_16-0.0.1-1PGSTY.el10.x86_64.rpm
pg_xxhash_160.0.1el10.aarch64pigsty77.7 KiBpg_xxhash_16-0.0.1-1PGSTY.el10.aarch64.rpm
postgresql-16-pg-xxhash0.0.1d12.x86_64pigsty69.3 KiBpostgresql-16-pg-xxhash_0.0.1-1PGSTY~bookworm_amd64.deb
postgresql-16-pg-xxhash0.0.1d12.aarch64pigsty73.1 KiBpostgresql-16-pg-xxhash_0.0.1-1PGSTY~bookworm_arm64.deb
postgresql-16-pg-xxhash0.0.1d13.x86_64pigsty69.3 KiBpostgresql-16-pg-xxhash_0.0.1-1PGSTY~trixie_amd64.deb
postgresql-16-pg-xxhash0.0.1d13.aarch64pigsty73.6 KiBpostgresql-16-pg-xxhash_0.0.1-1PGSTY~trixie_arm64.deb
postgresql-16-pg-xxhash0.0.1u22.x86_64pigsty77.0 KiBpostgresql-16-pg-xxhash_0.0.1-1PGSTY~jammy_amd64.deb
postgresql-16-pg-xxhash0.0.1u22.aarch64pigsty78.8 KiBpostgresql-16-pg-xxhash_0.0.1-1PGSTY~jammy_arm64.deb
postgresql-16-pg-xxhash0.0.1u24.x86_64pigsty62.9 KiBpostgresql-16-pg-xxhash_0.0.1-1PGSTY~noble_amd64.deb
postgresql-16-pg-xxhash0.0.1u24.aarch64pigsty67.5 KiBpostgresql-16-pg-xxhash_0.0.1-1PGSTY~noble_arm64.deb
postgresql-16-pg-xxhash0.0.1u26.x86_64pigsty63.7 KiBpostgresql-16-pg-xxhash_0.0.1-1PGSTY~resolute_amd64.deb
postgresql-16-pg-xxhash0.0.1u26.aarch64pigsty68.4 KiBpostgresql-16-pg-xxhash_0.0.1-1PGSTY~resolute_arm64.deb
PackageVersionOSORGSIZEFile URL
pg_xxhash_150.0.1el8.x86_64pigsty83.1 KiBpg_xxhash_15-0.0.1-1PGSTY.el8.x86_64.rpm
pg_xxhash_150.0.1el8.aarch64pigsty87.4 KiBpg_xxhash_15-0.0.1-1PGSTY.el8.aarch64.rpm
pg_xxhash_150.0.1el9.x86_64pigsty82.7 KiBpg_xxhash_15-0.0.1-1PGSTY.el9.x86_64.rpm
pg_xxhash_150.0.1el9.aarch64pigsty89.1 KiBpg_xxhash_15-0.0.1-1PGSTY.el9.aarch64.rpm
pg_xxhash_150.0.1el10.x86_64pigsty84.3 KiBpg_xxhash_15-0.0.1-1PGSTY.el10.x86_64.rpm
pg_xxhash_150.0.1el10.aarch64pigsty89.5 KiBpg_xxhash_15-0.0.1-1PGSTY.el10.aarch64.rpm
postgresql-15-pg-xxhash0.0.1d12.x86_64pigsty70.0 KiBpostgresql-15-pg-xxhash_0.0.1-1PGSTY~bookworm_amd64.deb
postgresql-15-pg-xxhash0.0.1d12.aarch64pigsty73.9 KiBpostgresql-15-pg-xxhash_0.0.1-1PGSTY~bookworm_arm64.deb
postgresql-15-pg-xxhash0.0.1d13.x86_64pigsty70.0 KiBpostgresql-15-pg-xxhash_0.0.1-1PGSTY~trixie_amd64.deb
postgresql-15-pg-xxhash0.0.1d13.aarch64pigsty74.4 KiBpostgresql-15-pg-xxhash_0.0.1-1PGSTY~trixie_arm64.deb
postgresql-15-pg-xxhash0.0.1u22.x86_64pigsty87.0 KiBpostgresql-15-pg-xxhash_0.0.1-1PGSTY~jammy_amd64.deb
postgresql-15-pg-xxhash0.0.1u22.aarch64pigsty89.8 KiBpostgresql-15-pg-xxhash_0.0.1-1PGSTY~jammy_arm64.deb
postgresql-15-pg-xxhash0.0.1u24.x86_64pigsty73.5 KiBpostgresql-15-pg-xxhash_0.0.1-1PGSTY~noble_amd64.deb
postgresql-15-pg-xxhash0.0.1u24.aarch64pigsty78.4 KiBpostgresql-15-pg-xxhash_0.0.1-1PGSTY~noble_arm64.deb
postgresql-15-pg-xxhash0.0.1u26.x86_64pigsty74.9 KiBpostgresql-15-pg-xxhash_0.0.1-1PGSTY~resolute_amd64.deb
postgresql-15-pg-xxhash0.0.1u26.aarch64pigsty79.2 KiBpostgresql-15-pg-xxhash_0.0.1-1PGSTY~resolute_arm64.deb

Source

pig build pkg pg_xxhash;		# build rpm/deb

Install

Make sure PGDG and PIGSTY repo available:

pig repo add pgsql -u   # add both repo and update cache

Install this extension with pig:

pig install pg_xxhash;		# install by package name
pig install xxhash;		# install by extension name

pig install xxhash -v 19;   # install for PG 19
pig install xxhash -v 18;   # install for PG 18
pig install xxhash -v 17;   # install for PG 17
pig install xxhash -v 16;   # install for PG 16
pig install xxhash -v 15;   # install for PG 15

Create this extension with:

CREATE EXTENSION xxhash;

Usage

Sources:

This documents upstream source version 0.1.0; a published 0.1.0 release was not found in this review, and the catalog’s available packages remain at 0.0.1. The extension supports PostgreSQL 14–19, is relocatable, requires a superuser to enable, and needs no preload or restart.

CREATE EXTENSION xxhash;
SELECT xxh32('https://example.com'::text);
SELECT xxh3_64('foo'::text, 42);
SELECT encode(xxh3_64b(decode('00ff10', 'hex')), 'hex');
SELECT xxh3_128_secret('foo'::text, repeat('s', 136)::bytea);

Functions and representation

The four variants are xxh32, xxh64, xxh3_64, and xxh3_128; xxh128 aliases the last. Each accepts text or bytea, with an optional bigint seed. Text is hashed as bytes in the server encoding; bytea preserves arbitrary binary input including NUL bytes. Unseeded calls use seed 0.

Names without a b suffix return lowercase hexadecimal text of 8, 16, 16, or 32 characters respectively. xxh32b, xxh64b, xxh3_64b, xxh3_128b, and alias xxh128b return canonical big-endian bytea values. Every function is immutable, strict and parallel safe.

XXH32 seeds must be 0–4294967295. Other variants accept any bigint; negative values represent a two’s-complement 64-bit seed. xxh3_64_secret, xxh3_64b_secret, xxh3_128_secret, and xxh3_128b_secret accept a caller-supplied secret of at least 136 bytes, independently of seed-based hashing. Shorter secrets and out-of-range XXH32 seeds raise errors.

Upgrade and limits

After the 0.1.0 library and SQL files are installed, the supplied chain upgrades 0.0.1 through 0.0.2 to 0.1.0. This source version fixes a per-call memory leak and noncanonical 128-bit binary output on big-endian systems. Review stored hash values and dependent indexes when moving from an affected build. It also removes the bundled GPL helper header; the extension code remains MIT and the bundled xxHash library BSD-2-Clause.

ALTER EXTENSION xxhash UPDATE TO '0.1.0';

xxHash is noncryptographic. Seeds and secrets do not make it suitable for password storage, signatures, or adversarial integrity checks.

Table reader