for example, the code is executed

for event in Event.objects.all(): print(event.user.username) 

or

 for event in User.objects.last().events.all(): print(event.name) 

Where

 class Event(models.Model): user = models.ForeignKey(User, on_delete=models.CASCADE, related_name='events') name = models.CharField(max_length=28) 

How to find out how many requests were made to the database? How can I track when a query to a database is executed in django? Is there a signal responsible for this? It may be easier to track this in the DB itself (Postgresql), if so, how?

  • 2
    django-debug-toolbar - Sergey Gornostaev
  • one
    Try analyzing the logs on the pg side with the pgbadger utility - Hellseher

0