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

[Epic] extendedIndexes GA #12376

Closed
18 of 33 tasks
do4gr opened this issue Mar 16, 2022 · 10 comments
Closed
18 of 33 tasks

[Epic] extendedIndexes GA #12376

do4gr opened this issue Mar 16, 2022 · 10 comments

Comments

@do4gr
Copy link
Member

do4gr commented Mar 16, 2022

The feature currently encompasses the sort and length arguments as well as the type argument on Postgres.
It was released in 3.5 and 3.6 (type).
Main docs here: https://www.prisma.io/docs/concepts/components/prisma-schema/indexes
Preview feature feedback can be found here. #10540

Stabilizing this is a BREAKING CHANGE.

Feature Work

Bugs

Documentation

Reference

Use cases

Polishing

Stabilizing

Issues to close after GA

Out of scope for GA

@janpio janpio added the kind/epic A high-level initiative that has many subtasks. label Mar 16, 2022
@pimeys pimeys self-assigned this Apr 1, 2022
@sourdzl
Copy link

sourdzl commented Apr 6, 2022

really appreciate this work prisma team! I've been having trouble getting prisma to not create migrations dropping a GIN index i tried adding manually to the db, so this feature would really help!

@janpio
Copy link
Member

janpio commented Apr 6, 2022

Can you quickyl create a separate issue about what you are seeing @sourdzl? Currently GIN and GiST is not part of extendedIndexes, and any additional input could be valuable there. (As you can see above, looking into these two additional types is on our plan here.)

@sourdzl
Copy link

sourdzl commented Apr 11, 2022

sure @janpio !

We have a JSONB column in postgres which is shallow (just string key/value pairs, no nesting.). We'd like to index the keys which will be used commonly for WHERE and JOIN filtering, and it seems a GIN index solves this perfectly.

We're happy with any solution that allows the GIN indices to exist - so far we keep having prisma generate migrations that drop the GIN index. specifying a type: GIN would be great, but are also fine with manually adding CREATE INDEX... queries to migrations ourself if that's easier to support.

thank you all for maintaining such a great project!

@pimeys
Copy link
Contributor

pimeys commented Apr 12, 2022

@sourdzl I did some digging what we should be doing here. It's not final proposal, which I'm doing this week so we can write the code. Can you see if it misses something that you'd want to see in the feature?

https://github.com/pimeys/writing/blob/main/prisma/PostgreSQL%20Index%20Types.md

I'm trying to cover Gin, GiST, SP-GiST and BRIN indices, and the default built-in operators. The tsvector stuff for full-text queries will be coming later this year.

@pimeys
Copy link
Contributor

pimeys commented Apr 19, 2022

@pimeys
Copy link
Contributor

pimeys commented Apr 19, 2022

Discovery what is the issue with index lengths on MySQL and what we could do here: https://github.com/pimeys/writing/blob/main/prisma/Discovery:%20MySQL%20Index%20Length%20Limitations.md

@sourdzl
Copy link

sourdzl commented Apr 19, 2022

@pimeys thanks for writing such a detailed proposal. It definitely meets our immediate need (GIN index on JSONB column type, so we can do fast checks of top level key presence). I suspect the GIN/GIST support will be broadly useful for other postgres users.

Farther down the line, we'd like to try some of the full text searching features as well, but also realize postgres is not the best choice for search overall. For us, GIN/GIST indexing are "must have" feature.

(sorry for the delayed response)

@pimeys
Copy link
Contributor

pimeys commented Apr 21, 2022

GIN/GIST/SP-GiST/BRIN work going on here: prisma/prisma-engines#2858

@janpio
Copy link
Member

janpio commented May 4, 2022

And that is merged, you can use prisma@dev and the extendedIndexes preview feature if you want to play with it. Optimally start with a db pull on your existing database that uses these, and see if they are added correctly to the introspected schema. Afterwards you can also play with adding additional ones and then migrate (with db push or migrate dev).

Let us know how it goes please!

@floelhoeffel floelhoeffel added this to the 4.x milestone May 10, 2022
@pimeys
Copy link
Contributor

pimeys commented Jun 8, 2022

We are GA.

@pimeys pimeys closed this as completed Jun 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants