Re: [GENERAL] TOAST not working

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Jim C(dot) Nasby" <jnasby(at)pervasive(dot)com>
Cc: Christopher Browne <cbbrowne(at)acm(dot)org>, pgsql-general(at)postgresql(dot)org, pgsql-docs(at)postgresql(dot)org
Subject: Re: [GENERAL] TOAST not working
Date: 2006-06-11 02:58:49
Message-ID: 4763.1149994729@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs pgsql-general

"Jim C. Nasby" <jnasby(at)pervasive(dot)com> writes:
> Actually, it's BLCKSZ/4. From
> http://www.postgresql.org/docs/8.1/interactive/storage-toast.html:

> "The TOAST code is triggered only when a row value to be stored in a
> table is wider than BLCKSZ/4 bytes (normally 2Kb)."

> BTW, 'row value' seems a bit prone to confusion (could be interpreted as
> the row itself). It'd probably be better to say 'field'.

No, because that would be wrong; the statement is correct as written.
The toaster tries to do something about rows that are wider than
BLCKSZ/4 (well, actually MaxTupleSize/4 ... try grepping the source
for TOAST_TUPLE_THRESHOLD).

The OP's problem is that he's got too dang many fields. A TOAST pointer
is 20 bytes wide (on most machines, at least) so even if we toast every
single field out-of-line, we can't support more than about 400 toastable
fields in a row. The FAQ says

Maximum number of columns in a table? 250-1600 depending on column
types

but the 1600 figure is for datatypes like int4 that only take 4 bytes
anyway.

The OP was trying to store numeric(11,2) fields. If I'm counting on my
fingers correctly, such a value would occupy 16 bytes natively, which
means that pushing it out-of-line would be a dead loss anyway. But he's
still not going to get more than 512 of them into an 8K page.

regards, tom lane

In response to

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message Jim C. Nasby 2006-06-11 03:15:14 Re: [GENERAL] TOAST not working
Previous Message Angus Berry 2006-06-11 02:43:02 Re: TOAST not working

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2006-06-11 03:14:00 Re: [GENERAL] Error Starting Back END
Previous Message Angus Berry 2006-06-11 02:43:02 Re: TOAST not working