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

Multi INDEX HINTS not supported. #4038

Closed
Tracked by #8604
LPX-E5BD8 opened this issue Jun 19, 2018 · 7 comments · Fixed by #9811
Closed
Tracked by #8604

Multi INDEX HINTS not supported. #4038

LPX-E5BD8 opened this issue Jun 19, 2018 · 7 comments · Fixed by #9811

Comments

@LPX-E5BD8
Copy link

multi INDEX HINTS will be parsed error.

tbl_name [[AS] alias] [index_hint_list]

index_hint_list:
    index_hint [index_hint] ...

index_hint:
    USE {INDEX|KEY}
      [FOR {JOIN|ORDER BY|GROUP BY}] ([index_list])
  | IGNORE {INDEX|KEY}
      [FOR {JOIN|ORDER BY|GROUP BY}] (index_list)
  | FORCE {INDEX|KEY}
      [FOR {JOIN|ORDER BY|GROUP BY}] (index_list)

index_list:
    index_name [, index_name] ...
@LPX-E5BD8
Copy link
Author

there is a same problem with create temporary table.

CREATE TEMPORARY TABLE t (c CHAR(20)
&vterrors.vtError{code:3, err:"syntax error at position 23 near 'table'"}

@sougou
Copy link
Contributor

sougou commented Jun 20, 2018

We can't currently support temp tables. See #3945.
Multi-index should be possible.

@tomkrouper
Copy link
Collaborator

👍 on needing this. In our testing, we have an ignore index in a query that is failing.

@morgo morgo added this to the v5.0 milestone Oct 25, 2019
@morgo morgo modified the milestones: v5.0, v6.0 Dec 7, 2019
@deepthi deepthi modified the milestones: v6.0, v8.0 Jul 14, 2020
@deepthi deepthi removed this from the v8.0 milestone Nov 12, 2020
@christianlang
Copy link

+1 for adding this support. We have several queries with IGNORE INDEX FOR ORDER BY (PRIMARY) which currently result in a syntax error from Vitess.

@mattlord
Copy link
Contributor

I wanted to note that you can use SQL comments to pass these hints down to MySQL: https://dev.mysql.com/doc/refman/8.0/en/optimizer-hints.html

Is this sufficient, at least for the time being?

@christianlang
Copy link

We're still on MySQL 5.7 and the optimizer hints require 8.0.20 or newer, so we can't use this, unfortunately. Otherwise this would be a great work-around.

@glortho
Copy link

glortho commented Mar 9, 2022

Great to see this land! Do you have a sense of when this might be released?

systay pushed a commit that referenced this issue Jul 22, 2024
…on writes (#4038)

* cherry pick of 14797

* Address merge conflict

Signed-off-by: Matt Lord <mattalord@gmail.com>

---------

Signed-off-by: Matt Lord <mattalord@gmail.com>
Co-authored-by: Matt Lord <mattalord@gmail.com>
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.

9 participants