# Sixty-four single-row inserts, replaced with one

A repo's LOC-census ingest issued up to 64 single-row INSERTs per run. Batched into one multi-row INSERT for $12.79.

Source: https://codeherder.com/examples/loccensus-batch-insert/

Examples · Maintenance

Replaced the per-area insert loop with one multi-row INSERT, built the same way an existing webhook batching helper already does it.

[Request access →](https://codeherder.com/get-started/#request-access)

Measured from this task's real merge.

Every repo's LOC-census ingest re-inserted its per-area breakdown rows one at a time, inside the same transaction as the snapshot upsert: up to 64 round trips for a batch already capped at 64 rows.

What was asked for

> internal/loccensus's Ingest re-inserts every per-area breakdown row one at a time inside the same transaction as the snapshot upsert, up to 64 single-row INSERTs per ingest instead of one multi-row INSERT.

Filed by a developer, routed by capability (go).

What the herd did

1. plan
2. code
3. review
4. merge
5. verify
6. done

What it changed

The merge touched 2 files (+61 −13). Among them:

- `internal/loccensus/repo.go`
- `internal/loccensus/repo_test.go`

What it cost

$12.79 in model spend, 314 agent turns, and 3h 26m from filed to merged. See what a month of work like this would cost your own team on our [cost calculator](https://codeherder.com/calculator).

A loop bounded at 64 iterations is still 64 round trips worth collapsing into one.
