Or rather, why does the reloption allow values below the compile-time constant?
It looks like we currently allow values as low as 128. The problem
there is that heap_update() and heap_prepare_insert() both only bother
calling toast_insert_or_update() when the tuple's length is above
TOAST_TUPLE_TARGET, so it seems to have no effect when set to a lower
value.
I don't think we can change heap_update() and heap_prepare_insert() to
do "tup->t_len > RelationGetToastTupleTarget(relation,
TOAST_TUPLE_TARGET)" instead as such a table might not even have a
TOAST relation since needs_toast_table() will return false if it
thinks the tuple length can't be above TOAST_TUPLE_TARGET.
It does not seem possible to add/remote the toast table when the
reloption is changed either as we're only obtaining a
ShareUpdateExclusiveLock to set it. We'd likely need to upgrade that
to an AccessExclusiveLock to do that.
I understand from reading [1] that Simon was mostly interested in
keeping values inline for longer. I saw no mention of moving them out
of line sooner.
[1] https://postgr.es/m/CANP8+jKsVmw6CX6YP9z7zqkTzcKV1+Uzr3XjKcZW=2Ya00OyQQ@mail.gmail.com
--
David Rowley http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services