Sample the prefix-length pages with bounded lookups, each prefix once (closes #66)
check / check (push) Waiting to run

The prefix-length pages read every live route of that length and listed a
prefix once per peer sharing its newest time.

A length with at most 5000 prefixes now has its prefixes listed with one
index search each and 500 picked from them at random. A longer one is
sampled with random row id lookups on the mask length index, at most four
per prefix, topped up from the listed prefixes. Each picked prefix's newest
route is one search of a new index on prefix and last_updated, which
replaces the prefix-only index. Each prefix is listed once. Above 5000
prefixes the sample is uneven: a route is picked in proportion to the row
ids before it.

Model: opus-5-5
This commit was merged in pull request #79.
This commit is contained in:
2026-10-19 10:29:01 +02:00
parent ae6d885a5a
commit a0ddc0d254
3 changed files with 494 additions and 32 deletions
+4 -2
View File
@@ -124,7 +124,8 @@ CREATE TABLE IF NOT EXISTS live_routes_v6 (
);
-- Indexes for live_routes_v4 table
CREATE INDEX IF NOT EXISTS idx_live_routes_v4_prefix ON live_routes_v4(prefix);
-- Finds a prefix's newest route in one search, whatever the number of peers.
CREATE INDEX IF NOT EXISTS idx_live_routes_v4_prefix_last_updated ON live_routes_v4(prefix, last_updated);
CREATE INDEX IF NOT EXISTS idx_live_routes_v4_mask_length ON live_routes_v4(mask_length);
CREATE INDEX IF NOT EXISTS idx_live_routes_v4_origin_asn ON live_routes_v4(origin_asn);
CREATE INDEX IF NOT EXISTS idx_live_routes_v4_last_updated ON live_routes_v4(last_updated);
@@ -132,7 +133,8 @@ CREATE INDEX IF NOT EXISTS idx_live_routes_v4_last_updated ON live_routes_v4(las
CREATE INDEX IF NOT EXISTS idx_live_routes_v4_mask_prefix ON live_routes_v4(mask_length, prefix);
-- Indexes for live_routes_v6 table
CREATE INDEX IF NOT EXISTS idx_live_routes_v6_prefix ON live_routes_v6(prefix);
-- Finds a prefix's newest route in one search, whatever the number of peers.
CREATE INDEX IF NOT EXISTS idx_live_routes_v6_prefix_last_updated ON live_routes_v6(prefix, last_updated);
CREATE INDEX IF NOT EXISTS idx_live_routes_v6_mask_length ON live_routes_v6(mask_length);
CREATE INDEX IF NOT EXISTS idx_live_routes_v6_origin_asn ON live_routes_v6(origin_asn);
CREATE INDEX IF NOT EXISTS idx_live_routes_v6_last_updated ON live_routes_v6(last_updated);