Number of SQL queries

From: Thomas Güttler <guettliml(at)thomas-guettler(dot)de>
To: psycopg(at)postgresql(dot)org
Subject: Number of SQL queries
Date: 2018-07-19 08:14:40
Message-ID: 2b82b783-e2f2-2fff-e2c6-120b7325828e@thomas-guettler.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: psycopg

I would like to know the number of sql queries which were executed during a http request.

Is there a way to get this number?

I would like to warn if a http request produces too many statements.

I am running a django application. If DEBUG is True, then django writes all queries into a list (connection.queries).
But I would like to get this value from a production server. On the production server DEBUG is False and
connection.queries does not get filled by django.

It would be nice to get this value from psycopg2.

Regards,
Thomas

--
Thomas Guettler http://www.thomas-guettler.de/
I am looking for feedback: https://github.com/guettli/programming-guidelines

Responses

Browse psycopg by date

  From Date Subject
Next Message Federico Di Gregorio 2018-07-19 10:05:45 R: Number of SQL queries
Previous Message Sandeep Thakkar 2018-07-11 12:44:02 psycopg2 2.7.5 linking error