Optimizing Database Access


Work in progress. To receive updates subscribe to this discussion or follow me on x or mastodon.


I’ll asume you are using PostgreSQL, but most of the tips are valid for other databases too.

Always profile first

Defer and only

Do the work early

Caching with Redis

https://github.com/Suor/django-cacheops https://github.com/noripyt/django-cachalot

Using indexes

Materialized views


Cursor based pagination