3 ms·
I’m the same with Django. I’ve found that perf issues were much more often caused by the DB queries than by Django itself.
by physicsguy 2y ago
I’m the same with Django.
I’ve found that perf issues were much more often caused by the DB queries than by Django itself.
- sureglymop 2y agoI think almost always the DB query will take the longest but: I've seen too many engineers not even do basic optimizations such as creating indexes. Here's a list of easy/low hanging fruit optimizations that are often just forgotten: Creating indexes in the db, delegating more logic to the db than doing it in code (e.g. using pipelines in mongodb, partial indexes in postgres, etc.), turning on brotli/zstd compression for all or most requests, caching objects or requests in memory (e.g. with redis), setting appropriate cache control headers, frontend stuff such as not rendering thousands of objects as DOM nodes and instead using canvas (recently saw this in a map application).
- jimnotgym 2y agoI have seen the opposite too, a db full of indexes that grew very large and was very slow on inserts! Understanding that an index is only useful on columns that you want to search might be a start!
- VMtest 2y agocreating indexes will lock the tables if not mistaken, the problem about database is that many of us just don't study enough to make sense out of it
- t-writescode 2y agoIn PostgreSQL you can create indexes concurrently, so the database doesn't have to go down to create a new index: https://www.postgresql.org/docs/current/sql-createindex.html#SQL-CREATEINDEX-CONCURRENTLY https://www.postgresql.org/docs/current/sql-createindex.html...