Skip to content

the appender gate is about batching, not about a disk - #9

Merged
tamnd merged 1 commit into
mainfrom
appender-gate
Aug 18, 2026
Merged

tamnd merged 1 commit into
mainfrom
appender-gate

Conversation

@tamnd

@tamnd tamnd commented Aug 18, 2026

Copy link
Copy Markdown
Owner

test_appending_beats_inserting_by_the_margin_that_makes_it_worth_having failed on main: it asks for twenty times and got eighteen, on a runner where 200 INSERT statements took 524 ms and the appender took 28. Nothing regressed. A commit on a shared CI disk costs about twenty five milliseconds, the appender spends one of them, and that single commit is most of its 28 ms, so the ratio there is eighteen where it is 150 on a laptop.

The gate is five now. What the test is for is that rows go in batched rather than a commit at a time, and five says that on any disk, where twenty says it only on a disk nobody else is using. The number that would have made twenty comfortable is a bigger row count, and that half costs three seconds of INSERT at two hundred rows on this machine already, which is not worth buying a margin with.

Local: ruff check, ruff format --check, and pytest tests/test_appender.py, green.

The test that says an appender beats INSERT asked for twenty
times and got eighteen on a CI runner, where a commit costs
twenty five milliseconds of a disk shared with everybody else and
the appender's single commit is most of what it spends. The same
comparison is 150 times on a laptop, and it rises with the row
count either way, because one commit is one commit however many
rows it carries.

Five is the gate now, which is the number that says the rows were
batched rather than committed one at a time, and is not a number
a slow disk can take away. Raising the row count instead would
buy a wider margin at the price of seconds of INSERT per run,
since that half is three seconds at two hundred rows here.
@tamnd
tamnd merged commit 758f421 into main Aug 18, 2026
5 of 7 checks passed
@tamnd
tamnd deleted the appender-gate branch August 18, 2026 04:22
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.

1 participant