retention: Eliminate join with Recipient table when archiving DMs.

We can use the is_channel_message column instead of doing the join to
filter on recipient type.
This commit is contained in:
Mateusz Mandera
2025-08-16 04:07:35 +08:00
committed by Tim Abbott
parent fd4104f365
commit 4e3ec77a0f
2 changed files with 3 additions and 7 deletions

View File

@@ -218,7 +218,7 @@ class Message(AbstractMessage):
name="zerver_message_realm_sender_recipient",
),
models.Index(
# For analytics queries
# For analytics and retention queries
"realm_id",
"date_sent",
name="zerver_message_realm_date_sent",