-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
opt: inverted-index accelerate filters of the form j->'a' = '{"b": "c"} #59605
Comments
Excited about this issue! |
I spent some time thinking about the questions you brought up, and have some ideas of how to approach this, but also there are some things I'm confused about. Would love to hear your thoughts @mgartner :)
|
That sounds right to me. In invertedidx. extractJSONOrArrayContainsCondition we currently handle expressions like
It's a good idea, though i'm not sure it's necessary if we can turn the expression into a JSON object that leads to an equivalent inverted index scan after passing to
Good find! You can see this in action in the opt test below. Notice that we scan two spans (one for
You've gotten a great understanding of how inverted indexes work from the RFC and the code. Another tool that has been helpful for me in understanding how JSON inverted indexes are encoded is a
You can play around with different INSERT statements to see how a row is encoded and written to an inverted index. Above, you can see two Lastly, don't feel like you have to add index acceleration for all these complex filters in a single PR—you can start with the most simple expression and iteratively add support for more complex expressions. |
Previously, the optimizer did not plan inverted index scans for queries with the JSON fetch value operator `->` when an object or array was on the right side of the equality operator `=`, only when it was a boolean, string, number, or null. This change allows the inverted index to be used in these types of queries. It supports objects with multiple key/value pairs, nested objects, arrays, arrays nested within objects, and objects nested within arrays. Fixes: cockroachdb#59605 Release note: None
Previously, the optimizer did not plan inverted index scans for queries with the JSON fetch value operator `->` when an object or array was on the right side of the equality operator `=`, only when it was a boolean, string, number, or null. This change allows the inverted index to be used in these types of queries. It supports objects with multiple key/value pairs, nested objects, arrays, arrays nested within objects, and objects nested within arrays. Fixes: cockroachdb#59605 Release note: None
Previously, the optimizer did not plan inverted index scans for queries with the JSON fetch value operator `->` when an object or array was on the right side of the equality operator `=`, only when it was a boolean, string, number, or null. This change allows the inverted index to be used in these types of queries. It supports objects with multiple key/value pairs, nested objects, arrays, arrays nested within objects, and objects nested within arrays. Fixes: cockroachdb#59605 Release note: None
Previously, the optimizer did not plan inverted index scans for queries with the JSON fetch value operator `->` when an object or array was on the right side of the equality operator `=`, only when it was a boolean, string, number, or null. This change allows the inverted index to be used in these types of queries. It supports objects with multiple key/value pairs, nested objects, arrays, arrays nested within objects, and objects nested within arrays. Fixes: cockroachdb#59605 Release note: None
60541: opt: inverted-index accelerate filters of the form j->'a' = '{"b": "c"}' r=angelazxu a=angelazxu Previously, the optimizer did not plan inverted index scans for queries with the JSON fetch value operator `->` when an object or array was on the right side of the equality operator `=`, only when it was a boolean, string, number, or null. This change allows the inverted index to be used in these types of queries. It supports objects with multiple key/value pairs, nested objects, arrays, arrays nested within objects, and objects nested within arrays. Fixes: #59605 Release note: None 60619: kv: allow manual GC that does not advance threshold r=nvanbenschoten a=nvanbenschoten Relates to #60585. This commit updates the GC queue's `process` method to allow GC even if it determines that doing so would not advance the GC threshold. This check is retained in the queue's `shouldQueue` method, so this change does not impact automated queueing decisions. However, it does ensure that if someone manually enqueues a range in the GC queue with the `ShouldSkipQueue` option, then the range is actually processed. This is important because manually the GC threshold is the first thing that the GC bumps when processing, meaning that the GC threshold alone is not a definitive indication that there is no more work to perform on a range. A processing pass that will not bump the threshold can still be useful, especially with the long context timeout associated with manual enqueuing. Release note (ui change): Manually enqueue range in a replica GC queue now properly respects the SkipShouldQueue option. This can be useful to force a GC of a specific Range. 60638: sql: fix RENAME COLUMN for REGIONAL BY ROW r=ajstorm a=otan We need to correct the column reference on the table descriptor if we are renaming the REGIONAL BY ROW column. Resolves #59116 Release note: None 60698: vendor: bump pebble to 444296cf r=sumeerbhola a=sumeerbhola 444296cf Merge pull request #1066 from petermattis/pmattis/stability 59659388 update README with note about production readiness a516e691 *: optimize SeekPrefixGE to use Next 327d2757 sstable: hoist blockSizes from testBytesIteratedWithCompression 69b09310 sstable: add benchmarks for zstd cbe3a149 sstable: fix review comments deb29d88 sstable: include zstd into the test cases f13dea6f sstable: support zstd compression 73e8a3b0 vendor: added DataDog/zstd ec81e4c4 sstable: add zstd-related constants Release note: None Co-authored-by: Angela Xu <[email protected]> Co-authored-by: Nathan VanBenschoten <[email protected]> Co-authored-by: Oliver Tan <[email protected]> Co-authored-by: sumeerbhola <[email protected]>
The optimizer currently plans JSON inverted index scans for query filters with a
->
JSON fetch value operator on the right side of a=
equality operator. However, inverted index scans are only planned with the right side of the=
is a JSON boolean, string, number, ornull
, but not when it is an object or array.For example:
It should be possible to modify
jsonOrArrayFilterPlanner. extractJSONFetchValEqCondition
so that inverted index scans are generated for the second query above.Some things to think about:
j->'a' = '{"b": "c", "d": "e"}
?The text was updated successfully, but these errors were encountered: