-
Bug
-
Resolution: Fixed
-
Medium
-
7.1.0, 7.1.1, 7.1.2, 7.1.4, 7.1.7, 7.1.9
-
7.01
-
NOTE: This bug report is for JIRA Server. Using JIRA Cloud? See the corresponding bug report.
Summary
The DefaultUserPickerSearchService builds a query that is very slow to run on instances with many users. It seems to run faster for searches on short usernames compared to searches on long usernames (e.g. a search for "b" runs much faster than a search for "bhas").
This causes features such as mentions to perform poorly on instances with many users (e.g. JAC).
Environment
This performance problem is more evident on instances with many users, such as JAC. For local testing, you can use the JIRA Data Generator Plugin to create many users (about 50,000 is necessary to start seeing a significant problem).
Steps to reproduce
- Hit an endpoint which uses the user search service e.g. https://jira.atlassian.com/rest/api/2/user/viewissue/search?username=bhas&issueKey=JRA-59658
Expected result
Response comes back in less than 100ms.
Actual result
Response comes back in ~2.5s
Notes
DefaultUserPickerSearchService ends up creating the following query:
SELECT ID, directory_id, user_name, lower_user_name, active, created_date, updated_date, first_name, lower_first_name, last_name, lower_last_name, display_name, lower_display_name, email_address, lower_email_address, CREDENTIAL, deleted_externally, EXTERNAL_ID FROM PUBLIC.cwd_user WHERE (((lower_user_name LIKE ? ) OR (lower_user_name LIKE ? ) OR (lower_user_name LIKE ? ) OR (lower_user_name LIKE ? ) OR (lower_user_name LIKE ? ) OR (lower_user_name LIKE ? ) OR (lower_user_name LIKE ? ) OR (lower_user_name LIKE ? ) OR (lower_user_name LIKE ? ) OR (lower_display_name LIKE ? ) OR (lower_display_name LIKE ? ) OR (lower_display_name LIKE ? ) OR (lower_display_name LIKE ? ) OR (lower_display_name LIKE ? ) OR (lower_display_name LIKE ? ) OR (lower_display_name LIKE ? ) OR (lower_display_name LIKE ? ) OR (lower_display_name LIKE ? )) AND (active = ? )) AND (directory_id = ? ) ORDER BY lower_user_name LIMIT 100
Where each LIKE is prepending a separator to the search query e.g. if you search for "Broo" it will create a LIKE for: " Broo", "-Broo", "(Broo" etc. This is so a search for "Broo" will return a user like "Mike Cannon-Brookes". The query above can be even worse if the search is also including results for users whose email address matches, as it will add another 8 LIKE clauses to the above query.
Workaround
There is no workaround for this issue.
- causes
-
JRASERVER-62628 Duplicate entries for users in user picker fields
- Closed
- is incorporated by
-
JRASERVER-65126 Implement Lucene in-memory index for users
- Closed
- relates to
-
JRASERVER-72101 Performance regression in user lookup
- Closed
-
JRACLOUD-60532 Slow query in user picker : DefaultUserPickerSearchService
- Closed
-
JRASERVER-65057 JIRA Assignee dropdown doesn't return expected number of assignable users.
- Closed
- mentioned in
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
- was cloned as
-
JDEV-37316 Loading...
-
RUN-55 Loading...