X-Original-To: pgsql-docs-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id E90CA9FA2A0; Sat, 10 Jun 2006 23:59:24 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 51783-07; Sat, 10 Jun 2006 23:59:19 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id E07F19F9AD3; Sat, 10 Jun 2006 23:59:18 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k5B2wnoK004764; Sat, 10 Jun 2006 22:58:49 -0400 (EDT) To: "Jim C. Nasby" cc: Christopher Browne , pgsql-general@postgresql.org, pgsql-docs@postgresql.org Subject: Re: [GENERAL] TOAST not working In-reply-to: <20060611021215.GC83625@pervasive.com> References: <1149944622.15368.38.camel@vaio1linux> <87bqt03efl.fsf@wolfe.cbbrowne.com> <20060611021215.GC83625@pervasive.com> Comments: In-reply-to "Jim C. Nasby" message dated "Sat, 10 Jun 2006 21:12:15 -0500" Date: Sat, 10 Jun 2006 22:58:49 -0400 Message-ID: <4763.1149994729@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200606/3 X-Sequence-Number: 3586 "Jim C. Nasby" 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