Re: Counterintuitive behavior when toast_tuple_target < TOAST_TUPLE_THRESHOLD

2022-09-15 Thread Aleksander Alekseev
Hi David, > There was some discussion on this problem in [1]. > [1] https://www.postgresql.org/message-id/20190403063759.gf3...@paquier.xyz Thanks for sharing this discussion. I missed it. > The problem with #2 is that if you look at > heapam_relation_needs_toast_table(), it only decides if the

Re: Counterintuitive behavior when toast_tuple_target < TOAST_TUPLE_THRESHOLD

2022-09-15 Thread Nikita Malakhov
Hi! As it is seen from the code (toasting.c and further) Toast tables are created immediately when a new relation with the TOASTable column is created. Practically, there could occur the case when Toast table does not exist and we should of course check for that. TOAST_TUPLE_THRESHOLD is not only

Re: Counterintuitive behavior when toast_tuple_target < TOAST_TUPLE_THRESHOLD

2022-09-14 Thread David Rowley
On Thu, 15 Sept 2022 at 04:04, Aleksander Alekseev wrote: > 1. Forbid setting toast_tuple_target < TOAST_TUPLE_THRESHOLD > 2. Consider using something like RelationGetToastTupleTarget(rel, > TOAST_TUPLE_THRESHOLD) in heapam.c:2250, heapam.c:3625 and > rewriteheap.c:636 and modify the documentation

Re: Counterintuitive behavior when toast_tuple_target < TOAST_TUPLE_THRESHOLD

2022-09-14 Thread Nikita Malakhov
Hi! I've noticed this behavior half a year ago during experiments with TOAST, and TOAST_TUPLE_THRESHOLD really works NOT the way it is thought to. I propose something like FORCE_TOAST flag/option as column option (stored in attoptions), because we already encountered multiple cases where data shou

Re: Counterintuitive behavior when toast_tuple_target < TOAST_TUPLE_THRESHOLD

2022-09-14 Thread Aleksander Alekseev
Hi hackers, > 1. Forbid setting toast_tuple_target < TOAST_TUPLE_THRESHOLD Reading my own email I realized that this of course was stupid. For sure this is not an option. It's getting late in my timezone, sorry :) -- Best regards, Aleksander Alekseev

Counterintuitive behavior when toast_tuple_target < TOAST_TUPLE_THRESHOLD

2022-09-14 Thread Aleksander Alekseev
Hi hackers, Recently in one discussion a user complained [1] about counterintuitive behavior of toast_tuple_target. Here is a quote: """ Table size 177.74 GB Toast table size 12 GB Indexes size 33.49 GB This table is composed of small columns "id", "hash", "size", and a mid~big (2~512kb) jsonb.