mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-15 22:37:33 -06:00
[feature/performance] Store account stats in separate table (#2831)
* [feature/performance] Store account stats in separate table, get stats from remote * test account stats * add some missing increment / decrement calls * change stats function signatures * rejig logging a bit * use lock when updating stats
This commit is contained in:
parent
f79d50b9b2
commit
3cceed11b2
43 changed files with 1285 additions and 450 deletions
|
|
@ -189,14 +189,14 @@ func (u *UpsertQuery) insertQuery() (*bun.InsertQuery, error) {
|
|||
constraintIDPlaceholders = append(constraintIDPlaceholders, "?")
|
||||
constraintIDs = append(constraintIDs, bun.Ident(constraint))
|
||||
}
|
||||
onSQL := "conflict (" + strings.Join(constraintIDPlaceholders, ", ") + ") do update"
|
||||
onSQL := "CONFLICT (" + strings.Join(constraintIDPlaceholders, ", ") + ") DO UPDATE"
|
||||
|
||||
setClauses := make([]string, 0, len(columns))
|
||||
setIDs := make([]interface{}, 0, 2*len(columns))
|
||||
for _, column := range columns {
|
||||
setClauses = append(setClauses, "? = ?")
|
||||
// "excluded" is a special table that contains only the row involved in a conflict.
|
||||
setClauses = append(setClauses, "? = excluded.?")
|
||||
setIDs = append(setIDs, bun.Ident(column), bun.Ident(column))
|
||||
setIDs = append(setIDs, bun.Ident(column), bun.Ident("excluded."+column))
|
||||
}
|
||||
setSQL := strings.Join(setClauses, ", ")
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue