Bruce Momjian <br...@momjian.us> writes: > On Mon, Jan 11, 2021 at 07:40:18PM +0800, 曾文旌 wrote: >> This is indeed a typical scenario for a partitioned table. >> there are two basic operations >> 1) Monthly DETACH old child table >> 2) Monthly ATTACH new child table >> >> For 1) The DETACH old child table can be finished immediately, global index >> can be kept valid after DETACH is completed, and the cleanup of garbage data >> in global index can be deferred to VACUUM.
> Yes, we can keep the index rows for the deleted partition and clean them > up later, but what is the advantage of partitioning then? Just heap > deletion quickly? Is that enough of a value? More to the point, you still have a massive index cleanup operation to do. Deferred or not, that's going to take a lot of cycles, and it will leave you with a bloated global index. I find it hard to believe that this approach will seem like an improvement over doing partitioning the way we do it now. regards, tom lane