Skip to content

perf: optimize queries for the meeting materials page - #12025

Merged
jennifer-richards merged 7 commits into
ietf-tools:mainfrom
rjsparks:meeting-materials-queries
Dec 3, 2026
Merged

jennifer-richards merged 7 commits into
ietf-tools:mainfrom
rjsparks:meeting-materials-queries

Conversation

@rjsparks

Copy link
Copy Markdown
Member

The materials page for IETF 126 drops from 5,318 queries to 39, and for IETF 127 (the current default) from 4,108 to 33. IETF 126 renders in under a second instead of 5–8 s.

The rendered pages for IETF 126 and 127 are byte-identical to main except for two changes:

  • Draft order within a row. Every draft link has order 0, so the old list came out in whatever order the database returned it, and so does the new one, from a different query. No row gains or loses a draft.
  • The Other table now shows Updated times. The old loop skipped it. No meeting from 105 to 127 has an Other table.

For IETF 120, 124 and 125, every row matches main once draft order is ignored, and every Updated time is identical.

get_material() no longer replaces meeting_related() on prefetched documents. That replacement sent slides without a single reuse policy to meeting URLs that return 404. The agenda paths cache each document's link before calling get_material(), and their output (agenda data, .txt, .json, .ics, session materials, group meetings) is unchanged.

🤖 Generated with Claude Code

rjsparks and others added 7 commits November 9, 2026 22:53
Move the active-materials Prefetch that the agenda helper and the group
meetings view each built into active_materials_prefetch(), add
SessionQuerySet.with_active_materials(), and use it for the sessions on
/meeting/<num>/materials.

Session.get_material() no longer replaces meeting_related() on
prefetched documents. The prefetch carries the documents' states, so the
real check costs no queries, and the replacement linked slides whose
reuse policy is not "single" to meeting URLs that do not serve them. The
agenda paths cache each document's href before calling get_material(),
so their output does not change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Drafts have no "deleted" state, so the prefetched active materials hold
all of a session's drafts. Drafts carry no presentation order, so the
order they are listed in remains unspecified.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Factor the official-assignment lookup out of set_order_in_meeting() into
official_timeslotassignments() and add set_official_timeslotassignments(),
which fills Session.official_timeslotassignment() for a list of sessions
with one query. The materials view uses it before organizing sessions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add SessionQuerySet.with_has_attendance() and let
organize_proceedings_sessions() use its annotation instead of querying
Attended for each session. Prefetch the sessions' presentations so that
the presentations.exists() check reads the prefetched rows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each row's last update was found by calling all_meeting_slides() and
all_meeting_agendas() on every session, which re-fetched all of the
group's sessions and their materials. Group the page's scheduled
sessions, which are the same sessions all_meeting_sessions_for_group()
returns, and read their prefetched materials instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Updated column was computed for every table except Other, so its
rows always showed a blank.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fetch the meeting's proceedings materials once, with their documents and
states, instead of once per material type. ProceedingsMaterial is unique
per meeting and type, so the result is the same. Also reuse the
correction cutoff date the view has already computed, and have
get_meeting() call first() without a preceding exists().

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Nov 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.24%. Comparing base (b0a87a5) to head (f7e16bc).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #12025      +/-   ##
==========================================
- Coverage   89.26%   89.24%   -0.03%     
==========================================
  Files         343      343              
  Lines       46803    46831      +28     
==========================================
+ Hits        41781    41795      +14     
- Misses       5022     5036      +14     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jennifer-richards
jennifer-richards merged commit e381d01 into ietf-tools:main Dec 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants