Skip to main content

insert_many_copy

Function insert_many_copy 

Source
pub async fn insert_many_copy(
    conn: &mut PgConnection,
    jobs: &[InsertParams],
) -> Result<Vec<JobRow>, AwaError>
Expand description

Insert many jobs using COPY for high throughput.

Uses a temp staging table with no constraints for fast COPY ingestion, then INSERT…SELECT into the canonical storage tables. Unique jobs are claimed in bulk against awa.job_unique_claims before insert so conflicting rows are skipped without falling back to per-row savepoints. Accepts &mut PgConnection so callers can use pool connections or transactions (Transaction derefs to PgConnection).