pg_stat_io:
pg_stat_io is the most useful piece of information added in the Postgres stats views from Postgres 16. It allows you to understand the I/O usage.
pg_stat_io is like a library’s circulation desk, keeping track of all the I/O operations in our PostgreSQL database.
By monitoring pg_stat_io, you can identify which objects (tables, indexes) are causing the most I/O, which backend processes (client queries, autovacuum) are generating the most I/O, and how efficiently your database is handling I/O operations.
By analyzing pg_stat_io data, you can identify performance bottlenecks, optimize queries, and ensure your database is handling I/O efficiently to maintain optimal performance.
mafiree=# SELECT * FROM pg_stat_io WHERE backend_type='client backend';-[ RECORD 1 ]--+------------------------------backend_type | client backendobject | relationcontext | bulkreadreads | 9237884read_time | 0writes | 1229711write_time | 0writebacks | 0writeback_time | 0extends | extend_time | op_bytes | 8192hits | 148612evictions | 720027reuses | 8501505fsyncs | fsync_time | stats_reset | 2023-11-20 04:09:06.185412+00In the above example we can view the I/O operations done on a client backend process.
PostgreSQL 16’s enhancement allowing logical replication from standby instances marks a significant advancement in replication strategies.

Here, we can conduct logical replication from a standby server that is already acting as a replica for a primary server.
Aesthetic improvements in numeric literals have been introduced in postgres 16.
Now, developers can use underscores as thousands separators for better readability (e.g., 10_000_000). Which are not supported in the earlier versions.
We can use 1_000_000 instead of writing as 1000000, which can be easier to understand.
//Example which postgres 16 allows underscore values//mafiree=# select 10_000_000 As Thousands_underscore; thousands_underscore ---------------------- 10000000(1 row)Additionally, non-decimal integer literals, such as 0x1538, 0o12470, and 0b1010100111000, are now supported, allowing for more diverse and expressive ways to represent numeric values.
Which uses 0x, 0o and 0b as prefixes to identify the values.
//Example which the non decimal values are supported and converted to decimal values // mafiree=# SELECT 0x1538 as hexa, 0o12450 as octal, 0b1010100111001 as binary; hexa | octal | binary ------+------+-------- 5432 | 5416 | 5433(1 row)In PostgreSQL 16, there are new features that follow the SQL/JSON standard. These include functions like JSON_ARRAY(), JSON_ARRAYAGG(), and IS_JSON, which brings new ways to work with JSON data.
IS JSON:
IS_JSON is a new feature which is supported in postgres 16 which identifies whether the expression is a json or not.
Note: It results in “t” (true) if it is a json object as it shows below.
//Example for IS JSON which results as ‘t’//mafiree=# SELECT '{"newyork":"CITY"}' IS JSON; ?column? ---------- t(1 row)Note: Else it results with “f” (false) as shown below.
//Example for IS JSON which results as ‘f’//mafiree=# SELECT 'HELLO' IS JSON; ?column? ---------- f(1 row)JSON_ARRAY():
JSON_ARRAY() is a recent addition in the release. It helps format values into an array in JSON. This function is handy for creating JSON arrays from different types of data.
//Example in which the output is in array format//QUERY:mafiree=# SELECT json_array('MAFIREE','DBA'); json_array -------------------- ["MAFIREE", "DBA"](1 row)JSON_ARRAYAGG() :
JSON_ARRAYAGG() is a new function which aggregates all the values of the expressions in a JSON array.
For example consider employee table with values as below,
mafiree=# SELECT * FROM employee;+----+-------+-------------+| id | name | designation |+----+-------+-------------+| 1 | ram | DBA || 2 | kavin | DEVELOPER || 3 | kumar | TESTER |+----+-------+-------------+(3 rows)Now perform JSON_ARRAYAGG() operation in the employee table.
mafiree=# SELECT JSON_ARRAYAGG(designation) FROM employee;+--------------------------------+| json_arrayagg |+--------------------------------+| ["DBA", "DEVELOPER", "TESTER"] |+--------------------------------+(1 row)Here we can see the designation column of the employee table is aggregated into array values.
sslrootcert=”system” is a new crucial parameter, designed to augment SSL/TLS security. When set, PostgreSQL uses the trusted certificate authority (CA) stored by the client’s operating system. This feature ensures a more robust and standardized approach to certificate validation, enhancing the overall security posture of database connections.
The require_auth parameter which serves as a gatekeeper, enabling clients to specify their willingness to accept particular authentication parameters from the server. This allows clients to set stringent criteria, ensuring they only accept authentication methods that meet their specific security standards.
The COPY command in PostgreSQL has been a workhorse for importing and exporting data.
Performance benchmarks conducted revealed staggering improvements of up to 300% in specific scenarios, showcasing the remarkable advancements in PostgreSQL 16’s data loading capabilities.
In different versions of PostgreSQL like 13, 15, and 16, there are significant differences in performance.
For example, when importing 15 million records into PostgreSQL 13, performing the COPY command takes roughly 60 seconds. With PostgreSQL 15, it’s a bit faster, completing the same command in around 53 seconds. But in PostgreSQL 16, this COPY command finishes much quicker, in just 14 seconds.
Postgres-13
mafiree=# COPY customer_copy from '/var/lib/pgsql/13/customer_copy.csv';COPY 15000000Time: 60509.483 ms (00:60.509)Postgres-15
mafiree=# COPY customer_copy from '/var/lib/pgsql/15/customer_copy.csv';COPY 15000000Time: 53207.692 ms (00:53.208)Postgres-16
mafiree=# COPY customer_copy from '/var/lib/pgsql/16/customer_copy.csv';COPY 15000000Time: 14300.692 ms (00:14.300)This indicates that the bulk loading using the COPY command has been enhanced in PostgreSQL version 16.
Feel the benefits of the latest and most advanced release by upgrading to PostgreSQL 16 today!
In Mafiree, we help you in upgrading PostgreSQL and also we offer 24x7 PostgreSQL monitoring, daily automated archival, backups, and various other PostgreSQL services. Feel free to contact us via sales@mafiree.com for PostgreSQL Database Services.
Miru IT Park, Vallankumaranvillai,
Nagercoil, Tamilnadu - 629 002.
Unit 303, Vanguard Rise,
5th Main, Konena Agrahara,
Old Airport Road, Bangalore - 560 017.
Call: +91 6383016411
Email: sales@mafiree.com