pg_lion_vector
pg_lion : Filtered nearest-neighbor indexes for pgvector vector and halfvec
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 2717 | pg_lion_vector | pg_lion | 0.3.0 |
FEAT | PostgreSQL | C |
| Attribute | Has Binary | Has Library | Need Load | Has DDL | Relocatable | Trusted |
|---|---|---|---|---|---|---|
| --s-d-r | No | Yes | No | Yes | yes | no |
| Relationships | |
|---|---|
| Requires | pg_lion vector |
| Siblings | pg_lion pg_lion_citext |
Packages
| Linux / PG | PG19 | PG18 | PG17 | PG16 | PG15 |
|---|---|---|---|---|---|
| el8.x86_64 | N/A | PIGSTY 0.3.0 | PIGSTY 0.3.0 | PIGSTY 0.3.0 | N/A |
| el8.aarch64 | N/A | PIGSTY 0.3.0 | PIGSTY 0.3.0 | PIGSTY 0.3.0 | N/A |
| el9.x86_64 | MISS | PIGSTY 0.3.0 | PIGSTY 0.3.0 | PIGSTY 0.3.0 | N/A |
| el9.aarch64 | MISS | PIGSTY 0.3.0 | PIGSTY 0.3.0 | PIGSTY 0.3.0 | N/A |
| el10.x86_64 | MISS | PIGSTY 0.3.0 | PIGSTY 0.3.0 | PIGSTY 0.3.0 | N/A |
| el10.aarch64 | MISS | PIGSTY 0.3.0 | PIGSTY 0.3.0 | PIGSTY 0.3.0 | N/A |
| d12.x86_64 | MISS | PIGSTY 0.3.0 | PIGSTY 0.3.0 | PIGSTY 0.3.0 | N/A |
| d12.aarch64 | MISS | PIGSTY 0.3.0 | PIGSTY 0.3.0 | PIGSTY 0.3.0 | N/A |
| d13.x86_64 | MISS | PIGSTY 0.3.0 | PIGSTY 0.3.0 | PIGSTY 0.3.0 | N/A |
| d13.aarch64 | MISS | PIGSTY 0.3.0 | PIGSTY 0.3.0 | PIGSTY 0.3.0 | N/A |
| u22.x86_64 | MISS | PIGSTY 0.3.0 | PIGSTY 0.3.0 | PIGSTY 0.3.0 | N/A |
| u22.aarch64 | MISS | PIGSTY 0.3.0 | PIGSTY 0.3.0 | PIGSTY 0.3.0 | N/A |
| u24.x86_64 | MISS | PIGSTY 0.3.0 | PIGSTY 0.3.0 | PIGSTY 0.3.0 | N/A |
| u24.aarch64 | MISS | PIGSTY 0.3.0 | PIGSTY 0.3.0 | PIGSTY 0.3.0 | N/A |
| u26.x86_64 | MISS | PIGSTY 0.3.0 | PIGSTY 0.3.0 | PIGSTY 0.3.0 | N/A |
| u26.aarch64 | MISS | PIGSTY 0.3.0 | PIGSTY 0.3.0 | PIGSTY 0.3.0 | N/A |
Source
github.com/cgkanchi/pg_lion
pg_lion-0.3.0.tar.gz
Install
Make sure PGDG and PIGSTY repo available:
Install this extension with pig:
Create this extension with:
Usage
Sources:
pg_lion_vector 0.3.0 adds the lionvec nearest-neighbor access method for pgvector vector and halfvec values. It uses the parent pg_lion library and requires pgvector 0.7 or later.
Core Workflow
Create the parent and vector extensions first. A separate lion index can filter candidates before distance ranking.
Upstream recommends COST 100 for the distance function used by the chosen operator class so the planner can compare scan and sort costs. This setting is not preserved by pg_dump and may be reset by an update of vector.
Operator Classes and Tuning
| Type | L2 (<->) |
Negative inner product (<#>) |
Cosine (<=>) |
|---|---|---|---|
vector |
vector_l2_ops (default) |
vector_ip_ops |
vector_cosine_ops |
halfvec |
halfvec_l2_ops (default) |
halfvec_ip_ops |
halfvec_cosine_ops |
partitions controls the index build’s clustering; maintenance_work_mem must hold an adequate sample. pg_lion.vector_margin and pg_lion.vector_patience control approximate search. Small candidate sets under a supported lion filter can use exact scoring. pg_lion.vector_postfilter controls predicates the lion indexes cannot answer; review the reference before changing it.
Operational Boundaries
Requires PostgreSQL 16 or later and superuser installation. Only one vector or halfvec column, up to 8128 dimensions, is supported; this is generally approximate search. A filter does not turn every query into exact nearest-neighbor search. Heavy churn may require occasional REINDEX. Parent custom-WAL indexes retain their preload requirement. Keep parent and companion files at the same version.