Arrays support inverted indexes, but not forward indexes. If you want to index arrays, starting in CockroachDB 20.1 consider using an inverted index on your column.
This issue tracks adding forward indexes to array types.
You should definitely implement it. :)
Any chance that this will be implemented?
It's not currently planned for a release, it's on my to-do list to look into when I get some free time - can't promise anything at the moment though.
Out of curiosity, do you have any details on what you would use this for?
Sure. Currently I have two use cases:
You should definitely implement it. :)
My use case for this is storing all email addresses associated with each email I load into the DB. I want to be able to search for all messages associated with one email address.
Arrays are now indexable via inverted indexes, which supports containment operations on the arrays. We still don't support ordinary forward indexes on arrays.
@rohany @RaduBerinde I think the recent key encoding for arrays will solve this issue?
(sorry I put this comment on an unrelated issue about JSON - this is the one about arrays)
Yup, I've marked that PR as closing this (#48045)
Most helpful comment
You should definitely implement it. :)