Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add GiST and SP-GiST support #5

Closed
zachasme opened this issue Aug 6, 2019 · 9 comments
Closed

Add GiST and SP-GiST support #5

zachasme opened this issue Aug 6, 2019 · 9 comments
Assignees
Labels
enhancement 🚀 New feature or request help wanted ⛏️ Extra attention is needed

Comments

@zachasme
Copy link
Owner

zachasme commented Aug 6, 2019

We should support GiST and SP-GiST indexes for operations like contains and contained by.

Ongoing work in separate PRs:

@zachasme zachasme added the enhancement 🚀 New feature or request label Aug 6, 2019
@zachasme zachasme self-assigned this Aug 6, 2019
@zachasme zachasme added the help wanted ⛏️ Extra attention is needed label Mar 26, 2020
@AbelVM
Copy link

AbelVM commented Aug 12, 2020

Hi, any news on this? The PR looks stalled as it's 1 year old, but there's no info on the blockers or the status.

How can we help? 🔨

@zachasme
Copy link
Owner Author

zachasme commented Aug 14, 2020

If I recall correctly, the state of the branch (which hasn't been touched in a year 😮) is that we managed to get GiST and SP-GiST operator classes to compile and run. However, tests either returned wrong results or were significantly slower than no index. There probably is either a logical error or a misimplementation of (SP-)GiST.

Help is very much welcomed!

The branch should be rebased (or maybe it's easier to simply copy the opclass since so much has changed). Then, we need to figure out what is wrong with our implementation. My implementation is based off the SP-GiST docs and GiST docs but if anyone has some other reference implementation that could be helpful.

@AbelVM
Copy link

AbelVM commented Aug 14, 2020

Cool, we will take a look at it. I have some ideas I'd like to test 😃

But first, I have a question related to these functions (gist_cmp and common_ancestor, mainly) in the PR: You have defined a lot of bitwise logic in h3index.h, but then in the index related functions, you use high-level methods from the core API instead. Is there any reason for that? Looks like a lot of redundant (implicit) operations to me 🤔

@zachasme
Copy link
Owner Author

That sounds great 😃

You are correct that the bitwise logic is mostly unused. I have directly copied h3index.h from the h3 repository since I needed the H3_GET_INDEX_DIGIT macro. I actually made this related issue uber/h3#277 since it is not exposed to library consumers.

The branch is very much a work-in-progress, and it would probably better to only include the necessary macros.

@AbelVM
Copy link

AbelVM commented Aug 14, 2020

As you asked for some references about GiST:

And, regarding the bitwise version, I just made a PR instead of a codeblock in this comment :)

@zachasme zachasme mentioned this issue Aug 24, 2020
@zachasme zachasme changed the title Add GiST support Add GiST and SP-GiST support Aug 24, 2020
@zachasme
Copy link
Owner Author

I've split the old branch into two, so we can get GiST working and merged before moving on to SP-GiST.

@multi-spectral
Copy link

Hi, you mentioned above that using the GiST index can lead to slower results - is there more known about the causes of this? Are some kinds of queries more affected than others?

@zachasme
Copy link
Owner Author

zachasme commented Nov 7, 2022

It is not a problem with GiST generally, but a problem with my initial implementation. Specifically I need to come up with good algorithms for penalty and picksplit (see https://www.postgresql.org/docs/current/gist-extensibility.html). I just haven't yet been able to dedicate the time necessary to solve this.

@zachasme
Copy link
Owner Author

zachasme commented Dec 1, 2022

Discussion continued in:

@zachasme zachasme closed this as completed Dec 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement 🚀 New feature or request help wanted ⛏️ Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants