R: Number of SQL queries - Mailing list psycopg

From Federico Di Gregorio
Subject R: Number of SQL queries
Date
Msg-id f6k462i4p2ed84f9kgdqg13u.1531994153088@email.android.com
Whole thread Raw
In response to Number of SQL queries  (Thomas Güttler <guettliml@thomas-guettler.de>)
Responses Re: R: Number of SQL queries  (Thomas Güttler <guettliml@thomas-guettler.de>)
List psycopg

---- Thomas Güttler ha scritto ----

> 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.

psycopg2 doee not know about HTTP requests and if you enable connection pooling the same database connection is used multiple times. So no, you cant use psycopg to count the number of queries per request. Only Django can do that.

federico

psycopg by date:

Previous
From: Thomas Güttler
Date:
Subject: Number of SQL queries
Next
From: Thomas Güttler
Date:
Subject: Re: R: Number of SQL queries