From 9560c1f8bd8bda1a5d3b8d919b8265c1189d4b1b Mon Sep 17 00:00:00 2001 From: "C. McEnroe" Date: Fri, 7 May 2021 18:03:03 -0400 Subject: 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. --- scoop.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'scoop.c') 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); } -- cgit 1.4.1