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 awa.jobs with ON CONFLICT DO NOTHING for unique jobs. Accepts &mut PgConnection so callers can use pool connections or transactions (Transaction derefs to PgConnection).