Statistics updates is delayed when using `commit and chain`

From: Lætitia Avrot <laetitia(dot)avrot(at)gmail(dot)com>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Statistics updates is delayed when using `commit and chain`
Date: 2021-07-09 09:05:53
Message-ID: CAB_COditjdhpZ4j=mZ3YG-uG=bqNtXWcBSAkwEJu3cX1X5myOA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

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

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message PG Bug reporting form 2021-07-09 09:53:11 BUG #17097: FailedAssertion at initsplan.c
Previous Message hubert depesz lubaczewski 2021-07-09 08:43:55 I/O timigns don't include time for temp buffers