Efficient use of Django ORM

Hiren Patel (~hirenalken)




Object-Relational Mapper (ORM) is one of the powerful feature of Django. It allows us to interact with database without writing long complex SQL queries.

The contents that will be covered in the discussion are as follows.

  • Introduction to ORM, How it works ?
  • What is queryset ? how it works ?
  • Explaining use of values, values_list, only and defer to run ORM query efficiently
  • How to use select_related and prefetch_related to optimize queries
  • Some examples to show, how to query very complex data using only ORM
  • What not to do while using ORM to avoid slow performance


  • Basic knowledge of Python and Python web framework (Django)
  • Some experience in quering relational databases

Content URLs:

I will upload slides soon.

Speaker Info:

My name is Hiren Patel. I am working at Aubergine solutions pvt ltd and I have been doing full stack web development there from last 2.5 years. While working on some web projects, I have always focused on learning django in more detail and try to optimize APIs to return response faster.

Speaker Links:

I had presented a talk on this same topic in meetup organised by Ahmedabad based meetup group. here is the link to meetup: link

Id: 785
Section: Web development
Type: Talks
Target Audience: Beginner
Last Updated: