Skip to content

Batch PgOrderRepo.insert_order line inserts (avoid N+1) #18

@JumpTechCode

Description

@JumpTechCode

PgOrderRepo.insert_order inserts each order line with a separate await conn.execute(...) in a loop (N+1). A single multi-row insert / executemany would be more efficient.

Order creation is low-frequency and uncontended, so this is a performance nicety rather than a correctness issue. Pairs naturally with bounding CreateOrderRequest.lines (see related issue).

  • src/quartermaster/adapters/postgres/unit_of_work.pyPgOrderRepo.insert_order

Deferred follow-up from the review of feat/api-http-layer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions