Django and HTMX #9 - Database Query Optimization with django-debug-toolbar

Pubblicato il: 17 novembre 2021
sul canale di: BugBytes
6,009
214

▶ Django & HTMX FULL COURSE: https://www.udemy.com/course/django-h...

▶ HTMX & Django playlist:    • Django & HTMX - Original Playlist!  
☕ Buy a coffee: https://ko-fi.com/bugbytes


In this video, we will use the django-debug-toolbar extension to fix some database performance issues in our application. We will demonstrate how to install and use django-debug-toolbar, and will use this package to help prevent the N+1 problem, and discover where our database queries can be improved.

We will see how to use Django's ORM to help remedy these problems, including:
Prefetching related models with the prefetch_related() function
Using the bulk_update() function to update multiple changed models in a single query.

Cutting down on database I/O is a vital practice for achieving optimal application performance!

Code will be available on the "Video #9" directory in the Github repository linked below.

📌 𝗖𝗵𝗮𝗽𝘁𝗲𝗿𝘀:
00:00 intro
00:12 setting up django-debug-toolbar
01:35 preventing n+1 problem using prefetch_related()
03:57 optimizing sort queries

𝗦𝗼𝗰𝗶𝗮𝗹 𝗠𝗲𝗱𝗶𝗮:
📖 Blog: https://www.bugbytes.io/posts/
👾 Github: https://github.com/bugbytes-io/django...

📚 𝗙𝘂𝗿𝘁𝗵𝗲𝗿 𝗿𝗲𝗮𝗱𝗶𝗻𝗴 𝗮𝗻𝗱 𝗶𝗻𝗳𝗼𝗿𝗺𝗮𝘁𝗶𝗼𝗻:
django-debug-toolbar: https://django-debug-toolbar.readthed...
N+1 problem: https://scoutapm.com/blog/django-and-...

#django #htmx #python


In questa pagina del sito puoi guardare il video online Django and HTMX #9 - Database Query Optimization with django-debug-toolbar della durata di online in buona qualità , che l'utente ha caricato BugBytes 17 novembre 2021, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 6,009 volte e gli è piaciuto 214 spettatori. Buona visione!