mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-11 21:27:42 +00:00
perf(query): reduce user query duration (#10037)
# Which Problems Are Solved The resource usage to query user(s) on the database was high and therefore could have performance impact. # How the Problems Are Solved Database queries involving the users and loginnames table were improved and an index was added for user by email query. # Additional Changes - spellchecks - updated apis on load tests # additional info needs cherry pick to v3
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"reflect"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
sq "github.com/Masterminds/squirrel"
|
||||
@@ -334,23 +335,23 @@ func (q *textQuery) comp() sq.Sqlizer {
|
||||
case TextNotEquals:
|
||||
return sq.NotEq{q.Column.identifier(): q.Text}
|
||||
case TextEqualsIgnoreCase:
|
||||
return sq.ILike{q.Column.identifier(): q.Text}
|
||||
return sq.Like{"LOWER(" + q.Column.identifier() + ")": strings.ToLower(q.Text)}
|
||||
case TextNotEqualsIgnoreCase:
|
||||
return sq.NotILike{q.Column.identifier(): q.Text}
|
||||
return sq.NotLike{"LOWER(" + q.Column.identifier() + ")": strings.ToLower(q.Text)}
|
||||
case TextStartsWith:
|
||||
return sq.Like{q.Column.identifier(): q.Text + "%"}
|
||||
case TextStartsWithIgnoreCase:
|
||||
return sq.ILike{q.Column.identifier(): q.Text + "%"}
|
||||
return sq.Like{"LOWER(" + q.Column.identifier() + ")": strings.ToLower(q.Text) + "%"}
|
||||
case TextEndsWith:
|
||||
return sq.Like{q.Column.identifier(): "%" + q.Text}
|
||||
case TextEndsWithIgnoreCase:
|
||||
return sq.ILike{q.Column.identifier(): "%" + q.Text}
|
||||
return sq.Like{"LOWER(" + q.Column.identifier() + ")": "%" + strings.ToLower(q.Text)}
|
||||
case TextContains:
|
||||
return sq.Like{q.Column.identifier(): "%" + q.Text + "%"}
|
||||
case TextContainsIgnoreCase:
|
||||
return sq.ILike{q.Column.identifier(): "%" + q.Text + "%"}
|
||||
return sq.Like{"LOWER(" + q.Column.identifier() + ")": "%" + strings.ToLower(q.Text) + "%"}
|
||||
case TextListContains:
|
||||
return &listContains{col: q.Column, args: []interface{}{q.Text}}
|
||||
return &listContains{col: q.Column, args: []any{q.Text}}
|
||||
case textCompareMax:
|
||||
return nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user