diff --git a/crates/radicle/src/node/db.rs b/crates/radicle/src/node/db.rs index d717ec6fd..5a417b75f 100644 --- a/crates/radicle/src/node/db.rs +++ b/crates/radicle/src/node/db.rs @@ -40,6 +40,7 @@ const MIGRATIONS: &[&str] = &[ include_str!("db/migrations/7.sql"), include_str!("db/migrations/8.sql"), include_str!("db/migrations/9.sql"), + include_str!("db/migrations/10.sql"), ]; #[derive(Error, Debug)] diff --git a/crates/radicle/src/node/db/migrations/10.sql b/crates/radicle/src/node/db/migrations/10.sql new file mode 100644 index 000000000..6fb00e727 --- /dev/null +++ b/crates/radicle/src/node/db/migrations/10.sql @@ -0,0 +1,5 @@ +-- `get_inventory` looks routing entries up by node alone, once per inbound +-- inventory announcement. The table's only index is the implicit one for the +-- primary key `(repo, node)`, whose leading column is `repo`, so that lookup +-- scans -- tens of thousands of rows on a seed following a busy network. +create index if not exists "routing_node" on "routing" ("node");