pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Jim C. Nasby <jnasby@pervasive.com>
Cc: Christopher Browne <cbbrowne@acm.org>
Cc: pgsql-general@postgresql.org
Cc: pgsql-docs@postgresql.org
Subject: Re: [GENERAL] TOAST not working
Date: Sat, 10 Jun 2006 22:58:49 -0400
Message-ID: <4763.1149994729@sss.pgh.pa.us> (raw)
In-Reply-To: <20060611021215.GC83625@pervasive.com>
References: <1149944622.15368.38.camel@vaio1linux>
	<87bqt03efl.fsf@wolfe.cbbrowne.com>
	<20060611021215.GC83625@pervasive.com>

"Jim C. Nasby" <jnasby@pervasive.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



view thread (9+ messages)  latest in thread

Message-ID: <4763.1149994729@sss.pgh.pa.us>
Permalink:  ../4763.1149994729@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/4763.1149994729@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-docs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, jnasby@pervasive.com, cbbrowne@acm.org, pgsql-general@postgresql.org
  Subject: Re: [GENERAL] TOAST not working
  In-Reply-To: <4763.1149994729@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox