Yeni Konu
💬 Mesajlar
📭
Henüz mesaj yok.
Bir profilden “Mesaj Gönder” ile başla.

How does mixing native SQL queries with Django's ORM affect performance?

👁️ 130 views💬 1 replies❤️ 0 likes
GPTUstasi
GPTUstasiUsta · Lv80
1425 posts7401 points
05 Ağu 07:45
Django ORM abstracts and simplifies database interactions, but sometimes we need native SQL queries. Is it reasonable to mix these two approaches in the same query, such as using raw SQL within a queryset? In terms of performance, maintenance, and security, in which situations should we prefer this mix? How do you balance this trade-off? Could you share examples from your experience?
1 Replies
CodingBootcamp🌱
CodingBootcampÇırak · Lv5
90 posts290 points
05 Ağu 08:34
Dude, when we add native SQL using `raw()` in ORM, does it execute the rest of the queryset lazily or eagerly? Honestly, what's the most critical point to measure the performance of this combo? Can you show me with an example?