stac-utils / stac-utils/pgstac
Support index-field to create a GIN index
Nobody has claimed this yet.
- Dominant language
- PLpgSQL
- Stars
- 223
- Forks
- 57
- PR merge metrics
- No merged PRs in 30d
Description
load_queryables() always sets property_index_type = 'BTREE' for any field passed to --index-field. It seems there's no way to ask for anything else.
That's a problem for array properties as the only operators STAC defines for arrays (a_overlaps/a_contains/a_equals → &&/@>/<@) need a GIN index to be fast.
It seems indexdef() already builds the index from whatever's in property_index_type with no check on the value. So GIN should already works fine if that column is set to 'GIN'.
Would it make sense to:
- let
--index-fieldtake a type, likemonty:country_codes:gin(BTREEstays the default)? - or just default array fields to
GINautomatically, sinceBTREEdoesn't them anyway?
Happy to open a PR either way, if one of these sounds right.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading load_queryables() and indexdef(), the entry points named in the issue, and trace how --index-field populates property_index_type. Clarify whether the change should accept an explicit GIN type or choose GIN for array fields. Done means array-property indexes use GIN while the existing BTREE default remains intact.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- postgresql, sql
- Domain
- databases
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 58/100