IIT-BHU-InstiApp / lite-hai-backend

https://lite-hai.copsiitbhu.co.in/
13 stars 20 forks source link

The Database is not Indexed? #81

Closed arjunsalyan closed 3 years ago

arjunsalyan commented 3 years ago

Multiple queries seem to be utilising filter and order_by, but the database does not seem to be indexed on those fields.

Indexing can be a major performance booster and should be applied on all fields that we intend to perform operations upon (individual/together).

For example

# For tag model
class Meta:
    indexes = [
        models.Index(fields=['tag_name']),
    ]

# For workshop model
class Meta:
    indexes = [
        models.Index(fields=['date', 'time]),
        models.Index(fields=['-date', '-time]),
    ]

Feel free to close the issue if it is already in place and I missed something.

king-11 commented 3 years ago

That seems like a great suggestion 🤔 we need those indexes