Tag view

#orm

Cross-subject tag search for related interview cards.

Clear

Results update as you type. Press / to jump straight into search.

Tagged with orm

6 cards

Django Easy Theory

Advantages of the Django ORM

The ORM improves productivity with composable queries, model validation, and database abstraction.

  • Readable query API
  • Built-in escaping reduces SQL injection risk
  • Easy relation traversal

Advantages of the Django ORM

Django Medium Theory

select_related vs prefetch_related

select_related joins single-valued relations in SQL; prefetch_related fetches related collections in extra queries.

  • select_related for FK and O2O
  • prefetch_related for M2M and reverse FK
  • Both reduce N+1 queries

select_related vs prefetch_related

Django Medium Theory

What is Django queryset laziness?

QuerySets are lazy, so they usually do not hit the database until they are evaluated.

  • Filter chaining stays cheap
  • Evaluation happens on iteration or list conversion
  • Important for performance reasoning

What is Django queryset laziness?