collection
Associative-array data types for high-performance PL/pgSQL workflows
Repository
aws/pgcollection
https://github.com/aws/pgcollection
Source
pgcollection-2.1.3.tar.gz
pgcollection-2.1.3.tar.gz
Overview
| Package | Version | Category | License | Language |
|---|---|---|---|---|
pgcollection | 2.1.3 | TYPE | Apache-2.0 | C |
| ID | Extension | Bin | Lib | Load | Create | Trust | Reloc | Schema |
|---|---|---|---|---|---|---|---|---|
| 3700 | collection | No | Yes | No | Yes | No | Yes | - |
| Related | pgbson intarray hstore arraymath pgjq jsquery pg_jsonschema jsonschema floatvec pg_projection istore |
|---|
PGXN name: pgcollection.
Version
| OS / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
| el8.x86_64 | PIGSTY 2.1.3 el8.x86_64.pg18 : pgcollection_18 pgcollection_18-2.1.3-1PGSTY.el8.x86_64.rpm
| PIGSTY 2.1.3 el8.x86_64.pg17 : pgcollection_17 pgcollection_17-2.1.3-1PGSTY.el8.x86_64.rpm
| PIGSTY 2.1.3 el8.x86_64.pg16 : pgcollection_16 pgcollection_16-2.1.3-1PGSTY.el8.x86_64.rpm
| PIGSTY 2.1.3 el8.x86_64.pg15 : pgcollection_15 pgcollection_15-2.1.3-1PGSTY.el8.x86_64.rpm
| PIGSTY 2.1.3 el8.x86_64.pg14 : pgcollection_14 pgcollection_14-2.1.3-1PGSTY.el8.x86_64.rpm
|
| el8.aarch64 | PIGSTY 2.1.3 el8.aarch64.pg18 : pgcollection_18 pgcollection_18-2.1.3-1PGSTY.el8.aarch64.rpm
| PIGSTY 2.1.3 el8.aarch64.pg17 : pgcollection_17 pgcollection_17-2.1.3-1PGSTY.el8.aarch64.rpm
| PIGSTY 2.1.3 el8.aarch64.pg16 : pgcollection_16 pgcollection_16-2.1.3-1PGSTY.el8.aarch64.rpm
| PIGSTY 2.1.3 el8.aarch64.pg15 : pgcollection_15 pgcollection_15-2.1.3-1PGSTY.el8.aarch64.rpm
| PIGSTY 2.1.3 el8.aarch64.pg14 : pgcollection_14 pgcollection_14-2.1.3-1PGSTY.el8.aarch64.rpm
|
| el9.x86_64 | PIGSTY 2.1.3 el9.x86_64.pg18 : pgcollection_18 pgcollection_18-2.1.3-1PGSTY.el9.x86_64.rpm
| PIGSTY 2.1.3 el9.x86_64.pg17 : pgcollection_17 pgcollection_17-2.1.3-1PGSTY.el9.x86_64.rpm
| PIGSTY 2.1.3 el9.x86_64.pg16 : pgcollection_16 pgcollection_16-2.1.3-1PGSTY.el9.x86_64.rpm
| PIGSTY 2.1.3 el9.x86_64.pg15 : pgcollection_15 pgcollection_15-2.1.3-1PGSTY.el9.x86_64.rpm
| PIGSTY 2.1.3 el9.x86_64.pg14 : pgcollection_14 pgcollection_14-2.1.3-1PGSTY.el9.x86_64.rpm
|
| el9.aarch64 | PIGSTY 2.1.3 el9.aarch64.pg18 : pgcollection_18 pgcollection_18-2.1.3-1PGSTY.el9.aarch64.rpm
| PIGSTY 2.1.3 el9.aarch64.pg17 : pgcollection_17 pgcollection_17-2.1.3-1PGSTY.el9.aarch64.rpm
| PIGSTY 2.1.3 el9.aarch64.pg16 : pgcollection_16 pgcollection_16-2.1.3-1PGSTY.el9.aarch64.rpm
| PIGSTY 2.1.3 el9.aarch64.pg15 : pgcollection_15 pgcollection_15-2.1.3-1PGSTY.el9.aarch64.rpm
| PIGSTY 2.1.3 el9.aarch64.pg14 : pgcollection_14 pgcollection_14-2.1.3-1PGSTY.el9.aarch64.rpm
|
| el10.x86_64 | PIGSTY 2.1.3 el10.x86_64.pg18 : pgcollection_18 pgcollection_18-2.1.3-1PGSTY.el10.x86_64.rpm
| PIGSTY 2.1.3 el10.x86_64.pg17 : pgcollection_17 pgcollection_17-2.1.3-1PGSTY.el10.x86_64.rpm
| PIGSTY 2.1.3 el10.x86_64.pg16 : pgcollection_16 pgcollection_16-2.1.3-1PGSTY.el10.x86_64.rpm
| PIGSTY 2.1.3 el10.x86_64.pg15 : pgcollection_15 pgcollection_15-2.1.3-1PGSTY.el10.x86_64.rpm
| PIGSTY 2.1.3 el10.x86_64.pg14 : pgcollection_14 pgcollection_14-2.1.3-1PGSTY.el10.x86_64.rpm
|
| el10.aarch64 | PIGSTY 2.1.3 el10.aarch64.pg18 : pgcollection_18 pgcollection_18-2.1.3-1PGSTY.el10.aarch64.rpm
| PIGSTY 2.1.3 el10.aarch64.pg17 : pgcollection_17 pgcollection_17-2.1.3-1PGSTY.el10.aarch64.rpm
| PIGSTY 2.1.3 el10.aarch64.pg16 : pgcollection_16 pgcollection_16-2.1.3-1PGSTY.el10.aarch64.rpm
| PIGSTY 2.1.3 el10.aarch64.pg15 : pgcollection_15 pgcollection_15-2.1.3-1PGSTY.el10.aarch64.rpm
| PIGSTY 2.1.3 el10.aarch64.pg14 : pgcollection_14 pgcollection_14-2.1.3-1PGSTY.el10.aarch64.rpm
|
| d12.x86_64 | PIGSTY 2.1.3 d12.x86_64.pg18 : postgresql-18-collection postgresql-18-collection_2.1.3-1PGSTY~bookworm_amd64.deb
| PIGSTY 2.1.3 d12.x86_64.pg17 : postgresql-17-collection postgresql-17-collection_2.1.3-1PGSTY~bookworm_amd64.deb
| PIGSTY 2.1.3 d12.x86_64.pg16 : postgresql-16-collection postgresql-16-collection_2.1.3-1PGSTY~bookworm_amd64.deb
| PIGSTY 2.1.3 d12.x86_64.pg15 : postgresql-15-collection postgresql-15-collection_2.1.3-1PGSTY~bookworm_amd64.deb
| PIGSTY 2.1.3 d12.x86_64.pg14 : postgresql-14-collection postgresql-14-collection_2.1.3-1PGSTY~bookworm_amd64.deb
|
| d12.aarch64 | PIGSTY 2.1.3 d12.aarch64.pg18 : postgresql-18-collection postgresql-18-collection_2.1.3-1PGSTY~bookworm_arm64.deb
| PIGSTY 2.1.3 d12.aarch64.pg17 : postgresql-17-collection postgresql-17-collection_2.1.3-1PGSTY~bookworm_arm64.deb
| PIGSTY 2.1.3 d12.aarch64.pg16 : postgresql-16-collection postgresql-16-collection_2.1.3-1PGSTY~bookworm_arm64.deb
| PIGSTY 2.1.3 d12.aarch64.pg15 : postgresql-15-collection postgresql-15-collection_2.1.3-1PGSTY~bookworm_arm64.deb
| PIGSTY 2.1.3 d12.aarch64.pg14 : postgresql-14-collection postgresql-14-collection_2.1.3-1PGSTY~bookworm_arm64.deb
|
| d13.x86_64 | PIGSTY 2.1.3 d13.x86_64.pg18 : postgresql-18-collection postgresql-18-collection_2.1.3-1PGSTY~trixie_amd64.deb
| PIGSTY 2.1.3 d13.x86_64.pg17 : postgresql-17-collection postgresql-17-collection_2.1.3-1PGSTY~trixie_amd64.deb
| PIGSTY 2.1.3 d13.x86_64.pg16 : postgresql-16-collection postgresql-16-collection_2.1.3-1PGSTY~trixie_amd64.deb
| PIGSTY 2.1.3 d13.x86_64.pg15 : postgresql-15-collection postgresql-15-collection_2.1.3-1PGSTY~trixie_amd64.deb
| PIGSTY 2.1.3 d13.x86_64.pg14 : postgresql-14-collection postgresql-14-collection_2.1.3-1PGSTY~trixie_amd64.deb
|
| d13.aarch64 | PIGSTY 2.1.3 d13.aarch64.pg18 : postgresql-18-collection postgresql-18-collection_2.1.3-1PGSTY~trixie_arm64.deb
| PIGSTY 2.1.3 d13.aarch64.pg17 : postgresql-17-collection postgresql-17-collection_2.1.3-1PGSTY~trixie_arm64.deb
| PIGSTY 2.1.3 d13.aarch64.pg16 : postgresql-16-collection postgresql-16-collection_2.1.3-1PGSTY~trixie_arm64.deb
| PIGSTY 2.1.3 d13.aarch64.pg15 : postgresql-15-collection postgresql-15-collection_2.1.3-1PGSTY~trixie_arm64.deb
| PIGSTY 2.1.3 d13.aarch64.pg14 : postgresql-14-collection postgresql-14-collection_2.1.3-1PGSTY~trixie_arm64.deb
|
| u22.x86_64 | PIGSTY 2.1.3 u22.x86_64.pg18 : postgresql-18-collection postgresql-18-collection_2.1.3-1PGSTY~jammy_amd64.deb
| PIGSTY 2.1.3 u22.x86_64.pg17 : postgresql-17-collection postgresql-17-collection_2.1.3-1PGSTY~jammy_amd64.deb
| PIGSTY 2.1.3 u22.x86_64.pg16 : postgresql-16-collection postgresql-16-collection_2.1.3-1PGSTY~jammy_amd64.deb
| PIGSTY 2.1.3 u22.x86_64.pg15 : postgresql-15-collection postgresql-15-collection_2.1.3-1PGSTY~jammy_amd64.deb
| PIGSTY 2.1.3 u22.x86_64.pg14 : postgresql-14-collection postgresql-14-collection_2.1.3-1PGSTY~jammy_amd64.deb
|
| u22.aarch64 | PIGSTY 2.1.3 u22.aarch64.pg18 : postgresql-18-collection postgresql-18-collection_2.1.3-1PGSTY~jammy_arm64.deb
| PIGSTY 2.1.3 u22.aarch64.pg17 : postgresql-17-collection postgresql-17-collection_2.1.3-1PGSTY~jammy_arm64.deb
| PIGSTY 2.1.3 u22.aarch64.pg16 : postgresql-16-collection postgresql-16-collection_2.1.3-1PGSTY~jammy_arm64.deb
| PIGSTY 2.1.3 u22.aarch64.pg15 : postgresql-15-collection postgresql-15-collection_2.1.3-1PGSTY~jammy_arm64.deb
| PIGSTY 2.1.3 u22.aarch64.pg14 : postgresql-14-collection postgresql-14-collection_2.1.3-1PGSTY~jammy_arm64.deb
|
| u24.x86_64 | PIGSTY 2.1.3 u24.x86_64.pg18 : postgresql-18-collection postgresql-18-collection_2.1.3-1PGSTY~noble_amd64.deb
| PIGSTY 2.1.3 u24.x86_64.pg17 : postgresql-17-collection postgresql-17-collection_2.1.3-1PGSTY~noble_amd64.deb
| PIGSTY 2.1.3 u24.x86_64.pg16 : postgresql-16-collection postgresql-16-collection_2.1.3-1PGSTY~noble_amd64.deb
| PIGSTY 2.1.3 u24.x86_64.pg15 : postgresql-15-collection postgresql-15-collection_2.1.3-1PGSTY~noble_amd64.deb
| PIGSTY 2.1.3 u24.x86_64.pg14 : postgresql-14-collection postgresql-14-collection_2.1.3-1PGSTY~noble_amd64.deb
|
| u24.aarch64 | PIGSTY 2.1.3 u24.aarch64.pg18 : postgresql-18-collection postgresql-18-collection_2.1.3-1PGSTY~noble_arm64.deb
| PIGSTY 2.1.3 u24.aarch64.pg17 : postgresql-17-collection postgresql-17-collection_2.1.3-1PGSTY~noble_arm64.deb
| PIGSTY 2.1.3 u24.aarch64.pg16 : postgresql-16-collection postgresql-16-collection_2.1.3-1PGSTY~noble_arm64.deb
| PIGSTY 2.1.3 u24.aarch64.pg15 : postgresql-15-collection postgresql-15-collection_2.1.3-1PGSTY~noble_arm64.deb
| PIGSTY 2.1.3 u24.aarch64.pg14 : postgresql-14-collection postgresql-14-collection_2.1.3-1PGSTY~noble_arm64.deb
|
| u26.x86_64 | PIGSTY 2.1.3 u26.x86_64.pg18 : postgresql-18-collection postgresql-18-collection_2.1.3-1PGSTY~resolute_amd64.deb
| PIGSTY 2.1.3 u26.x86_64.pg17 : postgresql-17-collection postgresql-17-collection_2.1.3-1PGSTY~resolute_amd64.deb
| PIGSTY 2.1.3 u26.x86_64.pg16 : postgresql-16-collection postgresql-16-collection_2.1.3-1PGSTY~resolute_amd64.deb
| PIGSTY 2.1.3 u26.x86_64.pg15 : postgresql-15-collection postgresql-15-collection_2.1.3-1PGSTY~resolute_amd64.deb
| PIGSTY 2.1.3 u26.x86_64.pg14 : postgresql-14-collection postgresql-14-collection_2.1.3-1PGSTY~resolute_amd64.deb
|
| u26.aarch64 | PIGSTY 2.1.3 u26.aarch64.pg18 : postgresql-18-collection postgresql-18-collection_2.1.3-1PGSTY~resolute_arm64.deb
| PIGSTY 2.1.3 u26.aarch64.pg17 : postgresql-17-collection postgresql-17-collection_2.1.3-1PGSTY~resolute_arm64.deb
| PIGSTY 2.1.3 u26.aarch64.pg16 : postgresql-16-collection postgresql-16-collection_2.1.3-1PGSTY~resolute_arm64.deb
| PIGSTY 2.1.3 u26.aarch64.pg15 : postgresql-15-collection postgresql-15-collection_2.1.3-1PGSTY~resolute_arm64.deb
| PIGSTY 2.1.3 u26.aarch64.pg14 : postgresql-14-collection postgresql-14-collection_2.1.3-1PGSTY~resolute_arm64.deb
|
Build
You can build the RPM / DEB packages for pgcollection using pig build:
Install
You can install pgcollection directly. First, make sure the PGDG and PIGSTY repositories are added and enabled:
Install the extension using pig or apt/yum/dnf:
Install
pig
dnf
apt
Create Extension:
Usage
The collection extension provides two memory-optimized collection data types for use within PL/pgSQL functions.
Data Types
collection: Key-value pairs with text keys (max 32,767 chars), stored in creation ordericollection: Key-value pairs with 64-bit integer keys, enabling sparse arrays
Both types support type modifiers to specify element types:
Subscript Access
Core Functions
| Function | Description |
|---|---|
add(coll, key, value) | Add element |
count(coll) | Element count |
delete(coll, key) | Remove element |
exist(coll, key) | Check key existence |
find(coll, key) | Retrieve value |
first(coll) | Move iterator to start |
last(coll) | Move iterator to end |
next(coll) | Advance iterator |
prev(coll) | Reverse iterator |
key(coll) | Current key |
value(coll) | Current value |
copy(coll) | Create copy |
sort(coll) | Sort by keys |
keys_to_table(coll) | All keys as set |
values_to_table(coll) | All values as set |
to_table(coll) | Keys and values as table |
Iterator Example
Sparse Arrays (icollection)
icollection supports non-contiguous integer indices and distinguishes between NULL values and uninitialized keys:
Was this page helpful?
Thanks—your feedback helps us improve this page.
What got in the way? (optional)