0

To load related primary keys with a serializer it is possible to:

  • use serializers.PrimaryKeyRelatedField(many=True, read_only=True)
  • not define a related Serializer

Why does it take more than 20 seconds to load 6 records if I don't define a related serializer?

AltSchool/dynamic-rest is used together with djangorestframework==3.7.7

Thanks for any conceptual explanation.

Tobias Ernst
  • 4,214
  • 1
  • 32
  • 30
  • You can use `from django.db import connection` `len(connection.queries)` before and after call to that serializer, to see if you are doing extra queries – JuanMi Gabarron Feb 28 '19 at 08:49
  • Try https://django-debug-toolbar.readthedocs.io/en/latest/ to debug how many and what queries are being executed. – xxbinxx Feb 28 '19 at 09:28

0 Answers0