about summary refs log tree commit diff
path: root/scoop.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2021-05-07 18:03:03 -0400
committerJune McEnroe <june@causal.agency>2021-05-07 18:06:37 -0400
commit9560c1f8bd8bda1a5d3b8d919b8265c1189d4b1b (patch)
tree1262acb4402345277f2f391254bef49fbe9fc2ab /scoop.c
parentFormat litterbox query interface results like scoop (diff)
downloadlitterbox-9560c1f8bd8bda1a5d3b8d919b8265c1189d4b1b.tar.gz
litterbox-9560c1f8bd8bda1a5d3b8d919b8265c1189d4b1b.zip
Order by rowids for scoop -l
This vastly improves the speed of the query, with the same effect
as the change to litterbox's query interface.
Diffstat (limited to '')
-rw-r--r--scoop.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/scoop.c b/scoop.c
index f1c0ed2..241c566 100644
--- a/scoop.c
+++ b/scoop.c
@@ -510,7 +510,11 @@ int main(int argc, char *argv[]) {
 	}
 
 	if (limit) {
-		append(where, SQL(ORDER BY time DESC, event DESC LIMIT :limit));
+		if (optind < argc) {
+			append(where, SQL(ORDER BY search.rowid DESC LIMIT :limit));
+		} else {
+			append(where, SQL(ORDER BY event DESC LIMIT :limit));
+		}
 		binds[n++] = Bind(":limit", limit, 0);
 	}