rum

RUM index access method

Overview

PackageVersionCategoryLicenseLanguage
rum1.3.15FEATPostgreSQLC
IDExtensionBinLibLoadCreateTrustRelocSchema
2720rumNoYesNoYesNoYes-
Relatedpg_trgm btree_gist btree_gin pg_search pgroonga pg_bigm zhparser pgroonga_database
Depended Bydocumentdb

1.3.15 build pass on pg 16,17,18

Version

TypeRepoVersionPG VerPackageDeps
EXTMIXED1.3.151817161514rum-
RPMPIGSTY1.3.151817161514rum_$v-
DEBPGDG1.3.151817161514postgresql-$v-rum-
OS / PGPG18PG17PG16PG15PG14
el8.x86_64
el8.aarch64
el9.x86_64
el9.aarch64
el10.x86_64
el10.aarch64
d12.x86_64
d12.aarch64
PGDG 1.3.15
PGDG 1.3.15
PGDG 1.3.15
PGDG 1.3.15
PGDG 1.3.15
d13.x86_64
d13.aarch64
PGDG 1.3.15
PGDG 1.3.15
PGDG 1.3.15
PGDG 1.3.15
PGDG 1.3.15
u22.x86_64
u22.aarch64
u24.x86_64
u24.aarch64

Build

You can build the RPM packages for rum using pig build:

pig build pkg rum         # build RPM packages

Install

You can install rum directly. First, make sure the PGDG and PIGSTY repositories are added and enabled:

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

Install the extension using pig or apt/yum/dnf:

pig install rum;          # Install for current active PG version
pig ext install -y rum -v 18  # PG 18
pig ext install -y rum -v 17  # PG 17
pig ext install -y rum -v 16  # PG 16
pig ext install -y rum -v 15  # PG 15
pig ext install -y rum -v 14  # PG 14
dnf install -y rum_18       # PG 18
dnf install -y rum_17       # PG 17
dnf install -y rum_16       # PG 16
dnf install -y rum_15       # PG 15
dnf install -y rum_14       # PG 14
apt install -y postgresql-18-rum   # PG 18
apt install -y postgresql-17-rum   # PG 17
apt install -y postgresql-16-rum   # PG 16
apt install -y postgresql-15-rum   # PG 15
apt install -y postgresql-14-rum   # PG 14

Create Extension:

CREATE EXTENSION rum;

Usage

rum: RUM index access method

RUM is an index access method that extends GIN by storing additional information in the posting tree. This enables direct access to positional data, avoiding extra heap scans for ranking, phrase searches, and timestamp ordering.

Index Creation

CREATE INDEX idx ON table_name USING rum (column operator_class);

With addon operators (e.g., ordering by a timestamp alongside full-text search):

CREATE INDEX tsts_idx ON tsts USING rum (t rum_tsvector_addon_ops, d)
    WITH (attach = 'd', to = 't');

Operator Classes

Operator ClassDescription
rum_tsvector_opsStores tsvector lexemes with positions. Supports <=> ordering and prefix search.
rum_tsvector_hash_opsStores hashed tsvector lexemes with positions. Supports <=> ordering, no prefix search.
rum_tsvector_addon_opsCombines tsvector with additional fields (timestamps, integers, etc.) for filtering and ordering.
rum_tsvector_hash_addon_opsHashed variant supporting addon fields, no prefix search.
rum_tsquery_opsStores tsquery branches for fast query matching against indexed documents.
rum_anyarray_opsIndexes array types. Supports &&, @>, <@, =, % and <=> ordering.
rum_anyarray_addon_opsCombines array elements with additional fields.
rum_TYPE_opsGeneric ops for int2, int4, int8, float4, float8, money, oid, time, timetz, date, interval, macaddr, inet, cidr, text, varchar, char, bytea, bit, varbit, numeric, timestamp, timestamptz.

Ordering Operators

OperatorDescription
<=>Distance operator for tsvector, timestamp, numeric types, arrays
<=|Left-side distance for timestamp, int, float, money, oid
|=>Right-side distance for timestamp, int, float, money, oid

Examples

Full-text search with ranking:

SELECT t, a <=> to_tsquery('english', 'beautiful | place') AS rank
FROM test_rum
WHERE a @@ to_tsquery('english', 'beautiful | place')
ORDER BY a <=> to_tsquery('english', 'beautiful | place');

Timestamp-ordered full-text search:

SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tsts
WHERE t @@ 'wr&qh'
ORDER BY d <=> '2016-05-16 14:21:25'
LIMIT 5;

Array matching with distance ordering:

SELECT * FROM test_array
WHERE i && '{1}'
ORDER BY i <=> '{1}' ASC;

Last Modified 2026-03-12: add pg extension catalog (95749bf)