Received: from k3.aeccom.com (IDENT:root@gate1.aeccom.com [193.158.11.51]) by hub.org (8.9.3/8.9.3) with ESMTP id KAA54845 for ; Fri, 21 Jan 2000 10:38:24 -0500 (EST) (envelope-from lutzeb@aeccom.com) Received: from ampato.aeccom.com (IDENT:root@ampato.aeccom.com [192.168.0.11]) by k3.aeccom.com (8.9.3/8.9.3) with ESMTP id QAA30828; Fri, 21 Jan 2000 16:38:52 +0100 Received: (from lutzeb@localhost) by ampato.aeccom.com (8.9.3/8.9.3) id QAA09237; Fri, 21 Jan 2000 16:38:52 +0100 From: Dirk Lutzebaeck MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <14472.32125.181522.797383@ampato.aeccom.com> Date: Fri, 21 Jan 2000 16:38:37 +0100 (CET) To: Patrik Kudo Cc: "pgsql-sql@postgreSQL.org" Subject: Re: [SQL] Problem with large tuples. In-Reply-To: <388875D0.21942465@partitur.se> References: <388875D0.21942465@partitur.se> X-Mailer: VM 6.71 under 21.1 (patch 4) "Arches" XEmacs Lucid Patrik Kudo writes: > I've noticed that some of my tables with large text tuples have > problem when these exceed some certain size. I know about the > 8k tuplesize limit, but it seems the problem appears earlier > than that. This is what I've been able to recreate: > > CREATE TABLE sizetest (id int, txt text); > INSERT INTO sizetest (id, txt) VALUES (1, '...'); // ... = string of > 4000 chars > vacuum analyze; // <-- works nicely > INSERT INTO sizetest (id, txt) VALUES (2, '...'); // ... = string of > 4100 chars > vacuum analyze; > ERROR: Tuple is too big: size 8152, max size 8140 > > How come the insert works while the vacuum fails? It's a bug. You need this patch against 6.5.3: *** src/backend/commands/vacuum.c.orig Wed Aug 25 08:01:45 1999 --- src/backend/commands/vacuum.c Tue Jan 4 12:15:17 2000 *************** *** 2405,2414 **** stup = heap_formtuple(sd->rd_att, values, nulls); /* ---------------- ! * insert the tuple in the relation and get the tuple's oid. * ---------------- */ ! heap_insert(sd, stup); pfree(DatumGetPointer(values[3])); pfree(DatumGetPointer(values[4])); pfree(stup); --- 2405,2425 ---- stup = heap_formtuple(sd->rd_att, values, nulls); /* ---------------- ! * Watch out for oversize tuple, which can happen if ! * both of the saved data values are long. ! * Our fallback strategy is just to not store the ! * pg_statistic tuple at all in that case. (We could ! * replace the values by NULLs and still store the ! * numeric stats, but presently selfuncs.c couldn't ! * do anything useful with that case anyway.) * ---------------- */ ! if (MAXALIGN(stup->t_len) <= MaxTupleSize) ! { ! /* OK to store tuple */ ! heap_insert(sd, stup); ! } ! pfree(DatumGetPointer(values[3])); pfree(DatumGetPointer(values[4])); pfree(stup); After patching you should remove your statistics with 'DELETE FROM pg_statistic'; You might also need to patch vio.c. Get it from the latest snapshot... Go back in the pgsql-bugs archive to read more about this problem. It was discussed some weeks ago... Dirk