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
Use @> for std::contains with array parameters #4776
Use @> for std::contains with array parameters #4776
Conversation
This looks reasonable. Did you test if it seems to help with indexes? |
Yeah |
Support for GIN indexes was requested accordingly, see my comment in #4691. The initial |
Another question here is: will postgres use a GIN index in response to a |
When Unfortunately, I don't see a way to finagle inlining using SQL alone, but inlining can be achieved by making the function non-strict ( All of the above have been experimentally verified by manipulating the postgres backend of a live EdgeDB instance. How would you like to proceed? |
Perhaps this can be dealt with in two phases. Would it be possible to initially merge the variant of |
Sorry for not following up sooner. Thank you very much for your analysis and PR, it made this very easy on my side. What I am going to do is:
|
Oh, wait, actually, there is one snag: the behavior @stealth-toucan is the array-containing version important to your use cases if the element version exists? It seems like a pretty weird function, so my inclination is that it's not as important to support directly. |
Wrap them using a CASE statement. Motivation here is to make it so that #4776 can set `impl_is_strict := false` on `std::contains` for arrays without breaking anything.
Wrap them using a CASE statement. Motivation here is to make it so that #4776 can set `impl_is_strict := false` on `std::contains` for arrays without breaking anything.
3f65dbe
to
b85f884
Compare
b85f884
to
75d404b
Compare
I dropped the @stealth-toucan if having that version of the function is important to you, could you please file another issue (or even open a new PR, with tests)? |
Oh, annoyingly making It's also a problem with pointer constraints but there I think we do want it to understand |
d594263
to
24e8c0b
Compare
Alright, I ended up actually needing to do some stuff to get it to work |
Co-authored-by: Elvis Pranskevichus <elvis@magic.io>
At the moment, EdgeDB uses
array_position
instd::contains
when the haystack is an array. This change modifiesstd::contains
to use the@>
operator; this improves performance in the presence of indexes that support thearray_ops
operator class.