zulip/zerver
Alex Vandiver 11a1cb9630 narrow: Skip the realm_id limit on joins across to usermessage.
The unique index on `(user_id, message_id)` that is the
`zerver_usermessage` table is rather specific, and even the PostgreSQL
extended statistics are not enough for it to realize there is a
correlation between the `realm_id` in the message table and the
`user_id` in the usermessage table.  This means that adding the
`realm_id` limit when there is a join to `zerver_usermessage` flips
the query plan from a nested loop of unique usermessage index-only
scan, with an index scan of the messages pkey -- to a parallel hash
join of the messages limit with a index scan of just the user_id limit
on usermessages.  It thinks this is necessary because it thinks that
the `realm_id` limit may remove a large number of messages from the
usermessage set -- which is totally untrue.

Remove the `realm_id` limit if we have a usermessage join.
2023-09-21 13:58:34 -07:00
..
actions build_message_send_dict: Remove redundant realm arg. 2023-09-20 09:55:25 -07:00
data_import python: Elide unnecessary list wrappers. 2023-09-13 12:41:23 -07:00
integration_fixtures/nagios
lib narrow: Skip the realm_id limit on joins across to usermessage. 2023-09-21 13:58:34 -07:00
management management: Rename command reactivate_stream -> unarchive_stream. 2023-09-19 15:03:33 -07:00
migrations user_settings: Add new `web_stream_unreads_count_display_policy` field. 2023-09-13 18:45:45 -07:00
openapi api-docs: Remove unused PartiallyCompleted schema. 2023-09-20 10:38:01 -07:00
tests narrow: Skip the realm_id limit on joins across to usermessage. 2023-09-21 13:58:34 -07:00
tornado python: Delete superfluous parens. 2023-09-13 13:40:19 -07:00
transaction_tests docs: Fix typos caught by ‘typos’. 2023-09-06 18:59:05 -07:00
views views: Add a /health healthcheck endpoint. 2023-09-20 09:53:59 -07:00
webhooks python: Delete superfluous parens. 2023-09-13 13:40:19 -07:00
worker python: Replace functools.partial with type-safe returns.curry.partial. 2023-09-11 18:03:45 -07:00
__init__.py
apps.py
context_processors.py
decorator.py logging_util: Remove dependence on get_current_request. 2023-07-11 22:23:47 -07:00
filters.py error_notify: Remove custom email error reporting handler. 2023-07-20 11:00:09 -07:00
forms.py python: Convert translated positional {} fields to {named} fields. 2023-07-18 15:19:07 -07:00
logging_handlers.py error_notify: Remove custom email error reporting handler. 2023-07-20 11:00:09 -07:00
middleware.py views: Add a /health healthcheck endpoint. 2023-09-20 09:53:59 -07:00
models.py user_settings: Add new `web_stream_unreads_count_display_policy` field. 2023-09-13 18:45:45 -07:00
signals.py demo-orgs: Create dev environment demo organization without email. 2023-08-31 15:02:16 -07:00