Skip site navigation (1) Skip section navigation (2)

Re: Modifying TOAST thresholds

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Gregory Stark <stark(at)enterprisedb(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Modifying TOAST thresholds
Date: 2007-04-03 04:21:16
Message-ID: 17443.1175574076@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-hackers
I wrote:
> Gregory Stark <stark(at)enterprisedb(dot)com> 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

In response to

pgsql-hackers by date

Next:From: Tom LaneDate: 2007-04-03 04:26:41
Subject: Re: Modifying TOAST thresholds
Previous:From: Chris BrowneDate: 2007-04-03 04:18:16
Subject: Re: Modifying TOAST thresholds

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group