InBackend Engineers ClubbyAnas Issath·2d agoWhy count() Then a Loop Hits Your Database TwiceHow Django’s QuerySet caching really works, why .exists() before a loop doubles your queries, and the small habit that halves them
Django Wiki·Oct 30Batch Django bulk_update with Bounded InputsYou pass batch_size=500 to bulk_update(), but the job already loaded the entire table into a Python list. The SQL is batched; the input is…A response icon1
Django Wiki·Oct 29Get the Latest Related Value with Django SubqueryAn order list needs a status label. Calling the history manager for every order works, but it can turn one list query into a query for…A response icon1
Django Wiki·Oct 28Query Missing Keys and Nulls in Django JSONFieldYou exclude one city from a contact list, and contacts with no city disappear too. The missing values were not all the same kind of…
Django Wiki·Oct 27Fix Django exclude Across Related RowsA customer has an old paid invoice and a future unpaid invoice. Your query removes them from the “no overdue unpaid invoices” list.