parray_gin

parray_gin

parray_gin : GIN index operator class and partial-match operators for text arrays

Overview

ID Extension Package Version Category License Language
4860
parray_gin
parray_gin
1.4.0
FUNC
PostgreSQL
C
Attribute Has Binary Has Library Need Load Has DDL Relocatable Trusted
--s-d-r
No
Yes
No
Yes
yes
no
Relationships
See Also
intarray
btree_gin
btree_gist
pg_trgm
smlar
aggs_for_arrays
aggs_for_vecs
arraymath

PGXN dist name and PostgreSQL extension name are both parray_gin; Pigsty packages are built for PG 14-18.

Packages

Type Repo Version PG Major Compatibility Package Pattern Dependencies
EXT
PIGSTY
1.4.0
18
17
16
15
14
parray_gin -
RPM
PIGSTY
1.4.0
18
17
16
15
14
parray_gin_$v -
DEB
PIGSTY
1.4.0
18
17
16
15
14
postgresql-$v-parray-gin -
Linux / PG PG18 PG17 PG16 PG15 PG14
el8.x86_64
PIGSTY 1.4.0
PIGSTY 1.4.0
PIGSTY 1.4.0
PIGSTY 1.4.0
PIGSTY 1.4.0
el8.aarch64
PIGSTY 1.4.0
PIGSTY 1.4.0
PIGSTY 1.4.0
PIGSTY 1.4.0
PIGSTY 1.4.0
el9.x86_64
PIGSTY 1.4.0
PIGSTY 1.4.0
PIGSTY 1.4.0
PIGSTY 1.4.0
PIGSTY 1.4.0
el9.aarch64
PIGSTY 1.4.0
PIGSTY 1.4.0
PIGSTY 1.4.0
PIGSTY 1.4.0
PIGSTY 1.4.0
el10.x86_64
PIGSTY 1.4.0
PIGSTY 1.4.0
PIGSTY 1.4.0
PIGSTY 1.4.0
PIGSTY 1.4.0
el10.aarch64
PIGSTY 1.4.0
PIGSTY 1.4.0
PIGSTY 1.4.0
PIGSTY 1.4.0
PIGSTY 1.4.0
d12.x86_64
PIGSTY 1.4.0
PIGSTY 1.4.0
PIGSTY 1.4.0
PIGSTY 1.4.0
PIGSTY 1.4.0
d12.aarch64
PIGSTY 1.4.0
PIGSTY 1.4.0
PIGSTY 1.4.0
PIGSTY 1.4.0
PIGSTY 1.4.0
d13.x86_64
PIGSTY 1.4.0
PIGSTY 1.4.0
PIGSTY 1.4.0
PIGSTY 1.4.0
PIGSTY 1.4.0
d13.aarch64
PIGSTY 1.4.0
PIGSTY 1.4.0
PIGSTY 1.4.0
PIGSTY 1.4.0
PIGSTY 1.4.0
u22.x86_64
PIGSTY 1.4.0
PIGSTY 1.4.0
PIGSTY 1.4.0
PIGSTY 1.4.0
PIGSTY 1.4.0
u22.aarch64
PIGSTY 1.4.0
PIGSTY 1.4.0
PIGSTY 1.4.0
PIGSTY 1.4.0
PIGSTY 1.4.0
u24.x86_64
PIGSTY 1.4.0
PIGSTY 1.4.0
PIGSTY 1.4.0
PIGSTY 1.4.0
PIGSTY 1.4.0
u24.aarch64
PIGSTY 1.4.0
PIGSTY 1.4.0
PIGSTY 1.4.0
PIGSTY 1.4.0
PIGSTY 1.4.0
Package Version OS ORG SIZE File URL
parray_gin_18 1.4.0 el8.x86_64 pigsty 22.7 KiB parray_gin_18-1.4.0-1PIGSTY.el8.x86_64.rpm
parray_gin_18 1.4.0 el8.aarch64 pigsty 22.4 KiB parray_gin_18-1.4.0-1PIGSTY.el8.aarch64.rpm
parray_gin_18 1.4.0 el9.x86_64 pigsty 22.0 KiB parray_gin_18-1.4.0-1PIGSTY.el9.x86_64.rpm
parray_gin_18 1.4.0 el9.aarch64 pigsty 21.8 KiB parray_gin_18-1.4.0-1PIGSTY.el9.aarch64.rpm
parray_gin_18 1.4.0 el10.x86_64 pigsty 22.2 KiB parray_gin_18-1.4.0-1PIGSTY.el10.x86_64.rpm
parray_gin_18 1.4.0 el10.aarch64 pigsty 22.1 KiB parray_gin_18-1.4.0-1PIGSTY.el10.aarch64.rpm
postgresql-18-parray-gin 1.4.0 d12.x86_64 pigsty 30.1 KiB postgresql-18-parray-gin_1.4.0-1PIGSTY~bookworm_amd64.deb
postgresql-18-parray-gin 1.4.0 d12.aarch64 pigsty 30.0 KiB postgresql-18-parray-gin_1.4.0-1PIGSTY~bookworm_arm64.deb
postgresql-18-parray-gin 1.4.0 d13.x86_64 pigsty 30.3 KiB postgresql-18-parray-gin_1.4.0-1PIGSTY~trixie_amd64.deb
postgresql-18-parray-gin 1.4.0 d13.aarch64 pigsty 30.2 KiB postgresql-18-parray-gin_1.4.0-1PIGSTY~trixie_arm64.deb
postgresql-18-parray-gin 1.4.0 u22.x86_64 pigsty 31.5 KiB postgresql-18-parray-gin_1.4.0-1PIGSTY~jammy_amd64.deb
postgresql-18-parray-gin 1.4.0 u22.aarch64 pigsty 31.0 KiB postgresql-18-parray-gin_1.4.0-1PIGSTY~jammy_arm64.deb
postgresql-18-parray-gin 1.4.0 u24.x86_64 pigsty 31.0 KiB postgresql-18-parray-gin_1.4.0-1PIGSTY~noble_amd64.deb
postgresql-18-parray-gin 1.4.0 u24.aarch64 pigsty 31.3 KiB postgresql-18-parray-gin_1.4.0-1PIGSTY~noble_arm64.deb
Package Version OS ORG SIZE File URL
parray_gin_17 1.4.0 el8.x86_64 pigsty 22.7 KiB parray_gin_17-1.4.0-1PIGSTY.el8.x86_64.rpm
parray_gin_17 1.4.0 el8.aarch64 pigsty 22.5 KiB parray_gin_17-1.4.0-1PIGSTY.el8.aarch64.rpm
parray_gin_17 1.4.0 el9.x86_64 pigsty 22.0 KiB parray_gin_17-1.4.0-1PIGSTY.el9.x86_64.rpm
parray_gin_17 1.4.0 el9.aarch64 pigsty 21.8 KiB parray_gin_17-1.4.0-1PIGSTY.el9.aarch64.rpm
parray_gin_17 1.4.0 el10.x86_64 pigsty 22.2 KiB parray_gin_17-1.4.0-1PIGSTY.el10.x86_64.rpm
parray_gin_17 1.4.0 el10.aarch64 pigsty 22.2 KiB parray_gin_17-1.4.0-1PIGSTY.el10.aarch64.rpm
postgresql-17-parray-gin 1.4.0 d12.x86_64 pigsty 30.3 KiB postgresql-17-parray-gin_1.4.0-1PIGSTY~bookworm_amd64.deb
postgresql-17-parray-gin 1.4.0 d12.aarch64 pigsty 30.1 KiB postgresql-17-parray-gin_1.4.0-1PIGSTY~bookworm_arm64.deb
postgresql-17-parray-gin 1.4.0 d13.x86_64 pigsty 30.4 KiB postgresql-17-parray-gin_1.4.0-1PIGSTY~trixie_amd64.deb
postgresql-17-parray-gin 1.4.0 d13.aarch64 pigsty 30.3 KiB postgresql-17-parray-gin_1.4.0-1PIGSTY~trixie_arm64.deb
postgresql-17-parray-gin 1.4.0 u22.x86_64 pigsty 32.7 KiB postgresql-17-parray-gin_1.4.0-1PIGSTY~jammy_amd64.deb
postgresql-17-parray-gin 1.4.0 u22.aarch64 pigsty 32.2 KiB postgresql-17-parray-gin_1.4.0-1PIGSTY~jammy_arm64.deb
postgresql-17-parray-gin 1.4.0 u24.x86_64 pigsty 31.1 KiB postgresql-17-parray-gin_1.4.0-1PIGSTY~noble_amd64.deb
postgresql-17-parray-gin 1.4.0 u24.aarch64 pigsty 31.5 KiB postgresql-17-parray-gin_1.4.0-1PIGSTY~noble_arm64.deb
Package Version OS ORG SIZE File URL
parray_gin_16 1.4.0 el8.x86_64 pigsty 22.7 KiB parray_gin_16-1.4.0-1PIGSTY.el8.x86_64.rpm
parray_gin_16 1.4.0 el8.aarch64 pigsty 22.5 KiB parray_gin_16-1.4.0-1PIGSTY.el8.aarch64.rpm
parray_gin_16 1.4.0 el9.x86_64 pigsty 22.0 KiB parray_gin_16-1.4.0-1PIGSTY.el9.x86_64.rpm
parray_gin_16 1.4.0 el9.aarch64 pigsty 21.8 KiB parray_gin_16-1.4.0-1PIGSTY.el9.aarch64.rpm
parray_gin_16 1.4.0 el10.x86_64 pigsty 22.2 KiB parray_gin_16-1.4.0-1PIGSTY.el10.x86_64.rpm
parray_gin_16 1.4.0 el10.aarch64 pigsty 22.2 KiB parray_gin_16-1.4.0-1PIGSTY.el10.aarch64.rpm
postgresql-16-parray-gin 1.4.0 d12.x86_64 pigsty 30.3 KiB postgresql-16-parray-gin_1.4.0-1PIGSTY~bookworm_amd64.deb
postgresql-16-parray-gin 1.4.0 d12.aarch64 pigsty 30.1 KiB postgresql-16-parray-gin_1.4.0-1PIGSTY~bookworm_arm64.deb
postgresql-16-parray-gin 1.4.0 d13.x86_64 pigsty 30.3 KiB postgresql-16-parray-gin_1.4.0-1PIGSTY~trixie_amd64.deb
postgresql-16-parray-gin 1.4.0 d13.aarch64 pigsty 30.4 KiB postgresql-16-parray-gin_1.4.0-1PIGSTY~trixie_arm64.deb
postgresql-16-parray-gin 1.4.0 u22.x86_64 pigsty 32.7 KiB postgresql-16-parray-gin_1.4.0-1PIGSTY~jammy_amd64.deb
postgresql-16-parray-gin 1.4.0 u22.aarch64 pigsty 32.2 KiB postgresql-16-parray-gin_1.4.0-1PIGSTY~jammy_arm64.deb
postgresql-16-parray-gin 1.4.0 u24.x86_64 pigsty 31.1 KiB postgresql-16-parray-gin_1.4.0-1PIGSTY~noble_amd64.deb
postgresql-16-parray-gin 1.4.0 u24.aarch64 pigsty 31.5 KiB postgresql-16-parray-gin_1.4.0-1PIGSTY~noble_arm64.deb
Package Version OS ORG SIZE File URL
parray_gin_15 1.4.0 el8.x86_64 pigsty 22.7 KiB parray_gin_15-1.4.0-1PIGSTY.el8.x86_64.rpm
parray_gin_15 1.4.0 el8.aarch64 pigsty 22.5 KiB parray_gin_15-1.4.0-1PIGSTY.el8.aarch64.rpm
parray_gin_15 1.4.0 el9.x86_64 pigsty 22.7 KiB parray_gin_15-1.4.0-1PIGSTY.el9.x86_64.rpm
parray_gin_15 1.4.0 el9.aarch64 pigsty 22.2 KiB parray_gin_15-1.4.0-1PIGSTY.el9.aarch64.rpm
parray_gin_15 1.4.0 el10.x86_64 pigsty 22.8 KiB parray_gin_15-1.4.0-1PIGSTY.el10.x86_64.rpm
parray_gin_15 1.4.0 el10.aarch64 pigsty 22.6 KiB parray_gin_15-1.4.0-1PIGSTY.el10.aarch64.rpm
postgresql-15-parray-gin 1.4.0 d12.x86_64 pigsty 30.1 KiB postgresql-15-parray-gin_1.4.0-1PIGSTY~bookworm_amd64.deb
postgresql-15-parray-gin 1.4.0 d12.aarch64 pigsty 29.9 KiB postgresql-15-parray-gin_1.4.0-1PIGSTY~bookworm_arm64.deb
postgresql-15-parray-gin 1.4.0 d13.x86_64 pigsty 30.2 KiB postgresql-15-parray-gin_1.4.0-1PIGSTY~trixie_amd64.deb
postgresql-15-parray-gin 1.4.0 d13.aarch64 pigsty 30.1 KiB postgresql-15-parray-gin_1.4.0-1PIGSTY~trixie_arm64.deb
postgresql-15-parray-gin 1.4.0 u22.x86_64 pigsty 32.8 KiB postgresql-15-parray-gin_1.4.0-1PIGSTY~jammy_amd64.deb
postgresql-15-parray-gin 1.4.0 u22.aarch64 pigsty 32.2 KiB postgresql-15-parray-gin_1.4.0-1PIGSTY~jammy_arm64.deb
postgresql-15-parray-gin 1.4.0 u24.x86_64 pigsty 31.2 KiB postgresql-15-parray-gin_1.4.0-1PIGSTY~noble_amd64.deb
postgresql-15-parray-gin 1.4.0 u24.aarch64 pigsty 31.5 KiB postgresql-15-parray-gin_1.4.0-1PIGSTY~noble_arm64.deb
Package Version OS ORG SIZE File URL
parray_gin_14 1.4.0 el8.x86_64 pigsty 22.7 KiB parray_gin_14-1.4.0-1PIGSTY.el8.x86_64.rpm
parray_gin_14 1.4.0 el8.aarch64 pigsty 22.5 KiB parray_gin_14-1.4.0-1PIGSTY.el8.aarch64.rpm
parray_gin_14 1.4.0 el9.x86_64 pigsty 22.6 KiB parray_gin_14-1.4.0-1PIGSTY.el9.x86_64.rpm
parray_gin_14 1.4.0 el9.aarch64 pigsty 22.2 KiB parray_gin_14-1.4.0-1PIGSTY.el9.aarch64.rpm
parray_gin_14 1.4.0 el10.x86_64 pigsty 22.8 KiB parray_gin_14-1.4.0-1PIGSTY.el10.x86_64.rpm
parray_gin_14 1.4.0 el10.aarch64 pigsty 22.6 KiB parray_gin_14-1.4.0-1PIGSTY.el10.aarch64.rpm
postgresql-14-parray-gin 1.4.0 d12.x86_64 pigsty 30.0 KiB postgresql-14-parray-gin_1.4.0-1PIGSTY~bookworm_amd64.deb
postgresql-14-parray-gin 1.4.0 d12.aarch64 pigsty 29.9 KiB postgresql-14-parray-gin_1.4.0-1PIGSTY~bookworm_arm64.deb
postgresql-14-parray-gin 1.4.0 d13.x86_64 pigsty 30.1 KiB postgresql-14-parray-gin_1.4.0-1PIGSTY~trixie_amd64.deb
postgresql-14-parray-gin 1.4.0 d13.aarch64 pigsty 30.1 KiB postgresql-14-parray-gin_1.4.0-1PIGSTY~trixie_arm64.deb
postgresql-14-parray-gin 1.4.0 u22.x86_64 pigsty 32.8 KiB postgresql-14-parray-gin_1.4.0-1PIGSTY~jammy_amd64.deb
postgresql-14-parray-gin 1.4.0 u22.aarch64 pigsty 32.2 KiB postgresql-14-parray-gin_1.4.0-1PIGSTY~jammy_arm64.deb
postgresql-14-parray-gin 1.4.0 u24.x86_64 pigsty 31.1 KiB postgresql-14-parray-gin_1.4.0-1PIGSTY~noble_amd64.deb
postgresql-14-parray-gin 1.4.0 u24.aarch64 pigsty 31.4 KiB postgresql-14-parray-gin_1.4.0-1PIGSTY~noble_arm64.deb

