/events/past: 33 queries and ~466ms median per render
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 58/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- rails, ruby
- Domain
- backend, performance
Research direction
Start by re-measuring GET /events/past and tracing EventsController#past through paginated_events, load_events, fetch_past_events, EventPresenter.decorate_collection, and EventCardComponent.with_collection. Capture the queries during decoration and rendering, then verify that query count and median duration improve while UNION order and ETag behavior remain unchanged; compare findings with #2888.
Written by the indexing model from the issue text.
Description
Summary
GET /events/past (EventsController#past) takes a median 466ms per render (max 17.3s) and issues 33 queries (median db_runtime 80ms, view_runtime 118ms). The action sets an ETag via fresh_when, so conditional requests are cheap, but non-conditional clients (first visit, stale cache, most API clients) pay the full render every time.
The render path:
paginated_eventsruns a UNION ALL across Workshops, Meetings, and Events, counts at the DB level, and returns only the 20 rows for the current pageload_eventsruns threeeager_loadqueries (workshops, meetings, events) for those rowsfetch_past_eventsgroups the rows by date and wraps each in a presenter (EventPresenter.decorate_collection)- The view renders
EventCardComponent.with_collection— each card is fragment-cached (event_card_component/*keys in Solid Cache)
33 queries is well over the handful that steps 1–2 need, so something in decoration or rendering loads associations the current eager loads don't cover.
Measured
3h window on 2026-09-16/17, from production canonical logs: 127 requests, median 466ms, max 17.3s. Stale by the time you read this — re-measure before starting.
Suggested directions
- Capture the 33 queries locally (Bullet or Prosopite against a production dump) and identify the associations touched during decoration and card rendering beyond the current
eager_loadcalls - Add the missing associations to the eager loads or batch them into a single preload, preserving the UNION order
- Check the hit rate on the per-event fragments before adding more caching — they may already absorb most of the view time
Verify
Query count and median duration drop; ETag behaviour unchanged.
Related
- #2888 — the sibling
/events/upcomingaction, same code path; share findings - #2885 — same measurement window
- Dominant language
- Ruby
- Stars
- 104
- Forks
- 205
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 67
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from codebar/planner
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
-
good first issue performance
Difficulty 3/5 1-2 days Newbie friendliness 78/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
simp/pupmod-simp-simp#395 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
simp/pupmod-simp-rsyslog#219 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
simp/pupmod-simp-pupmod#256 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
simp/pupmod-simp-sudo#150 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100