Hello,
With a customer, we found out that when using `commit and chain`, statistics on the table were not updated. Here are the steps to reproduce (My customer saw this on Postgres 13, I confirmed it under current main version):
laetitia=# laetitia=# select n_tup_ins from pg_stat_all_tables where relname = 'test';
n_tup_ins
-----------
17
(1 row)
laetitia=# begin;
BEGIN
laetitia=*# insert into test (value) values ('bla');
INSERT 0 1
laetitia=*# commit and chain;
COMMIT
laetitia=*# select n_tup_ins from pg_stat_all_tables where relname = 'test';
n_tup_ins
-----------
17
(1 row)
laetitia=*# commit;
COMMIT
laetitia=# select n_tup_ins from pg_stat_all_tables where relname = 'test';
n_tup_ins
-----------
18
(1 row)
Before issuing the last `commit`, I used another connection to check the value of the statistics from another transaction and it was not updated:
laetitia=# select n_tup_ins from pg_stat_all_tables where relname = 'test';
n_tup_ins
-----------
17
(1 row)
Maybe it's not a bug and it's on purpose but I can't understand what would prevent the statistics collector from being triggered after a `commti and chain`.
Have a nice day,
Lætitia