From c424a2510e1fc88f8825cc9987e17f8d515463d3 Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Tue, 19 Jan 2021 16:55:45 +1100 Subject: [PATCH] Create index on blob(last_used) --- storage/sqlite/sqlite-storage.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/storage/sqlite/sqlite-storage.go b/storage/sqlite/sqlite-storage.go index 8ec4d5a6..0e1edd1b 100644 --- a/storage/sqlite/sqlite-storage.go +++ b/storage/sqlite/sqlite-storage.go @@ -73,6 +73,8 @@ func InitSchema(conn conn, pageSize int, triggers bool) error { key text primary key, value ); + + create index if not exists blob_last_used on blob(last_used); -- While sqlite *seems* to be faster to get sum(length(data)) instead of -- sum(length(cast(data as blob))), it may still require a large table scan at start-up or with a -- 2.48.1