Skip to content

Bulk INSERT...UNNEST for scan_telemetry record_batch #46

Description

@LKSNDRTMLKV

`PgScanTelemetryRepo::record_batch` (crates/dpp-dal/src/pg/repo_scan.rs) upserts each scan and QR-render row individually in a loop, inside one transaction. Flagged by review on #45 as inefficient — a single `INSERT ... ON CONFLICT` using `UNNEST` over both arrays would do it in one round-trip instead of N.

Deferred out of #45: at current/near-term scan volume the batches per flush interval are small, so the loop isn't a real bottleneck yet, and it matches the existing per-row idiom in `repo_evidence.rs`. Worth revisiting if flush batch sizes grow enough that per-row round-trips inside the transaction show up in practice.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions