diff --git a/src/db.rs b/src/db.rs index 15dbbb6..921a980 100644 --- a/src/db.rs +++ b/src/db.rs @@ -65,6 +65,10 @@ async fn create_missing(orm: &sea_orm::DatabaseConnection) -> Result<()> { } for sql in [ "CREATE INDEX IF NOT EXISTS enclosures_entry ON enclosures (feed_id, guid)", + // The few rows with a file on disk, 15 of the server's many thousand: counting a person's + // files through enclosures_entry read every file row of their feeds, 58 ms a feed list + // (#165). Also what the healthcheck's count and the Downloaded filter look for. + "CREATE INDEX IF NOT EXISTS enclosures_on_disk ON enclosures (feed_id, guid) WHERE path IS NOT NULL", "CREATE UNIQUE INDEX IF NOT EXISTS users_name_lower ON users (lower(name))", ] { orm.execute_unprepared(sql).await.with_context(|| sql.to_owned())?;