-
Notifications
You must be signed in to change notification settings - Fork 275
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: note re: gin index for jsonb #535
Conversation
Thanks for the suggestion! Thinking about it, the point of a gin index would be if you are trying to querying on specific properties of the json. Like say "WHERE file_data ->> metadata -> content_type = 'application/pdf'" -- and I'm not totaly sure a GIN index will catch that particular example, but something like that. But nothing in shrine will do that itself, right? You'd have to be doing things yourself to need it. It can also be a bit confusing to be sure exactly what queries will be covered by a GIN index or not, I'm not sure it will reliably handle any possible query, or do so ideally. If we are going to include mention of postgres-specific indexing for jsonb, I think we should probably link to a postgres documentation page on jsonb indexing options, or perhaps just note "you may want to look into indexing", rather than suggesting that a GIN index will be universally appropriate or taking responsibility for that recommendation. |
@jrochkind agreed:
I shall add in a link when I get the chance. My assumption was that folks who use jsonb will want to search within the |
I see your point. Postgres docs say "in general, most applications should prefer to store JSON data as jsonb, unless there are quite specialized needs, such as legacy assumptions about ordering of object keys," so I just use jsonb for json values without thinking about it, whether I am going to query a key or not. jsonb has some other potential uses even if not searching, like using json operators for atomic changes on Anyway, I'm not a shrine maintainer, this is just my thoughts! |
0c9eeca
to
8a03fb5
Compare
@jrochkind @hmistry I have updated as per comments / discussion (with a force push). Feel free to close without compunction if not useful, or does not align with the library's goals etc. |
8a03fb5
to
c0a93c4
Compare
@benkoshy Thank you for the PR and the following note:
It's nice to know your stance as being maintainers we want to encourage contributions, give feedback for changes, and allow them to make so they get credit and feel good about contributing. |
Why this PR?
Please feel free to close if this is not useful/beneficial.
Ben