On Mon, Mar 25, 2024 at 11:16 AM Bertrand Drouvot <bertranddrouvot...@gmail.com> wrote: > > IIUC, Bertrand's point was that users can interpret last_active_time > > as a value that gets updated each time they decode a change which is > > not what we are doing. So, this can confuse users. Your expectation of > > answer (NULL) when the slot is active is correct and that is what will > > happen. > > Yeah, and so would be the confusion: why is last_active_time NULL while one is > using the slot?
I agree that users could get confused here, but the solution to that shouldn't be to give the field a name that is the opposite of what it actually does. I expect a field called last_inactive_time to tell me the last time that the slot was inactive. Here, it tells me the last time that a currently-inactive slot previously *WAS* active. How can you justify calling that the last *INACTIVE* time? AFAICS, the user who has the confusion that you mention here is simply wrong. If they are looking at a field called "last active time" and the slot is active, then the correct answer is "right now" or "undefined" and that is what they will see. Sure, they might not understand that. But flipping the name of the field on its head cannot be the right way to help them. With the current naming, I expect to have the exact opposite confusion as your hypothetical confused user. I'm going to be looking at a slot that's currently inactive, and it's going to tell me that the last_inactive_time was at some time in the past. And I'm going to say "what the heck is going on here, the slot is inactive *right now*!" Half of me wonders whether we should avoid this whole problem by renaming it to something like last_state_change or last_state_change_time, or maybe just state_change like we do in pg_stat_activity, and making it mean the last time the slot flipped between active and inactive in either direction. I'm not sure if this is better, but unless I'm misunderstanding something, the current situation is terrible. -- Robert Haas EDB: http://www.enterprisedb.com