Source

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

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

Create this extension with:

CREATE EXTENSION parray_gin;

Usage

Syntax:

CREATE EXTENSION parray_gin;
CREATE INDEX test_tags_idx ON test_table USING gin (val parray_gin_ops);
SELECT * FROM test_table WHERE val @> ARRAY['must','contain'];
SELECT * FROM test_table WHERE val @@> ARRAY['what%like%'];

Sources: README, Reference

parray_gin adds GIN indexing and operators for text[] arrays with both strict and partial matching. The upstream docs describe it as trigram-based array indexing built on pg_trgm’s trigram implementation.

Indexing Arrays

The extension provides the parray_gin_ops operator class for GIN indexes on text arrays:

CREATE TABLE test_table(id bigserial, val text[]);
CREATE INDEX test_tags_idx ON test_table USING gin (val parray_gin_ops);

According to the reference docs, indexed values and queries are split into trigrams. Because the trigram index can return false positives, operator matches are rechecked after index lookup.

Operators

Strict Matching

@> (text[], text[]) -> bool

Returns true when the left-hand array contains all items from the right-hand array.

SELECT * FROM test_table WHERE val @> ARRAY['far'];

<@ (text[], text[]) -> bool

Returns true when the left-hand array is contained by the right-hand array.

SELECT * FROM test_table WHERE val <@ ARRAY['galaxy','ago','vader'];

Partial Matching

@@> (text[], text[]) -> bool

Returns true when the left-hand array contains all right-hand items using partial matching, for example 'foobar' ~~ 'foo%' or 'foobar' ~~ '%oo%'.

SELECT * FROM test_table WHERE val @@> ARRAY['%ar%'];

<@@ (text[], text[]) -> bool

Returns true when the left-hand array is contained by the right-hand patterns using partial matching.

SELECT * FROM test_table WHERE val <@@ ARRAY['%ar%','vader'];

Notes

The upstream docs say GIN can be used with @>, <@, @@>, and <@@. They also mention successful use on JSON arrays extracted from JSON text fields via the json_accessors extension.

Last updated on