Disabled pg_profile snapshot. Waited for the long query to complete. Its execution took 3 hours and 40 minutes. After 30 minutes, checked PMM QAN — this query is not there. Maybe single queries are being filtered somewhere on your side?
I suspect the problem is that after the query execution is complete and the data is retrieved, the client closes the connection. This creates a situation where the query exists in pg_stat_statements, but since the corresponding PID is no longer in pg_stat_activity, this information does not make it into PMM.
Why does a request from session 69462779.3f3725 from a single IP address appear in the pg_stat_statement log and in PMM, while a request from session 6945c41b.2922ac is only present in pg_stat_statement?
session_id=69462779.3f3725, user=[unknown], db=[unknown], app=[unknown], client=[local]LOG: connection received: host=[local]
session_id=69462779.3f3725, user=postgres, db=database, app=[unknown], client=[local]LOG: connection authorized: user=postgres database=database application_name=psql
session_id=69462779.3f3725, user=postgres, db=database, app=psql, client=[local]LOG: duration: 3919303.234 ms statement: — query_text —
session_id=6945c41b.2922ac, user=[unknown], db=[unknown], app=[unknown], client=ip_clientLOG: connection received: host=ip_client port=44852
session_id=6945c41b.2922ac, user=id_client, db=database, app=[unknown], client=ip_clientLOG: connection authenticated: identity=“id_client” method=md5 (/pgsql/14/data/pg_hba.conf:122)
session_id=6945c41b.2922ac, user=id_client, db=database, app=[unknown], client=ip_clientLOG: connection authorized: user=id_client database=database
session_id=6945c41b.2922ac, user=id_client, db=database, app=PostgreSQL JDBC Driver, client=ip_clientLOG: duration: 11260136.968 ms execute : — query_text —
session_id=6945c41b.2922ac, user=id_client, db=database, app=PostgreSQL JDBC Driver, client=ip_clientDETAIL: parameters: $1 = ‘2025-10-01’, $2 = ‘2025-10-01’, $3 = ‘2025-10-01’, $4 = ‘2025-12-19 00:05:00.182’, $5 = ‘1000000’
session_id=6945c41b.2922ac, user=id_client, db=database, app=PostgreSQL JDBC Driver, client=ip_clientLOG: duration: 103180.453 ms execute : — query_text —
session_id=6945c41b.2922ac, user=id_client, db=database, app=PostgreSQL JDBC Driver, client=ip_clientDETAIL: parameters: $1 = ‘2025-10-01’, $2 = ‘2025-10-01’, $3 = ‘2025-10-01’, $4 = ‘2025-12-19 00:05:00.182’