Skip to content

Broadside: generate historical jobs server-side via PostgreSQL#4711

Merged
mauriceyap merged 1 commit intomasterfrom
broadside-historical
Feb 23, 2026
Merged

Broadside: generate historical jobs server-side via PostgreSQL#4711
mauriceyap merged 1 commit intomasterfrom
broadside-historical

Conversation

@mauriceyap
Copy link
Collaborator

Replaces Go-side historical job generation (which looped in Go, built rows, and sent them over the network in small batches) with four server-side INSERT ... SELECT FROM generate_series statements. All data generation now happens inside PostgreSQL, eliminating network transfer of per-row data during setup.

For large historical datasets (e.g. 300M jobs) this reduces setup time from many hours to tens of minutes, with the remaining bottleneck being PostgreSQL I/O and index maintenance.

Also fixes two runtime bugs found against a real PostgreSQL instance (per-statement parameter binding; explicit ::bytea casts for CASE WHEN expressions), and a shutdown hang caused by pgxpool.Close blocking on internal health-check goroutines after the schema has been torn down.

Replaces Go-side historical job generation (which looped in Go,
built rows, and sent them over the network in small batches) with
four server-side INSERT ... SELECT FROM generate_series statements.
All data generation now happens inside PostgreSQL, eliminating network
transfer of per-row data during setup.

For large historical datasets (e.g. 300M jobs) this reduces setup
time from many hours to tens of minutes, with the remaining bottleneck
being PostgreSQL I/O and index maintenance.

Also fixes two runtime bugs found against a real PostgreSQL instance
(per-statement parameter binding; explicit ::bytea casts for CASE WHEN
expressions), and a shutdown hang caused by pgxpool.Close blocking on
internal health-check goroutines after the schema has been torn down.

Signed-off-by: Maurice Yap <mauriceyap@hotmail.co.uk>
@mauriceyap mauriceyap enabled auto-merge (squash) February 23, 2026 12:18
@mauriceyap mauriceyap merged commit d52e937 into master Feb 23, 2026
16 checks passed
@mauriceyap mauriceyap deleted the broadside-historical branch February 23, 2026 14:58
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