mirror of https://github.com/zulip/zulip.git
2ff41bf9e5
This avoids an unnecessary join to UserProfile. To verify this, you can do `print(queries)` in the `test_get_custom_profile_fields_from_api` test. It's kinda noisy, so I excerpted them below... Before: SELECT ... FROM "zerver_customprofilefieldvalue" INNER JOIN "zerver_userprofile" ON ("zerver_customprofilefieldvalue"."user_profile_id" = "zerver_userprofile"."id") INNER JOIN "zerver_customprofilefield" ON ("zerver_customprofilefieldvalue"."field_id" = "zerver_customprofilefield"."id") WHERE "zerver_userprofile"."realm_id" = 2 After: SELECT ... FROM "zerver_customprofilefieldvalue" INNER JOIN "zerver_customprofilefield" ON ("zerver_customprofilefieldvalue"."field_id" = "zerver_customprofilefield"."id") WHERE "zerver_customprofilefield"."realm_id" = 2' I don't have any way to measure the two queries with realistic data, but I would assume the second query is significantly faster on most of our instances, since CustomProfileField should be tiny. |
||
---|---|---|
.. | ||
data_import | ||
lib | ||
management | ||
migrations | ||
openapi | ||
templatetags | ||
tests | ||
tornado | ||
views | ||
webhooks | ||
worker | ||
__init__.py | ||
apps.py | ||
context_processors.py | ||
decorator.py | ||
filters.py | ||
forms.py | ||
logging_handlers.py | ||
middleware.py | ||
models.py | ||
signals.py |