Название: The Temple of Django Database Performance Автор: Andrew Brookins Издательство: Spellbook Press Год: 2020-2024 (Revision 2) Страниц: 159 Язык: английский Формат: pdf (true) Размер: 12.0 MB
Explore deadly ruins while learning to make Django apps blazing fast. Veteran Python developer Andrew Brookins guides you through dangers in this book on database performance tuning.
Want to be an expert Django developer? Master performance. An expert can jump into any Django project, profile slow pages and APIs, and tune the underlying database queries. Most performance problems in web applications come down to one thing: the database. With Django, the situation is no different — in fact, in some ways it’s even worse than that of our ORM-hating colleagues.
Caching can only take you so far. You need to go deeper, to the source. And most performance problems in Django start in the same place. The database.
But database performance tuning in Django involves a dizzying number of ORM API methods. And all this rests on top of the already complex machinery of SQL queries and indexes.
To fully master database performance with Django, reading through API documentation is not enough. You need to become an expert. Here are some examples of what an expert knows that this book will teach you:
- How to use profiling and measurement tools like New Relic, Django Debug Toolbar, and database query plans to see exactly how badly a query performs in production
- How to eyeball a query and know exactly the right index to speed it up (a covering index with INCLUDE? a partial index? a GIN index? You’re going to tell me by the end of the book because YOU will be the expert)
- How to use advanced techniques like server-side cursors with iterator(), custom Func() expressions, and keyset pagination with row comparisons to churn through millions of rows of data with ease
You will learn all this and more through over 160 pages, 60 examples, and 30 quiz questions. By the end, you won’t ever think of a Django ORM query the same again: it will exist simultaneously in your mind as an operational metric, ORM syntax, generated SQL, and a database execution plan. Because you will be an expert.
I can teach this because I have over ten years of experience working with Django and relational databases, both as an application developer and a platform engineer building databases as a service for Compose.com and IBM Cloud.
Audience: This book is written for Django developers who use a relational database and want to push their database-related code as fast as it can go. You should have experience with Python and Django. The focus of this book is on relational databases like PostgreSQL, MySQL, and SQLite — databases accessible through the core models and migrations systems provided with Django. You should have experience with relational databases and SQL. However, the reason this book exists is to level up your knowledge of these two topics where they intersect with Django, so we will spend a good amount of time discussing them.