zulip/zerver
Steve Howell 2ff41bf9e5 /json/users: Use field.realm for realm lookup.
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.
2020-02-09 22:04:02 -08:00
..
data_import import: Support importing team icon from slack. 2020-02-03 14:09:05 -08:00
lib /json/users: Use field.realm for realm lookup. 2020-02-09 22:04:02 -08:00
management rate_limiter: Rename 'all' domain to 'api_by_user'. 2020-02-02 19:15:13 -08:00
migrations settings: Migrate to stream_post_policy structure. 2020-02-04 17:08:08 -08:00
openapi api: Rename subject_links to topic_links. 2020-02-07 14:35:22 -08:00
templatetags openapi: Pass api_url to curl example generation. 2019-08-17 11:35:08 -07:00
tests tests: Count queries for /json/users. 2020-02-09 22:04:02 -08:00
tornado tornado: Use common code for copying headers. 2020-02-07 16:14:19 -08:00
views api: Add an api endpoint for GET /users/{id} 2020-02-07 10:36:31 -08:00
webhooks webhooks/ansibletower: Update for AWX 9.1.1. 2020-02-02 20:21:03 -08:00
worker queue: Remove missedmessage_email_senders. 2020-01-31 12:13:51 -08:00
__init__.py
apps.py cleanup: Delete leading newlines. 2019-08-06 23:29:11 -07:00
context_processors.py login: Make authentication_methods data available to JavaScript. 2020-02-02 20:22:49 -08:00
decorator.py exceptions: Move default json_unauthorized string to response.py. 2020-02-05 15:40:10 -08:00
filters.py cleanup: Delete leading newlines. 2019-08-06 23:29:11 -07:00
forms.py rate_limiter: Limit the amount of password reset emails to one address. 2020-02-02 19:15:13 -08:00
logging_handlers.py version: Only let `git describe` match tags beginning with a digit. 2019-10-24 14:54:45 -07:00
middleware.py exceptions: RateLimited shouldn't inherit from PermissionDenied. 2020-02-02 19:15:00 -08:00
models.py presence: Move get_status_dicts_for_rows(). 2020-02-06 17:16:22 -08:00
signals.py onboarding: Use delivery_email in "new login" notifications. 2019-11-14 12:19:47 -08:00