stac-utils / stac-utils/pgstac

Support index-field to create a GIN index

Open
#484 2 comments 1 reaction 0 assignees View on GitHub

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-field take a type, like monty:country_codes:gin (BTREE stays the default)?
  • or just default array fields to GIN automatically, since BTREE doesn't them anyway?

Happy to open a PR either way, if one of these sounds right.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.