A very quick and easy way to make your DB queries substantially faster in the database is to set indexes in your Model's meta class.
For example, from a personal project:
You should set indexes on anything your data is commonly queried for. Indexes can also be pairs of fields, if you query on multiple parameters. This makes DB read operations much faster and DB write operations marginally slower (not noticeable unless you are writing multiple millions of rows). This app seems to be mostly a read application, so this might be an acceptable trade off?
Setting indexes requires a migration, as it's a change made to the database, not your application layer.
A very quick and easy way to make your DB queries substantially faster in the database is to set indexes in your Model's meta class.
For example, from a personal project:
You should set indexes on anything your data is commonly queried for. Indexes can also be pairs of fields, if you query on multiple parameters. This makes DB read operations much faster and DB write operations marginally slower (not noticeable unless you are writing multiple millions of rows). This app seems to be mostly a read application, so this might be an acceptable trade off?
Setting indexes requires a migration, as it's a change made to the database, not your application layer.
Docs: https://docs.djangoproject.com/en/3.1/ref/models/indexes/ Theory: https://en.wikipedia.org/wiki/Database_index