优化分页查询API
#1203
Replies: 2 comments 5 replies
-
因为异步不支持 out,如果介意异步可以扩展方法解决,也可以单独执行 .CountAsync() var select = fsql.Select<T>().. |
Beta Was this translation helpful? Give feedback.
0 replies
-
谢谢!建议Wiki文档这里补充一下,包括Where条件在Count前后的区别。 |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
现在分页查询有一些缺陷:
1、
Count(out long count)
因为要支持out
参数,因此这里实际是同步执行,而非完全的异步。一方面若表行数较大、同步执行的时间较长,会影响接口整体的吞吐量;另一方面使用者需要注意Where条件的位置,若不小心放在Count后可能会出现总数和实际返回结果不一致的情况。2、在数量查询结果为0时,理论上可以不必执行查询具体数据的SQL,以节省性能;而目前似乎每次都会执行2条SQL。
不过我暂时也提不出具体的改进方案,只是感觉分页查询这里是一个潜在的优化点。
Beta Was this translation helpful? Give feedback.
All reactions