Skip to content

thiagoferreiraw/django-orm-optimization-talk

Repository files navigation

django-orm-optimization-talk

Presentation slides

Installing

Make sure you have poetry installed, then run:

poetry install
poetry run python manage.py migrate

Creating a sample database

poetry run python manage.py create_test_records

See available params with:

poetry run python manage.py create_test_records --help

Screen Shot 2022-09-03 at 15 20 26

Running sample queries

In file shop/samples.py, we can find several good/bad examples of ORM queries.

To run those queries, do:

$ poetry run python manage.py shell_plus

Then, in the python shell, run:

# Using a "bad" example - this will run several unucessary queries
from shop.samples import list_orders_bad
list_orders_bad()

image

Another example:

# Using a "good" example - this is optimized
from shop.samples import list_orders_good
list_orders_good()

image

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages