Ignore index optimizer hint doesn't work with sub queries #66421
Replies: 7 comments
-
|
原帖作者:winkyao\n原帖时间:2023-01-27 09:35:46.904788\n\n Could you try |
Beta Was this translation helpful? Give feedback.
-
|
原帖作者:Lucas_Sky\n原帖时间:2023-01-27 09:38:41.91615\n\n Thanks for fast reply. |
Beta Was this translation helpful? Give feedback.
-
|
原帖作者:winkyao\n原帖时间:2023-01-27 09:40:14.913291\n\n Thanks for your feedback, we’ll take a closer look, and get back to you when we figure it out. |
Beta Was this translation helpful? Give feedback.
-
|
原帖作者:timeandfate\n原帖时间:2023-01-30 19:22:40.581433\n\n The SQL bindings also affect the optimizer hints, you can run |
Beta Was this translation helpful? Give feedback.
-
|
原帖作者:Misaka\n原帖时间:2023-01-31 07:12:20.695903\n\n I’ve created a simple case, and it shows the hint works. Would you please give us the result of Use PLAN REPLAYER to Save and Restore the On-Site Information of a Cluster | PingCAP Docs to help us to find the reason? You can send the dump result via privately way. |
Beta Was this translation helpful? Give feedback.
-
|
原帖作者:Lucas_Sky\n原帖时间:2023-01-31 09:22:19.69227\n\n Hello, Thanks @timeandfate, it seems that we’ve left a global binding that interfered with optimizer hints. Removed global binding and now use index/ignore index works as expected. Thank you @Misaka @timeandfate |
Beta Was this translation helpful? Give feedback.
-
|
原帖作者:winkyao\n原帖时间:2023-01-31 10:09:22.801007\n\n If you encounter the similar situation in the future, you can use to find out if there are any binding with this SQL statement, it will show in the warning section. |
Beta Was this translation helpful? Give feedback.

Uh oh!
There was an error while loading. Please reload this page.
-
原帖作者:Lucas_Sky\n原帖时间:2023-01-27 09:14:28.397414\n原帖ID/Slug:130 / ignore-index-optimizer-hint-doesnt-work-with-sub-queries\n\n
Application environment:
There is none. Accessing TiDB directly via mysql-client.
TiDB version:
Problem:
ignore index used in queries with sub queries does not work as expected.
When using ignore index with sub-query it is ignored/does not nothing.
When sub query is removed ignore index is applied.
The same goes for other optimizer hints such as force index, use index
Beta Was this translation helpful? Give feedback.
All reactions