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:
Silvan
2025-06-06 10:48:29 +02:00
committed by GitHub
parent 647b3b57cf
commit 4df138286b
26 changed files with 225 additions and 689 deletions

View File

@@ -1204,7 +1204,7 @@ func TestTextQuery_comp(t *testing.T) {
Compare: TextEqualsIgnoreCase,
},
want: want{
query: sq.ILike{"test_table.test_col": "Hurst"},
query: sq.Like{"LOWER(test_table.test_col)": "hurst"},
},
},
{
@@ -1226,7 +1226,7 @@ func TestTextQuery_comp(t *testing.T) {
Compare: TextNotEqualsIgnoreCase,
},
want: want{
query: sq.NotILike{"test_table.test_col": "Hurst"},
query: sq.NotLike{"LOWER(test_table.test_col)": "hurst"},
},
},
{
@@ -1237,7 +1237,7 @@ func TestTextQuery_comp(t *testing.T) {
Compare: TextEqualsIgnoreCase,
},
want: want{
query: sq.ILike{"test_table.test_col": "Hu\\%\\%rst"},
query: sq.Like{"LOWER(test_table.test_col)": "hu\\%\\%rst"},
},
},
{
@@ -1270,7 +1270,7 @@ func TestTextQuery_comp(t *testing.T) {
Compare: TextStartsWithIgnoreCase,
},
want: want{
query: sq.ILike{"test_table.test_col": "Hurst%"},
query: sq.Like{"LOWER(test_table.test_col)": "hurst%"},
},
},
{
@@ -1281,7 +1281,7 @@ func TestTextQuery_comp(t *testing.T) {
Compare: TextStartsWithIgnoreCase,
},
want: want{
query: sq.ILike{"test_table.test_col": "Hurst\\%%"},
query: sq.Like{"LOWER(test_table.test_col)": "hurst\\%%"},
},
},
{
@@ -1314,7 +1314,7 @@ func TestTextQuery_comp(t *testing.T) {
Compare: TextEndsWithIgnoreCase,
},
want: want{
query: sq.ILike{"test_table.test_col": "%Hurst"},
query: sq.Like{"LOWER(test_table.test_col)": "%hurst"},
},
},
{
@@ -1325,7 +1325,7 @@ func TestTextQuery_comp(t *testing.T) {
Compare: TextEndsWithIgnoreCase,
},
want: want{
query: sq.ILike{"test_table.test_col": "%\\%Hurst"},
query: sq.Like{"LOWER(test_table.test_col)": "%\\%hurst"},
},
},
{
@@ -1351,14 +1351,14 @@ func TestTextQuery_comp(t *testing.T) {
},
},
{
name: "containts ignore case",
name: "contains ignore case",
fields: fields{
Column: testCol,
Text: "Hurst",
Compare: TextContainsIgnoreCase,
},
want: want{
query: sq.ILike{"test_table.test_col": "%Hurst%"},
query: sq.Like{"LOWER(test_table.test_col)": "%hurst%"},
},
},
{
@@ -1369,11 +1369,11 @@ func TestTextQuery_comp(t *testing.T) {
Compare: TextContainsIgnoreCase,
},
want: want{
query: sq.ILike{"test_table.test_col": "%\\%Hurst\\%%"},
query: sq.Like{"LOWER(test_table.test_col)": "%\\%hurst\\%%"},
},
},
{
name: "list containts",
name: "list contains",
fields: fields{
Column: testCol,
Text: "Hurst",