From 386dc6f79869c72813ea75235c42ba7ff22376e8 Mon Sep 17 00:00:00 2001 From: Ted Unangst Date: Mon, 11 Sep 2023 21:34:05 -0400 Subject: [PATCH] fix slow public queries with a special index just for you --- docs/changelog.txt | 4 ++++ schema.sql | 1 + upgradedb.go | 6 +++++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/docs/changelog.txt b/docs/changelog.txt index d7d745a..987b4b2 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -1,5 +1,9 @@ changelog +### next + ++ Finally fix slow public queries. + ### 1.1.1 Required Refinement + Fix help file stylesheet link. diff --git a/schema.sql b/schema.sql index 1ce0071..6816987 100644 --- a/schema.sql +++ b/schema.sql @@ -15,6 +15,7 @@ create index idx_honksxid on honks(xid); create index idx_honksconvoy on honks(convoy); create index idx_honkshonker on honks(honker); create index idx_honksoonker on honks(oonker); +create index idx_honkswhotwo on honks(whofore) where whofore = 2; create index idx_donkshonk on donks(honkid); create index idx_donkschonk on donks(chonkid); create index idx_honkerxid on honkers(xid); diff --git a/upgradedb.go b/upgradedb.go index c15bb84..62f9d08 100644 --- a/upgradedb.go +++ b/upgradedb.go @@ -23,7 +23,7 @@ import ( "humungus.tedunangst.com/r/webs/htfilter" ) -var myVersion = 45 +var myVersion = 46 // idx whotwo type dbexecer interface { Exec(query string, args ...interface{}) (sql.Result, error) @@ -172,6 +172,10 @@ func upgradedb() { tx = nil fallthrough case 45: + try("create index idx_honkswhotwo on honks(whofore) where whofore = 2") + setV(46) + fallthrough + case 46: try("analyze") default: