hstore_ops
hstore_ops · Alternative GIN operator classes for hstore, optimized for smaller indexes and faster containment queries.
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 100049 | hstore_ops | hstore_ops | 1.1 | FEAT | GPL-2.0 | C |
| Relationships | |
|---|---|
| Requires | hstore |
Usage
Sources:
hstore_ops adds two alternative GIN operator classes for the PostgreSQL hstore type. Choose it when containment-heavy workloads need a smaller or faster index than the built-in GIN class, or when bytewise comparison avoids expensive collation work.
Core Workflow
For the alternative bytewise class:
Both classes support the @>, ?, ?|, and ?& operators.
Choosing an Operator Class
gin_hstore_hash_opsstores hashes of keys and values. Upstream reports smaller indexes and faster@>searches than the default GIN class, while key-existence operators can be somewhat slower.gin_hstore_bytea_ops, added in version1.1, is a variation of the standardhstoreGIN class that compares keys bytewise instead of using collation keys. It is intended to improve index work when collation comparison is slow without changing supported operators.
Hash collisions are possible with gin_hstore_hash_ops, so PostgreSQL must recheck candidate rows. Measure index size, build time, update cost, and each query shape on representative data rather than assuming one class is universally faster.
Dependencies and Maintenance
The control file declares hstore as a required extension; no preload or restart is required. Upgrading an existing hstore_ops 1.0 installation to 1.1 adds gin_hstore_bytea_ops:
Changing an existing index to another operator class requires rebuilding that index. Plan the lock and disk-space impact as for any large GIN index build.