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

CNF/DNF of OR is MVIndex, but mv index does not selected #50265

Closed
seiya-annie opened this issue Jan 10, 2024 · 1 comment · Fixed by #50363
Closed

CNF/DNF of OR is MVIndex, but mv index does not selected #50265

seiya-annie opened this issue Jan 10, 2024 · 1 comment · Fixed by #50363
Assignees
Labels
affects-7.6 feature/developing the related feature is in development severity/major sig/planner SIG: Planner type/bug This issue is a bug.

Comments

@seiya-annie
Copy link

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

SELECT item_primary_key FROM items WHERE
? member of (domains) OR
? member of (image_signatures) OR
? member of (canonical_links) OR
json_contains(feed_profile_ids, '[?]')
/+ this dnf item could be used as access condi since it has only one index path/
limit 10

2. What did you expect to see? (Required)

mv index can be selected

3. What did you see instead (Required)

9f9a201fe639fafc3984a2bac2cf792d8cb41e9e3989f92f4d14b244e827ce0e.txt

4. What is your TiDB version? (Required)

master

@seiya-annie seiya-annie added the type/bug This issue is a bug. label Jan 10, 2024
@seiya-annie seiya-annie added sig/planner SIG: Planner feature/developing the related feature is in development labels Jan 10, 2024
@AilinKid
Copy link
Contributor

AilinKid commented Jan 12, 2024

/** SQ8-2 **/
SELECT
  item_primary_key
FROM
  items
WHERE
  "B2c32" member of (domains)
  OR "2eoqyp6399" member of (image_signatures)
  OR "E33EAdAc2Bee.com/s/link" member of (canonical_links)
  OR json_contains(feed_profile_ids, '[69236881]')
LIMIT
  10;

since json_contains is INTERSECTION logic, the embedded INTERSECTION indexMerge inside UNION indexMerge is banned. Currently fallback to table scan is reasonable. Workaround you can manually split it into two subquery linked with UNION

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-7.6 feature/developing the related feature is in development severity/major sig/planner SIG: Planner type/bug This issue is a bug.
Projects
None yet
4 participants