What does the prefetch_related method do in Django?
Correct answer
B. Retrieves related objects after the main query is executed
12 views
B. Retrieves related objects after the main query is executed
12 views
prefetch_related() retrieves related objects in a separate query after the main query and joins the results in Python.
It is designed for many-to-many and reverse foreign-key relationships, where select_related() cannot be used.
Want more practice? Try the full set of Computer Science MCQs on MCQsExam.com.
Not sure why the answer is B? Ask here and get an explanation.