Skip to content

使用In时,当集合元素过多时,执行效率会大幅降低 #214

Open
@xiangxiren

Description

@xiangxiren

在我实际应用中,In中的元素个数会有几百个甚至也许会更多。目前SmartSql中实现时,有多少个元素就会定义多少个参数,类似:@Ids_0,@Ids_1,@Ids_2…… 。这样执行效率会很低。相同条件的查询,使用EFCore时,它会把元素直接拼接到SQL中,不会使用参数化,类似 where id in (1,2,3……)。通过我的对比,EFCore这样的做法会有更好的性能。因此,我建议SmartSql对In也这样处理,不再使用参数化。

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions