Re: Statistics updates is delayed when using `commit and chain`
От | Japin Li |
---|---|
Тема | Re: Statistics updates is delayed when using `commit and chain` |
Дата | |
Msg-id | MEYP282MB1669494707E6A49C2AC763FEB6159@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM обсуждение исходный текст |
Ответ на | Re: Statistics updates is delayed when using `commit and chain` (Lætitia Avrot <laetitia.avrot@gmail.com>) |
Список | pgsql-bugs |
On Mon, 12 Jul 2021 at 20:56, Lætitia Avrot <laetitia.avrot@gmail.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 wasa 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.
В списке pgsql-bugs по дате отправления: