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.
This commit is contained in:
Damien Elmes 2020-05-07 19:10:27 +10:00
parent 2413f286b1
commit 4c9b6be832

View file

@ -150,7 +150,7 @@ impl SqliteStorage {
) -> Result<Vec<(NoteTypeID, NoteID)>> {
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)?)))?