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

Add rule : Check whether the number of rows returned by the select statement is greater than the specified row #240

Open
HuangWeiCen opened this issue Jan 21, 2022 · 0 comments
Labels

Comments

@HuangWeiCen
Copy link
Contributor

HuangWeiCen commented Jan 21, 2022

原始需求

  1. 内容: 支持非索引优化能力,如扫描行数过多、返回行数过多、使用隐式转换等
  2. 分类: SQL优化能力--SQL优化建议

当前需求

需要实现 "返回行数过多" 的功能

SQLE 规则

规则 提示 默认提示等级 需求备注 对应PR
检查 Select 语句返回行数是否大于指定行 单条select语句, 建议返回结果行数不超过xxx行 warn 参考Insert行数限制

开发方案

检查select 语句是否有limit

没有

补充一个limit, 值设置为阈值+1, 然后尝试执行这条查询, 如果返回结果超过阈值则检测失败

  1. 如果limit比阈值小则直接判定通过
  2. 如果limit比阈值大则将limit修改为阈值+1然后尝试执行这条查询, 如果返回结果超过阈值则检测失败
@sjjian sjjian added this to the v1.2201.1 milestone Jan 24, 2022
@sjjian sjjian removed this from the v1.2202.0 milestone Feb 14, 2022
@sjjian sjjian added the feature label Feb 14, 2022
taolx0 pushed a commit that referenced this issue Sep 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants