On Thu, Aug 4, 2016 at 10:49 PM, Bruce Momjian <br...@momjian.us> wrote:
> On Thu, Aug 4, 2016 at 06:16:02PM +0100, Simon Riggs wrote: > > On 4 August 2016 at 18:05, Bruce Momjian <br...@momjian.us> wrote: > > > > >> Approach 2 seems more reasonable and simple. > > >> > > >> There are only 2 bits for lp_flags and all combinations are already > used. But > > >> for LP_REDIRECT root line pointer, we could use the lp_len field to > store this > > >> special flag, which is not used for LP_REDIRECT line pointers. So we > are able > > >> to mark the root line pointer. > > > > > > Uh, as I understand it, we only use LP_REDIRECT when we have _removed_ > > > the tuple that the ctid was pointing to, but it seems you would need to > > > set HEAP_RECHECK_REQUIRED earlier than that. > > > > Hmm. Mostly there will be one, so this is just for the first update > > after any VACUUM. > > > > Adding a new linepointer just to hold this seems kludgy and could mean > > we run out of linepointers. > > Ah, so in cases where there isn't an existing LP_REDIRECT for the chain, > you create one and use the lp_len to identify it as a WARM chain? Hmm. > > If the root tuple still exists, we store the WARM flag (or HEAP_RECHECK_REQUIRED as used in the original post) in the tuple header itself. When the root tuple becomes dead and HOT prune decides to replace it with a LP_REDIRECT line pointer, the information is moved to lp_len (which is currently set to 0 for LP_REDIRECT items). Does that answer your question? > You can't update the indexes pointing to the existing ctid, so what you > would really have to do is to write over the existing ctid with > LP_REDIRECT plus WARM marker, and move the old ctid to a new ctid slot? > > Not really. I hope the above answers this, but please let me know if you mean something else. Thanks, Pavan -- Pavan Deolasee http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services