Why does "toast_tuple_target" allow values below TOAST_TUPLE_TARGET?

Started by David Rowleyalmost 7 years ago3 messages
#1David Rowley
david.rowley@2ndquadrant.com

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]/messages/by-id/CANP8+jKsVmw6CX6YP9z7zqkTzcKV1+Uzr3XjKcZW=2Ya00OyQQ@mail.gmail.com that Simon was mostly interested in
keeping values inline for longer. I saw no mention of moving them out
of line sooner.

[1]: /messages/by-id/CANP8+jKsVmw6CX6YP9z7zqkTzcKV1+Uzr3XjKcZW=2Ya00OyQQ@mail.gmail.com

--
David Rowley http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

#2Amit Langote
Langote_Amit_f8@lab.ntt.co.jp
In reply to: David Rowley (#1)
Re: Why does "toast_tuple_target" allow values below TOAST_TUPLE_TARGET?

On 2019/04/05 14:09, David Rowley wrote:

Or rather, why does the reloption allow values below the compile-time constant?

Maybe there is already a discussion in progress on the topic?

* Caveats from reloption toast_tuple_target *
/messages/by-id/CABOikdMt=mOtzW_ax_8pa9syEPo5Lji=LJrN2dunht8K-SLWzg@mail.gmail.com

Thanks,
Amit

#3David Rowley
david.rowley@2ndquadrant.com
In reply to: Amit Langote (#2)
Re: Why does "toast_tuple_target" allow values below TOAST_TUPLE_TARGET?

On Fri, 5 Apr 2019 at 18:25, Amit Langote <Langote_Amit_f8@lab.ntt.co.jp> wrote:

On 2019/04/05 14:09, David Rowley wrote:

Or rather, why does the reloption allow values below the compile-time constant?

Maybe there is already a discussion in progress on the topic?

* Caveats from reloption toast_tuple_target *
/messages/by-id/CABOikdMt=mOtzW_ax_8pa9syEPo5Lji=LJrN2dunht8K-SLWzg@mail.gmail.com

Doh. Okay, thanks. I'll drop this thread then. Seems what I wanted to
ask and say has been asked and said already.

--
David Rowley http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services