I wrote: > Gregory Stark <[EMAIL PROTECTED]> writes: >> Is there any reason to experiment with this? I would have thought we would >> divorce TOAST_MAX_CHUNK_SIZE from TOAST_THRESHOLD and hard code it as the >> same >> expression that's there now. Ie, the largest size that can fit in a page.
> No, right now it's the largest size that you can fit 4 on a page. It's > not obvious to me that 4 is optimal once it's divorced from TOAST_THRESHOLD. > It seems possible that the correct number is 1, and even if it's useful > to keep the tuples smaller than that, there's no reason to assume 4 is > the best number per page. I've just committed changes that make it trivial to experiment with the number of toast tuples per page: #define EXTERN_TUPLES_PER_PAGE 4 /* tweak only this */ /* Note: sizeof(PageHeaderData) includes the first ItemId on the page */ #define EXTERN_TUPLE_MAX_SIZE \ MAXALIGN_DOWN((BLCKSZ - \ MAXALIGN(sizeof(PageHeaderData) + (EXTERN_TUPLES_PER_PAGE-1) * sizeof(ItemIdData))) \ / EXTERN_TUPLES_PER_PAGE) #define TOAST_MAX_CHUNK_SIZE \ (EXTERN_TUPLE_MAX_SIZE - \ MAXALIGN(offsetof(HeapTupleHeaderData, t_bits)) - \ sizeof(Oid) - \ sizeof(int32) - \ VARHDRSZ) Anyone who's got time to run performance experiments, have at it ... regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 3: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq