index url and use it to find honks
Ted Unangst tedu@tedunangst.com
Tue, 27 Feb 2024 16:56:32 -0500
3 files changed,
8 insertions(+),
3 deletions(-)
M
database.go
→
database.go
@@ -179,7 +179,7 @@ return users
} func getxonk(userid int64, xid string) *Honk { - row := stmtOneXonk.QueryRow(userid, xid) + row := stmtOneXonk.QueryRow(userid, xid, xid) return scanhonk(row) }@@ -1243,7 +1243,7 @@ selecthonks := "select honks.honkid, honks.userid, username, what, honker, oonker, honks.xid, rid, dt, url, audience, noise, precis, format, convoy, whofore, flags from honks join users on honks.userid = users.userid "
limit := " order by honks.honkid desc limit 250" smalllimit := " order by honks.honkid desc limit ?" butnotthose := " and convoy not in (select name from zonkers where userid = ? and wherefore = 'zonvoy' order by zonkerid desc limit 100)" - stmtOneXonk = preparetodie(db, selecthonks+"where honks.userid = ? and xid = ?") + stmtOneXonk = preparetodie(db, selecthonks+"where honks.userid = ? and (xid = ? or url = ?)") stmtAnyXonk = preparetodie(db, selecthonks+"where xid = ? and what <> 'bonk' order by honks.honkid asc") stmtOneBonk = preparetodie(db, selecthonks+"where honks.userid = ? and xid = ? and what = 'bonk' and whofore = 2") stmtPublicHonks = preparetodie(db, selecthonks+"where whofore = 2 and dt > ?"+smalllimit)
M
schema.sql
→
schema.sql
@@ -12,6 +12,7 @@ create table hfcs (hfcsid integer primary key, userid integer, json text);
create table tracks (xid text, fetches text); create index idx_honksxid on honks(xid); +create index idx_honksurl on honks(url); create index idx_honksconvoy on honks(convoy); create index idx_honkshonker on honks(honker); create index idx_honksoonker on honks(oonker);
M
upgradedb.go
→
upgradedb.go
@@ -23,7 +23,7 @@
"humungus.tedunangst.com/r/webs/htfilter" ) -var myVersion = 48 // chat keys +var myVersion = 49 // index honks url type dbexecer interface { Exec(query string, args ...interface{}) (sql.Result, error)@@ -210,6 +210,10 @@ }
setV(48) fallthrough case 48: + try("create index idx_honksurl on honks(url)") + setV(49) + fallthrough + case 49: try("analyze") closedatabases()