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

optimize suspend limit into index merge reader as embedded one #46863

Closed
AilinKid opened this issue Sep 11, 2023 · 0 comments · Fixed by #46862
Closed

optimize suspend limit into index merge reader as embedded one #46863

AilinKid opened this issue Sep 11, 2023 · 0 comments · Fixed by #46862
Assignees

Comments

@AilinKid
Copy link
Contributor

Enhancement

before

        "SQL": "explain format = 'brief' select /*+ use_index(t, kj) */ * from t where json_contains(j, '[1, 2, 3]') limit 1; -- index merge intersection case, sink limit into table side",
        "Plan": [
          "Limit 1.00 root  offset:0, count:1",
          "└─IndexMerge 0.00 root  type: intersection",
          "  ├─IndexRangeScan(Build) 0.00 cop[tikv] table:t, index:kj(cast(`j` as signed array)) range:[1,1], keep order:false, stats:pseudo",
          "  ├─IndexRangeScan(Build) 0.00 cop[tikv] table:t, index:kj(cast(`j` as signed array)) range:[2,2], keep order:false, stats:pseudo",
          "  ├─IndexRangeScan(Build) 0.00 cop[tikv] table:t, index:kj(cast(`j` as signed array)) range:[3,3], keep order:false, stats:pseudo",
          "  └─Limit(Probe) 0.00 cop[tikv]  offset:0, count:1",
          "    └─TableRowIDScan 0.00 cop[tikv] table:t keep order:false, stats:pseudo"

after

        "SQL": "explain format = 'brief' select /*+ use_index(t, kj) */ * from t where json_contains(j, '[1, 2, 3]') limit 1; -- index merge intersection case, embedding limit into index merge reader",
        "Plan": [
          "IndexMerge 0.00 root  type: intersection, limit embedded(offset:0, count:1)",
          "├─IndexRangeScan(Build) 0.00 cop[tikv] table:t, index:kj(cast(`j` as signed array)) range:[1,1], keep order:false, stats:pseudo",
          "├─IndexRangeScan(Build) 0.00 cop[tikv] table:t, index:kj(cast(`j` as signed array)) range:[2,2], keep order:false, stats:pseudo",
          "├─IndexRangeScan(Build) 0.00 cop[tikv] table:t, index:kj(cast(`j` as signed array)) range:[3,3], keep order:false, stats:pseudo",
          "└─TableRowIDScan(Probe) 0.00 cop[tikv] table:t keep order:false, stats:pseudo"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant