-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
配置分页后查询效率巨低 #792
Labels
Comments
@rationalol 只要是查数组都一定分页,query:2 导致多了 count 查询,你用子查询本身也会降低效率。 |
因为配置了分页所以他会进行一次COUNT查询,这个COUNT查询在数据库中查询时间很长,导致拖垮了这个接口的整体性能
解决方案也很简单 数据库加个索引就完事了
|
像移动端 APP/H5 网页的列表/网格,一般是上滑加载更多,不需要返回总数等信息,查数据就行了,查不到数据就知道是最后一页了。query 不传或传 0 就不会有 SQL count 查询了 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
环境win11



jdk20
APIJSON7
MYSQL 5.7
在日志中打印出的SQL语句如下
执行时间是0.187s
The text was updated successfully, but these errors were encountered: