md5hash

md5hash

md5hash : type for storing 128-bit binary data inline

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
3550
md5hash
md5hash
1.0.1
TYPE
BSD 2-Clause
C
AttributeHas BinaryHas LibraryNeed LoadHas DDLRelocatableTrusted
--s-d-r
No
Yes
No
Yes
yes
no
Relationships
See Also
hashlib
xxhash
prefix
semver
unit
pgpdf
pglite_fusion
asn1oid

Packages

TypeRepoVersionPG Major CompatibilityPackage PatternDependencies
EXT
PIGSTY
1.0.1
18
17
16
15
14
md5hash-
RPM
PIGSTY
1.0.1
18
17
16
15
14
md5hash_$v-
DEB
PIGSTY
1.0.1
18
17
16
15
14
postgresql-$v-md5hash-
Linux / PGPG18PG17PG16PG15PG14
el8.x86_64
PIGSTY 1.0.1
PIGSTY 1.0.1
PIGSTY 1.0.1
PIGSTY 1.0.1
PIGSTY 1.0.1
el8.aarch64
PIGSTY 1.0.1
PIGSTY 1.0.1
PIGSTY 1.0.1
PIGSTY 1.0.1
PIGSTY 1.0.1
el9.x86_64
PIGSTY 1.0.1
PIGSTY 1.0.1
PIGSTY 1.0.1
PIGSTY 1.0.1
PIGSTY 1.0.1
el9.aarch64
PIGSTY 1.0.1
PIGSTY 1.0.1
PIGSTY 1.0.1
PIGSTY 1.0.1
PIGSTY 1.0.1
el10.x86_64
PIGSTY 1.0.1
PIGSTY 1.0.1
PIGSTY 1.0.1
PIGSTY 1.0.1
PIGSTY 1.0.1
el10.aarch64
PIGSTY 1.0.1
PIGSTY 1.0.1
PIGSTY 1.0.1
PIGSTY 1.0.1
PIGSTY 1.0.1
d12.x86_64
PIGSTY 1.0.1
PIGSTY 1.0.1
PIGSTY 1.0.1
PIGSTY 1.0.1
PIGSTY 1.0.1
d12.aarch64
PIGSTY 1.0.1
PIGSTY 1.0.1
PIGSTY 1.0.1
PIGSTY 1.0.1
PIGSTY 1.0.1
d13.x86_64
PIGSTY 1.0.1
PIGSTY 1.0.1
PIGSTY 1.0.1
PIGSTY 1.0.1
PIGSTY 1.0.1
d13.aarch64
PIGSTY 1.0.1
PIGSTY 1.0.1
PIGSTY 1.0.1
PIGSTY 1.0.1
PIGSTY 1.0.1
u22.x86_64
PIGSTY 1.0.1
PIGSTY 1.0.1
PIGSTY 1.0.1
PIGSTY 1.0.1
PIGSTY 1.0.1
u22.aarch64
PIGSTY 1.0.1
PIGSTY 1.0.1
PIGSTY 1.0.1
PIGSTY 1.0.1
PIGSTY 1.0.1
u24.x86_64
PIGSTY 1.0.1
PIGSTY 1.0.1
PIGSTY 1.0.1
PIGSTY 1.0.1
PIGSTY 1.0.1
u24.aarch64
PIGSTY 1.0.1
PIGSTY 1.0.1
PIGSTY 1.0.1
PIGSTY 1.0.1
PIGSTY 1.0.1

Source

pig build pkg md5hash;		# 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 md5hash;		# install via package name, for the active PG version

pig install md5hash -v 18;   # install for PG 18
pig install md5hash -v 17;   # install for PG 17
pig install md5hash -v 16;   # install for PG 16
pig install md5hash -v 15;   # install for PG 15
pig install md5hash -v 14;   # install for PG 14

Create this extension with:

CREATE EXTENSION md5hash;

Usage

md5hash: native MD5 hash data type for PostgreSQL

The md5hash extension provides an efficient 128-bit data type for storing MD5 hashes in binary format (16 bytes) instead of text (32+ bytes).

CREATE EXTENSION md5hash;

CREATE TABLE test_table (
    id md5hash PRIMARY KEY
);

INSERT INTO test_table VALUES ('c4ca4238a0b923820dcc509a6f75849b');

SELECT * FROM test_table
WHERE id = 'c4ca4238a0b923820dcc509a6f75849b';

Operators

Standard comparison operators are supported: =, <>, <, >, <=, >=.

Index Support

Btree index operator class is included, enabling efficient lookups and primary key constraints on md5hash columns.

Storage Benefits

Compared to storing MD5 as text, the md5hash type uses approximately 60% of the storage space and provides faster indexed lookups.

Last updated on