Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

analytics: Better indexed join to analytics_usercount, using realm_id.

Alex Vandiver94795500b5be
diff --git a/analytics/lib/counts.py b/analytics/lib/counts.py
index f3941b6f705..1fc9ce5fd48 100644
--- a/analytics/lib/counts.py
+++ b/analytics/lib/counts.py
@@ -768,6 +768,7 @@ def count_realm_active_humans_query(realm: Realm | None) -> QueryFn:
AND end_time = %(time_end)s
) active_usercount
JOIN zerver_userprofile ON active_usercount.user_id = zerver_userprofile.id
+ AND active_usercount.realm_id = zerver_userprofile.realm_id
JOIN (
SELECT DISTINCT ON (modified_user_id)
modified_user_id, event_type