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

Adding the correct indexes for the user table #588

Merged
merged 6 commits into from
Mar 15, 2024

Conversation

BentiGorlich
Copy link
Member

@BentiGorlich BentiGorlich commented Mar 15, 2024

This migration drastically improves the performance of our SQL query because the basic user fetch now takes < 1ms from ~50-60ms on gehirneimer.de

We already have indexes on the user table, however those are all lower(...) ones and we basically never query for x = lower(...) so these are basically never used. We do have unique indexes which do the same job, only for default queries, however the one for ap_profile_id was missing and the other ones cryptically named. This PR fixes that

@BentiGorlich BentiGorlich added the backend Backend related issues and pull requests label Mar 15, 2024
@BentiGorlich BentiGorlich self-assigned this Mar 15, 2024
- the `Table` attribute is not needed and the defined unique constraints are not working, replace them with the `UniqueConstraint` attribute which is working
- add a unique index for `ap_profile_id`
sadly it is needed, as the table name is not just `user`, but `"user"` which is not the default mapping
Copy link
Member

@e-five256 e-five256 left a comment

Choose a reason for hiding this comment

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

this worked for me, didn't see any issues, and doing a migration diff only had me drop the zitadel stuff since I had swapped branches from it, so I think the doctrine generation matches the schema

@BentiGorlich BentiGorlich merged commit f1f05e7 into main Mar 15, 2024
7 checks passed
@BentiGorlich BentiGorlich deleted the performance/user-indexes branch March 15, 2024 13:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend Backend related issues and pull requests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants