pg: Add query tracing & prepare/execute time measurements

What I'd really like, in addition to this, is a way to extract a query
from an $st object that can be run in the psql CLI. VNDB has a debugging
feature for that, but it's less trivial to make that work with binary
query parameters.
This commit is contained in:
Yorhel 2025-02-22 15:14:51 +01:00
parent a5f9584b02
commit b2d676b1ed
6 changed files with 269 additions and 54 deletions

View file

@ -29,6 +29,7 @@ static void fupg_prep_destroy(fupg_prep *p) {
typedef struct {
SV *self;
PGconn *conn;
SV *trace;
UV prep_counter;
UV cookie_counter;
UV cookie; /* currently active transaction object; 0 = none active */
@ -159,6 +160,7 @@ static SV *fupg_connect(pTHX_ const char *str) {
fupg_conn *c = safemalloc(sizeof(fupg_conn));
c->conn = conn;
c->trace = NULL;
c->prep_counter = c->cookie_counter = c->cookie = 0;
c->stflags = FUPG_CACHE;
c->ntypes = 0;