mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-15 00:27:29 -06:00
[performance] Speed up some of the slower db queries (#523)
* remove unnecessary LOWER() db calls * warn during slow db queries * use bundb built-in exists function * add db block test * update account block query * add domain block db test * optimize domain block query * fix implementing wrong test * exclude most columns when checking block * go fmt * remote more unnecessary use of LOWER()
This commit is contained in:
parent
faae2505c0
commit
a5852fd7e4
13 changed files with 151 additions and 29 deletions
|
|
@ -47,6 +47,11 @@ func (q *debugQueryHook) AfterQuery(_ context.Context, event *bun.QueryEvent) {
|
|||
"operation": event.Operation(),
|
||||
})
|
||||
|
||||
if dur > 1*time.Second {
|
||||
l.Warnf("SLOW DATABASE QUERY [%s] %s", dur, event.Query)
|
||||
return
|
||||
}
|
||||
|
||||
if logrus.GetLevel() == logrus.TraceLevel {
|
||||
l.Tracef("[%s] %s", dur, event.Query)
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue