On Wed, Sep 27, 2023 at 2:36 PM Melanie Plageman <melanieplage...@gmail.com> wrote: > It seems like the ideal freeze pattern for an insert-only table would be > to freeze as soon as the page is full before any checkpoints which could > force you to emit an FPI.
Yes. So imagine we have two freeze criteria: 1. Do not ever opportunistically freeze pages. 2. Opportunistically freeze pages whenever we can completely freeze the page. For a table where the same rows are frequently updated or where the table is frequently truncated, we want to apply (1). For an insert-only table, we want to apply (2). Maybe I'm all wet here, but it's starting to seem to me that in almost all other cases, we also want to apply (2). If that's true, then the only thing we need to do here is identify the special cases where (1) is correct. It'd be even better if we could adapt this behavior down to the page level - imagine a large mostly cold table with a hot tail. In a perfect world we apply (1) to the tail and (2) to the rest. But this might be too much of a stretch to actually get right. > One big sticking point for me (brought up elsewhere in this thread, but, > AFAICT never resolved) is that it seems like the fact that we mark pages > all-visible even when not freezing them means that no matter what > heuristic we use, we won't have the opportunity to freeze the pages we > most want to freeze. The only solution to this problem that I can see is what Peter proposed earlier: if we're not prepared to freeze the page, then don't mark it all-visible either. This might be the right thing to do, and if it is, we could even go further and get rid of the two as separate concepts completely. However, I think it would be OK to leave all of that to one side for the moment, *especially* if we adopt some proposal that does a lot more opportunistic freezing than we do currently. Because then the problem just wouldn't come up nearly as much as it does now. One patch can't fix everything, and shouldn't try. -- Robert Haas EDB: http://www.enterprisedb.com