Meituan-Dianping / Meituan-Dianping/SQLAdvisor

不规范索引名称导致优化过程出现语法错误

Open
#28 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
5.6k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

当索引名称不规范,包含中横线(-),在force index时会出现语法报错,可用``包括。

2017-04-28 09:25:27 98697 [Note] show table status like 'play'

2017-04-28 09:25:27 98697 [Note] select count(*) from ( select start_time from play FORCE INDEX( cinema_play-id ) order by cinema_id DESC,cine_play_id DESC limit 10000) play where (start_time > '2017-04-19 01:02:54')

2017-04-28 09:25:27 98697 [Note] 第5步:SQLAdvisor结束!错误日志:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-id ) order by cinema_id DESC,cine_play_id DESC limit 10000) play where (`star' at line 1

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the reported SQLAdvisor failure with the shown FORCE INDEX query and an index name containing a hyphen. Trace the optimizer path that generates FORCE INDEX syntax; done means the query is generated without a syntax error for this identifier and a regression test covers the case.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.