Skip to content

Order users list in the database rather than in memory#2050

Closed
DavidBiddle wants to merge 1 commit into
mainfrom
order-users-in-database
Closed

Order users list in the database rather than in memory#2050
DavidBiddle wants to merge 1 commit into
mainfrom
order-users-in-database

Conversation

@DavidBiddle
Copy link
Copy Markdown
Contributor

@DavidBiddle DavidBiddle commented Jul 2, 2025

What problem does this pull request solve?

Trello card: https://trello.com/c/UXjZG0ZG/2946-improve-load-speed-on-users-page

This is an attempt to fix the performance issue we see on the Users page doing the ordering in the database query, rather than ordering the items in memory in the app after they've been fetched from the database.

Things to consider when reviewing

  • Ensure that you consider the wider context.
  • Does it work when run on your machine?
  • Is it clear what the code is doing?
  • Do the commit messages explain why the changes were made?
  • Are there all the unit tests needed?
  • Do the end to end tests need updating before these changes will pass?
  • Has all relevant documentation been updated?

@DavidBiddle DavidBiddle force-pushed the order-users-in-database branch from f4202f0 to b14fc5b Compare July 2, 2025 14:42
@DavidBiddle
Copy link
Copy Markdown
Contributor Author

I haven't figured out how to test this yet, since the issue is only noticeable in prod

@DavidBiddle DavidBiddle force-pushed the order-users-in-database branch 2 times, most recently from ed02b1f to 1cadad6 Compare July 4, 2025 12:49
@theseanything
Copy link
Copy Markdown
Contributor

Think this is a good idea regardless, our current implementation is causes a database query per user (i.e. 2000+ query's to load the users page) due to the user.organisation&.name, which means it needs to fetch each organisation individually.

@DavidBiddle DavidBiddle force-pushed the order-users-in-database branch from 1cadad6 to 7956984 Compare July 28, 2025 07:56
@sonarqubecloud
Copy link
Copy Markdown

@DavidBiddle DavidBiddle force-pushed the order-users-in-database branch from 7956984 to 224ad7b Compare September 16, 2025 10:27
@sonarqubecloud
Copy link
Copy Markdown

@DavidBiddle DavidBiddle marked this pull request as ready for review September 16, 2025 10:28
@github-actions
Copy link
Copy Markdown

🎉 A review copy of this PR has been deployed! You can reach it at: https://pr-2050.admin.review.forms.service.gov.uk/

It may take 5 minutes or so for the application to be fully deployed and working. If it still isn't ready
after 5 minutes, there may be something wrong with the ECS task. You will need to go to the integration AWS account
to debug, or otherwise ask an infrastructure person.

For the sign in details and more information, see the review apps wiki page.

@DavidBiddle DavidBiddle marked this pull request as draft September 18, 2025 09:03
@stephencdaly
Copy link
Copy Markdown
Contributor

This was included in #2229

@DavidBiddle DavidBiddle deleted the order-users-in-database branch October 27, 2025 10:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants