public inbox for [email protected]
help / color / mirror / Atom feedFrom: Roberto Nunnari <[email protected]>
To: [email protected]
Subject: High latency and profiling
Date: Thu, 9 Oct 2025 09:03:31 +0000 (GMT)
Message-ID: <[email protected]> (raw)
Hello. I was notified about high latency on one of our PostgreSQL clusters. This latency is observed from the application and has been increasing. There is no indication about the exact database as the application uses several DBs, but the largest and most used is 'mydb'. So, a couple of months ago I installed pg_profile and configured it as follows: shared_preload_libraries = 'pg_stat_statements,dblink,pg_stat_kcache,pg_wait_sampling' pg_profile.max_sample_age = 90 \c postgres CREATE SCHEMA extensions; CREATE EXTENSION dblink SCHEMA extensions; CREATE EXTENSION pg_profile SCHEMA extensions; \c mydb CREATE SCHEMA extensions; CREATE EXTENSION dblink SCHEMA extensions; CREATE EXTENSION pg_stat_statements SCHEMA extensions; CREATE EXTENSION pg_stat_kcache schema extensions; CREATE EXTENSION pg_wait_sampling schema extensions; CREATE EXTENSION pg_profile SCHEMA extensions; select extensions.set_server_size_sampling('local','23:00+01',interval '2 hour',interval '8 hour'); CREATE USER collector_user with password ''; GRANT pg_read_all_stats TO collector_user; grant connect on database mydb to collector_user; ALTER ROLE collector_user SET search_path = extensions,public; The postgres user had the following crontab: 13,43 * * * * psql -d mydb -c 'SELECT extensions.take_sample()' > /dev/null 2>&1 I made sure autovacuum works correctly and after that, just to make sure, I run vacuum analyze on all DBs. This has not lead to any notable improvement in the latency as seen by the application. I access pg_profile data from grafana, but I cannot see anything that looks wrong. Overall Hit Ratio is always between 99.3% and 100%. The only strange thing I see in grafana, are the following: Overall statement times sais "No data" and 'db query error: pq: column "blk_read_time" does not exist'. Also the graph "Statement time" says "No data" and "db query error: pq: column sst.blk_read_time does not exist". Wait event types (statements) graph: N/A was quite stable at about 0.200 s/s until 2nd september and then grow regularly and sharply up 4 s/s until 22nd september when it dropped back to 0.7 s/s and is stable at that value till now. Developers report that their software is already optimized and database size is not a problem. They suggest the issue might be inside PostgreSQL itself. Could you help me understand what is causing this? In particular, what does the N/A data in the "Wait event types (statements)" graph represent? Thank you and best regards. Robi
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected]
Subject: Re: High latency and profiling
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox