pg_stat_statements IN problem - Mailing list pgsql-general

From byme@byme.email
Subject pg_stat_statements IN problem
Date
Msg-id Z6FGe-JBOEhPm3AUulSOJc7z5UiSbr3U_N88tmBbXyNbwZLolx8kV7i8qBuJHYxI64cYcsXnV-2ynh1VBr3uK6doMBtuUkYXtpH70keFNYQ=@byme.email
Whole thread Raw
Responses Re: pg_stat_statements IN problem
List pgsql-general
Hello,

I would like to ask about a problem that is bothering me for a while now. We have implemented monitoring of our queries using pg_stat_statements. The only problem we have with it is that expressions with
IN ('first', 'second', 'third')
get translated into a query as
IN ($1, $2, $3)
and not as 
IN $1

This obfuscates our monitoring because the same query with different amount of arguments get translated into this:
IN ('first', 'second')
and so on.

I was trying to find some discussions about it, but could not find much. One suggestion was to use
= ANY
but that is a problem when using some third party framework for db operations, in our case for python, for example web2py's DAL or sqlalchemy. 

Is there a possibility the pg_stat_statements will be improved with handling IN? This problem makes it so much less useful right now.

Or is there something I could do to have the statistics for such queries aggreageted? Or is there something else I am missing?

Best regards

Lukas Jerabek

Sent with Proton Mail secure email.

pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: pg_agent jobs
Next
From: "Karl O. Pinc"
Date:
Subject: Trigger functions and parallelism