Skip to content

模型关联一对多中使用 limit 仅是软限制的潜在的性能问题 #783

@NHZEX

Description

@NHZEX

模型关联当前一对多对不是真正 sql 级别的 limit,仅是代码中软截断结果实现的,对于如果被关联对象数据很多,会成倍对程序内存与数据库产生隐藏的压力。

laravel 实现的方案:laravel/framework#49695

案例:一篇文章可以有很多评论,但我仅需要展示文章最新两条评论。在当前的 orm 预加实现中无法提供这个支持。

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