Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Speed up user directory rebuild for users some more... #15665

Merged
merged 6 commits into from
May 24, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion synapse/storage/databases/main/user_directory.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ async def _populate_user_directory_process_users(
"""

def _get_next_batch(txn: LoggingTransaction) -> Optional[List[str]]:
sql = "SELECT user_id FROM %s LIMIT %s" % (
sql = "SELECT user_id FROM %s ORDER BY user_id LIMIT %s" % (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd be tempted to add a comment here explaining that the order doesn't matter to us, but it makes the query planner use the index.

TEMP_TABLE + "_users",
str(batch_size),
)
Expand Down