Skip to content

Compile the per-row formats used to build batched DELETEs - #2513

Open
Komzpa wants to merge 1 commit into
osm2pgsql-dev:masterfrom
Komzpa:perf/compile-delete-id-formats
Open

Komzpa wants to merge 1 commit into
osm2pgsql-dev:masterfrom
Komzpa:perf/compile-delete-id-formats

Conversation

@Komzpa

@Komzpa Komzpa commented Dec 4, 2026

Copy link
Copy Markdown
Contributor

The append path builds batched DELETE statements by formatting each OSM ID, or each type/ID pair, into the same SQL buffer. Compile the three fixed row formats so fmt can write them without parsing the format string for each row.

For 100,000 IDs, median SQL preparation took 1.02 ms instead of 1.89 ms for the ID list and 2.03 ms instead of 3.01 ms for typed rows (22 measurements each). The generated statements matched byte for byte, including negative IDs and both signed 64-bit extremes. Applying the multipolygon change fixture also produced identical output tables on PostgreSQL 19.

Codex assisted with the patch, measurements and PR text.

@lonvia

lonvia commented Dec 4, 2026

Copy link
Copy Markdown
Collaborator

What is the performance gain on real-world OSM data?

Why only replace those three FMT_STRING statements? What's with the others? Is it not possible to replace them or just not worth it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants