Dashboard › sentry › Never query DB in serialize() for bulk …
019fb3b9-f4b4-735b-8b56-3128a0834336Directive (Burak Yigit Kaya, 2026-07-30): for bulk serializer endpoints, NEVER query the database in serialize(). Use get_attrs() for batched prefetch instead. serialize() runs once per item, so a DB query there becomes an N+1 explosion. get_attrs() is called once per request and lets you batch-load related data. Trap: this looks like premature optimization for small N — the right framing is bulk endpoints scale, and the per-item DB query is structurally wrong, not just slow.