Skocz do zawartości
Zaloguj się, aby obserwować  
picira

Optimizing Django ORM for Large Databases

Polecane posty

Hello

 

I'm currently working on a Django project that utilizes a large PostgreSQL database. I've noticed that some of the queries generated by the ORM are performing quite slowly; which is affecting the overall application performance.:mellow:

What are the best practices for optimizing Django ORM performance when dealing with large datasets? Any tips on indexing; query optimization, or specific Django features to leverage would be greatly appreciated!  I have checked https://docs.djangoproject.com/en/5.1/topics/db/optimization/msbi documentation guide for reference but still need help. 

 

Additionally; I'd like to know if there are tools /  libraries that can assist in monitoring and analyzing query performance within Django.

 

 Thanks in advance for your insights!:)

 

 

 

Udostępnij ten post


Link to postu
Udostępnij na innych stronach

Hi. First of all, when retrieving data from the database - retrieve only information from the necessary columns, nothing else (i.e. instead of SELECT * FROM table - use SELECT id FROM table). Secondly - consider whether it would be better to use a singleton - here you have an interesting addition:  https://github.com/lazybird/django-solo and you can read more about singletons in Django here: https://stackoverflow.com/questions/49735906/how-to-implement-singleton-in-django

 

Udostępnij ten post


Link to postu
Udostępnij na innych stronach

Zaloguj się, aby skomentować

Będziesz mógł dodać komentarz po zalogowaniu się



Zaloguj się
Zaloguj się, aby obserwować  

×