While working on pg_stat_stements, I got some questions from customers to have statistics by application and IP address. I know that we are collecting the statistics by query id, user id, database id and top-level query. There is no way to collect the statistics based on IP address and application name. That's possible that multiple applications issue the same queries with the same user on the same database. We cannot segregate those queries from which application this query comes. I know we can this in the log file with log_line_prefix, but I want to see that aggregates like call count based on IP and application name. I did some POC and had a patch. But before sharing the patch.
I need to know if there has been any previous discussion about this topic; by the way, I did some Googling to find that but failed. Thoughts? -- Ibrar Ahmed. Senior Software Engineer, PostgreSQL Consultant.