[GrandComicsDatabase/gcd-django] Eliminate N+1 queries in character-order display and editing (Issue #731)

3 views
Skip to first unread message

Adam Hernandez

unread,
Jul 27, 2026, 5:20:19 PM (13 days ago) Jul 27
to GrandComicsDatabase/gcd-django, Subscribed
DeusExTaco created an issue (GrandComicsDatabase/gcd-django#731)

Problem

Current beta performs database lookups inside character loops in both display processing and order editing:

  • process_ordered_appearing_characters() fetches through-model rows one character at a time.
  • The character-order editing flow repeatedly calls exists(), get(), and save() for individual characters.

These paths already exist on beta; they were surfaced by the automated review of synchronization PR #729 and were not introduced by that PR.

Review context:

Suggested acceptance criteria

  • Load existing through rows in bulk and map them by story-character ID.
  • Preserve existing ordering, grouping, alias, and add/update behavior.
  • Add query-count regression tests demonstrating that query growth is not linear in the number of ordered characters.


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.Message ID: <GrandComicsDatabase/gcd-django/issues/731@github.com>

Reply all
Reply to author
Forward
0 new messages