IIT-BHU-InstiApp / lite-hai-backend

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

Decrease amount of times db is hit #80

Closed king-11 closed 3 years ago

king-11 commented 3 years ago

using select_related and prefetch_related make sql joins rather than hitting database again to fetch those values

nishantwrp commented 3 years ago

@krashish8 ptal!

king-11 commented 3 years ago

I mean 'select_related' can only be used for ForeignKey and OneToOneField. So, maybe we can't use 'joint_secy' here, and similarly for 'joint_gensec' below.

we can use prefetch related then

krashish8 commented 3 years ago

Yup