element-hq / element-hq/synapse

Fetching event reports can be slow

Open
#16,619 0 comments 0 reactions 0 assignees View on GitHub
A-Admin-API A-Database A-Moderation A-Performance O-Uncommon S-Minor T-Defect T-Enhancement
Dominant language
Python
Stars
4.6k
Forks
600
Avg merge
5d 22h
Merged PRs (30d)
51

Description

This issue has been migrated from [#16619](https://github.com/matrix-org/synapse/issues/16619).

---

E.g. from Jaeger:
![image](https://github.com/matrix-org/synapse/assets/8614563/219d0b86-b8a1-4236-9f60-c8fee5000811)

![image](https://github.com/matrix-org/synapse/assets/8614563/f514ea58-9c76-4e93-9377-8d5f7625d102)

My money is on LIMIT ... OFFSET ... being slow. I wonder if we could change this to paginate without OFFSET using the `id` column? (I assume that `received_ts` increases as `id` increases, and vice versa).

Contributor guide

Open the contributing guide

Research direction

The issue provides Jaeger traces but no source file or test. Start by locating the event-report fetch query and reviewing the traces; compare the current LIMIT/OFFSET path with id-based pagination. Done means the reported event-report fetch latency is addressed and verified.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, sql
Domain
backend, databases, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.