From 4c9b6be8326e8361af6c627d48a160ee3fb08c64 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Thu, 7 May 2020 19:10:27 +1000 Subject: [PATCH] fetch notes in nid order May reduce the amount of seeking on conventional disks. Chunking and fetching batches of notes at once would improve things further, at the cost of more memory use. --- rslib/src/storage/notetype/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rslib/src/storage/notetype/mod.rs b/rslib/src/storage/notetype/mod.rs index 4211fe67f..ff76c92c0 100644 --- a/rslib/src/storage/notetype/mod.rs +++ b/rslib/src/storage/notetype/mod.rs @@ -150,7 +150,7 @@ impl SqliteStorage { ) -> Result> { let mut sql = String::from("select mid, id from notes where id in "); ids_to_string(&mut sql, nids); - sql += " order by mid"; + sql += " order by mid, id"; self.db .prepare(&sql)? .query_and_then(NO_PARAMS, |r| Ok((r.get(0)?, r.get(1)?)))?