Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Database: Order results in UserSearch by username/email #23328

Merged
merged 2 commits into from
Apr 3, 2020

Conversation

aknuds1
Copy link
Contributor

@aknuds1 aknuds1 commented Apr 3, 2020

What this PR does / why we need it:
Ensure that the user list on the admin page is ordered by username first and email address second.

Also adding an index on (user.login, user.email) for speedy ordering.

I've checked with MariaDB (MySQL compatible) and it looks as if the new index gets used:

MariaDB [grafana]> explain select id, login,email from user order by login ASC, email ASC\G
*************************** 1. row ***************************
           id: 1
  select_type: SIMPLE
        table: user
         type: index
possible_keys: NULL
          key: IDX_user_login_email
      key_len: 1524
          ref: NULL
         rows: 1
        Extra: Using index
1 row in set (0.000 sec)

Which issue(s) this PR fixes:
Fixes #22348.

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
@aknuds1 aknuds1 requested a review from a team as a code owner April 3, 2020 14:25
@aknuds1 aknuds1 requested review from papagian and marefr and removed request for a team April 3, 2020 14:25
@aknuds1 aknuds1 requested a review from kylebrandt April 3, 2020 14:41
@kylebrandt
Copy link
Contributor

Have you done a describe on say at least mysql to make sure we not changing the performance characteristics (e.g. index needed?).

@aknuds1
Copy link
Contributor Author

aknuds1 commented Apr 3, 2020

@kylebrandt Good point! I included you as a reviewer for a reason ;)

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
@aknuds1 aknuds1 self-assigned this Apr 3, 2020
@aknuds1 aknuds1 changed the title services/sqlstore: Order results in UserSearch by username/email WIP: services/sqlstore: Order results in UserSearch by username/email Apr 3, 2020
@aknuds1 aknuds1 changed the title WIP: services/sqlstore: Order results in UserSearch by username/email services/sqlstore: Order results in UserSearch by username/email Apr 3, 2020
@aknuds1
Copy link
Contributor Author

aknuds1 commented Apr 3, 2020

@kylebrandt Index is added now.

Copy link
Contributor

@marefr marefr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great. LGTM

@aknuds1 aknuds1 merged commit 0fd6eda into master Apr 3, 2020
@aknuds1 aknuds1 deleted the bugfix/fix-22348 branch April 3, 2020 17:15
@marefr marefr added this to the 7.0-beta1 milestone Apr 28, 2020
@marefr marefr changed the title services/sqlstore: Order results in UserSearch by username/email Database: Order results in UserSearch by username/email Apr 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Users list on server admin page is not alphabetically ordered
3 participants