dotnetcore / dotnetcore/SmartSql
使用In时,当集合元素过多时,执行效率会大幅降低
Open
- Dominant language
- C#
- Stars
- 1.1k
- Forks
- 229
- PR merge metrics
- No merged PRs in 30d
Description
在我实际应用中,In中的元素个数会有几百个甚至也许会更多。目前SmartSql中实现时,有多少个元素就会定义多少个参数,类似:@Ids_0,@Ids_1,@Ids_2…… 。这样执行效率会很低。相同条件的查询,使用EFCore时,它会把元素直接拼接到SQL中,不会使用参数化,类似 where id in (1,2,3……)。通过我的对比,EFCore这样的做法会有更好的性能。因此,我建议SmartSql对In也这样处理,不再使用参数化。
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.