A
A
Anton2018-03-15 19:13:46
PostgreSQL
Anton, 2018-03-15 19:13:46

How do you measure the load profile (read/write ratio) in PostgreSQL?

Good afternoon!
How do you measure the load profile (read/write ratio) in PostgreSQL?
Of course, you can monitor only disk reading and writing, but then the cache will not be taken into account.
Do you monitor disk reads and writes and separately the number of queries in PostgreSQL?
Thanks in advance
PS I know about pg_stat_statements. But pg_stat_statements does not give the number of reads on the PostgreSQL server, there is a number of queries, but no reads.
PS1 Is there any SQL query that showed the total number of SELECT per server?
Is there any SQL query that showed the total count (UPDATE + DELETE) per server?
PS2
This is a necessary metric - let's say now all requests go to the master in the cluster, we can show that we have a load profile of 70% read / 30% write or 80% read / 20% write.
And by translating SELECT queries to SLAVE - you can reduce the load on the PostgreSQL cluster

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Melkij, 2018-03-15
@melkij

Look at the numbers what the stats collector collects, there are many different ones. https://www.postgresql.org/docs/10/static/monitori...
for example, writing buffers to disks is buffers_checkpoint, buffers_clean and buffers_backend in pg_stat_bgwriter
pg_stat_database with blks_read, blks_hit, blk_read_time and blk_write_time
And of course pg_stat_statements with resource granularity on individual requests.
By the way, a good picture where to look for details of which subsystems of the base
postgres-observability-9.6.png

K
ky0, 2018-03-15
@ky0

I support about pg_stat_statements, there are many ways to extract useful information from there, see for example https://github.com/dataegret/pg-utils

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question