0
I am doubtful in the following exercise: The route /Albums/ is returning a listing of the albums with the artists of the album, but in some of our clients that use databases stored on own servers it is very slow. When accompanying SQL queries with a profiler has been detected that many queries are being held at the bank and this is causing the slowness
that’s what’s represented in the view:
class AlbumListAPIView(ListAPIView):
queryset = Album.objects.all()
serializer_class = AlbumSerializer
there is some way to optimize this queryset ?
Lucas, I would need more information on how this model Album works to see if you have many relationships, but I would recommend taking a look at the select_related method of Django - https://docs.djangoproject.com/pt-br/3.2/ref/models/querysets/#select-Related
– rgaya