Skip to content

Python tool for aircraft Doppler audio geolocation using historical ADS-B flight data (Source-available)

perf(#7): drop unused retention indexes (#379)

Cinna Daviseaee70730ff4
diff --git a/src/dopplergeist/finite_search.py b/src/dopplergeist/finite_search.py
index 101e536..e368d11 100644
--- a/src/dopplergeist/finite_search.py
+++ b/src/dopplergeist/finite_search.py
@@ -132,10 +132,10 @@ class RetentionLedger:
occurrences INTEGER, duplicates INTEGER, kept TEXT);
CREATE TABLE IF NOT EXISTS records(stage TEXT, mode_id TEXT, score REAL,
groups_count INTEGER, kind TEXT, seed TEXT, PRIMARY KEY(stage,mode_id));
- CREATE INDEX IF NOT EXISTS mode_index ON records(mode_id);
CREATE TABLE IF NOT EXISTS bounds(stage TEXT, bound_id TEXT, upper_score REAL,
groups_count INTEGER, detail TEXT, PRIMARY KEY(stage,bound_id));
- CREATE INDEX IF NOT EXISTS bound_index ON bounds(bound_id);
+ DROP INDEX IF EXISTS mode_index;
+ DROP INDEX IF EXISTS bound_index;
""")
# Saved stages are checksum-verified before reuse and evidence.
# Opening a national ledger must not scan its entire database.
diff --git a/tests/test_real_retention_index.py b/tests/test_real_retention_index.py
index 3b6a366..2f2f387 100644
--- a/tests/test_real_retention_index.py
+++ b/tests/test_real_retention_index.py
@@ -10,6 +10,7 @@ from dopplergeist.tiled_search import merge_candidates
def damage_mode_index(path, missing_id, replacement_id):
"""Replace only the tiny index leaf; leave the real records/checksums intact."""
with sqlite3.connect(path) as db:
+ db.execute("CREATE INDEX IF NOT EXISTS mode_index ON records(mode_id)")
page_size = db.execute("PRAGMA page_size").fetchone()[0]
root = db.execute("SELECT rootpage FROM sqlite_master WHERE name='mode_index'").fetchone()[0]
entries = db.execute("SELECT rowid,mode_id FROM records NOT INDEXED").fetchall()