Make live route writes cheaper so the prefix handler keeps up (closes #96)
check / check (push) Canceled after 0s

The live route tables lose their random UUID key: the row id, which the
prefix-length sample draws, is now declared as the integer key. The prefix
tables are keyed by the prefix, without the UUID or the duplicate index.
A route update sets only the columns that change, so SQLite no longer
rewrites the mask length indexes on every update, nor the origin index
while the origin AS stays the same. Each kept index names the queries
that use it. BenchmarkPrefixBatchOnFiveMillionRoutes, run by hand, times
one 25,000-update batch on 5 million routes.

Model: opus-5-5
This commit is contained in:
2026-10-19 11:58:03 +00:00
parent 5806ddaef7
commit 1f612642e3
8 changed files with 439 additions and 149 deletions
-2
View File
@@ -37,7 +37,6 @@ type ASN struct {
// Prefix represents an IP prefix (CIDR block) with its IP version (4 or 6)
// and first/last seen timestamps.
type Prefix struct {
ID uuid.UUID
Prefix string
IPVersion int // 4 or 6
FirstSeen time.Time
@@ -71,7 +70,6 @@ type ASNPeering struct {
//
//nolint:tagliatelle // field names are the existing JSON API
type LiveRoute struct {
ID uuid.UUID `json:"id"`
Prefix string `json:"prefix"`
MaskLength int `json:"mask_length"`
IPVersion int `json:"ip_version"`