Django 6.1's FETCH_PEERS recovers most lost queries but not all hand-tuned ones
A developer tested Django 6.1's FETCH_PEERS fetch mode on their football quiz site, ExtraTime, across 467 routes and 3,963 requests. Removing all select_related calls raised total queries from 59,198 to 76,144, and enabling FETCH_PEERS recovered about 69% of that increase. The mode helped most on endpoints loading many objects that share the same relations, such as one that gained a large speedup, yet it did nothing on 115 routes that handle single objects or use iterators. The admin's group page also showed no improvement, because form choice fields call iterator(), which turns the mode off in practice. The author concluded that FETCH_PEERS is useful but cannot fully replace explicit select_related and prefetch_related tuning.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in