Skip to content

can includes use a join instead of multiple queries? #85

@mattfeury

Description

@mattfeury

right now, includes triggers multiple select statements, e.g: User.includes(_.payment).includes(_.address).find(id) creates 3 select statements:

  • select from users where id = ?
  • select from payments where id in (?)
  • select from addresses where id in (?)

this is pretty un-performant when we could just do a left join and get everything in one query.

what would this take to do? i'm happy to commit some code if someone can point me in the right direction on where to start

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions