From: | Japin Li <japinli(at)hotmail(dot)com> |
---|---|
To: | Lætitia Avrot <laetitia(dot)avrot(at)gmail(dot)com> |
Cc: | John Naylor <john(dot)naylor(at)enterprisedb(dot)com>, pgsql-bugs(at)lists(dot)postgresql(dot)org |
Subject: | Re: Statistics updates is delayed when using `commit and chain` |
Date: | 2021-07-12 13:34:18 |
Message-ID: | MEYP282MB1669494707E6A49C2AC763FEB6159@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
On Mon, 12 Jul 2021 at 20:56, Lætitia Avrot <laetitia(dot)avrot(at)gmail(dot)com> wrote:
> Hello Japin,
>
> Thank you for the patch. I read it and I find myself with one question: why do we update statistics even though there was a rollback? I know that that was the behaviour before, but is it still worth it?
>
I test the following case, and found it also update the statistics even if we
rollback. So I update the statistics here. On the other hands, the insert tuple
rollbacked still in data block, so IMO we should update the statistics. I'm not
sure it is right.
postgres=# create table test (id serial, value text);
CREATE TABLE
postgres=# SELECT n_tup_ins FROM pg_stat_all_tables WHERE relname = 'test';
n_tup_ins
-----------
0
(1 row)
postgres=# BEGIN;
BEGIN
postgres=*# INSERT INTO test (value) VALUES ('bla');
INSERT 0 1
postgres=*# SELECT n_tup_ins FROM pg_stat_all_tables WHERE relname = 'test';
n_tup_ins
-----------
0
(1 row)
postgres=*# ABORT ;
ROLLBACK
postgres=# SELECT n_tup_ins FROM pg_stat_all_tables WHERE relname = 'test';
n_tup_ins
-----------
1
(1 row)
--
Regrads,
Japin Li.
ChengDu WenWu Information Technology Co.,Ltd.
From | Date | Subject | |
---|---|---|---|
Next Message | John Naylor | 2021-07-12 14:08:42 | Re: Statistics updates is delayed when using `commit and chain` |
Previous Message | Lætitia Avrot | 2021-07-12 12:56:18 | Re: Statistics updates is delayed when using `commit and chain` |