summary refs log tree commit diff
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
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.14
-rw-r--r--scoop.c6
2 files changed, 7 insertions, 3 deletions
diff --git a/scoop.1 b/scoop.1
index 693c033..480e8be 100644
--- a/scoop.1
+++ b/scoop.1
@@ -1,4 +1,4 @@
-.Dd April 28, 2021
+.Dd May  7, 2021
 .Dt SCOOP 1
 .Os
 .
@@ -148,7 +148,7 @@ Match events from users with the hostname
 .
 .It Fl l Ar limit
 Limit the number of events matched,
-ordered by most recent.
+ordered by most recently inserted.
 Implies
 .Fl s .
 .
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);
 	}