Re: Relstats after VACUUM FULL and CLUSTER
От | Sami Imseih |
---|---|
Тема | Re: Relstats after VACUUM FULL and CLUSTER |
Дата | |
Msg-id | CAA5RZ0vmJ1zYxUNzq0Btq1CYVy_yVTRzOXEAkhkQ+8P249zOSg@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: Relstats after VACUUM FULL and CLUSTER (Erik Nordström <erik@timescale.com>) |
Список | pgsql-hackers |
> You need a concurrent transaction to recreate the situation. I am attaching an isolation test to show the behavior, Thanks! That helps. Indeed heapam_relation_copy_for_cluster and heapam_index_build_range_scan are counting HEAPTUPLE_RECENTLY_DEAD ( tuples removed but cannot be removed ) different. In heapam_relation_copy_for_cluster they are considered live and in heapam_index_build_range_scan they are considered dead. in heapam_relation_copy_for_cluster ``` case HEAPTUPLE_RECENTLY_DEAD: *tups_recently_dead += 1; /* fall through */ case HEAPTUPLE_LIVE: /* Live or recently dead, must copy it */ isdead = false; break; ``` In both cases, he recently dead tuples must be copied to the table or index, but they should not be counted towards reltuples. So, I think we need to fix this in heapam_relation_copy_for_cluster by probably subtracting tups_recently_dead from num_tuples ( which is the value set in pg_class.reltuples ) after we process all the tuples, which looks like the best fix to me. -- Sami Imseih Amazon Web Services (AWS)
В списке pgsql-hackers по дате отправления: