Want to know the raw sql query when user other than superuser logs in the system <p>I have an application which involves large number of users. among those, some are staff members. </p> <p>My problem </p> <p>When a user from a certain group let say <code>A</code> logs in, it takes 5 minute to see the admin screen (index page). I want to fix this problem.So the question is , What is the sql query when a user from a certain group logs in the admin of the project.</p> <p>I know how to see query</p> <pre><code>str(MyModel.objects.filter(name="my name").query) </code></pre> <p>but again not getting how to generate the query for that case</p>