Thread: idea: reduce logical slot induced bloat when multiple databases areused

idea: reduce logical slot induced bloat when multiple databases areused

From
Andres Freund
Date:
Hi,

Right now we prevent dead rows in non-shared catalog tables from being
removed whenever there is a logical slot with an older catalog
xmin. Obviously that's required when the slot is in the current
database, but it's not when the slot is in a different database.

I don't think we can afford to iterate through the slots to determine
the "current database horizon" in GetSnapshotData(), but it should not
be a problem to do so in GetOldestXmin(). The latter should normally not
be called at a very high frequency.

I think in busy clusters this could help even when only one database is
in active use, because it allows relfrozenxid in template0/1 to be
advanced more aggressively.


I'm writing this down as an idea, I don't plan to work on this anytime
soon.

Greetings,

Andres Freund