pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Problem with large tuples.
5+ messages / 4 participants
[nested] [flat]

* Problem with large tuples.
@ 2000-01-21 15:05 Patrik Kudo <kudo@partitur.se>
  2000-01-21 15:38 ` Re: [SQL] Problem with large tuples. Dirk Lutzebaeck <lutzeb@aeccom.com>
  0 siblings, 1 reply; 5+ messages in thread

From: Patrik Kudo @ 2000-01-21 15:05 UTC (permalink / raw)
  To: pgsql-sql

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?

Setup: Postgres 6.5.2, FreeBSD 3.3

/Patrik Kudo



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: [SQL] Problem with large tuples.
  2000-01-21 15:05 Problem with large tuples. Patrik Kudo <kudo@partitur.se>
@ 2000-01-21 15:38 ` Dirk Lutzebaeck <lutzeb@aeccom.com>
  2000-01-25 11:29   ` Re: [SQL] Problem with large tuples. Palle Girgensohn <girgen@partitur.se>
  0 siblings, 1 reply; 5+ messages in thread

From: Dirk Lutzebaeck @ 2000-01-21 15:38 UTC (permalink / raw)
  To: Patrik Kudo <kudo@partitur.se>; +Cc: pgsql-sql

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:

inline patch 1: src/backend/commands/vacuum.c (+13/-2 lines) download inline-1.patch*** 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 ^ permalink raw reply [nested|flat] 5+ messages in thread

* Re: [SQL] Problem with large tuples.
  2000-01-21 15:05 Problem with large tuples. Patrik Kudo <kudo@partitur.se>
  2000-01-21 15:38 ` Re: [SQL] Problem with large tuples. Dirk Lutzebaeck <lutzeb@aeccom.com>
@ 2000-01-25 11:29   ` Palle Girgensohn <girgen@partitur.se>
  2000-01-25 17:18     ` Re: [SQL] Problem with large tuples. Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 5+ messages in thread

From: Palle Girgensohn @ 2000-01-25 11:29 UTC (permalink / raw)
  To: Dirk Lutzebaeck <lutzeb@aeccom.com>; +Cc: Patrik Kudo <kudo@partitur.se>; pgsql-sql

Dirk Lutzebaeck wrote:
> 
...
> You might also need to patch vio.c. Get it from the latest snapshot...

vio.c?  Can't find it the 6.5.3 sources. I guess that means I don't need to patch it, right? ;)

/Palle



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: [SQL] Problem with large tuples.
  2000-01-21 15:05 Problem with large tuples. Patrik Kudo <kudo@partitur.se>
  2000-01-21 15:38 ` Re: [SQL] Problem with large tuples. Dirk Lutzebaeck <lutzeb@aeccom.com>
  2000-01-25 11:29   ` Re: [SQL] Problem with large tuples. Palle Girgensohn <girgen@partitur.se>
@ 2000-01-25 17:18     ` Tom Lane <tgl@sss.pgh.pa.us>
  2000-01-26 00:26       ` Re: [SQL] Problem with large tuples. Palle Girgensohn <girgen@partitur.se>
  0 siblings, 1 reply; 5+ messages in thread

From: Tom Lane @ 2000-01-25 17:18 UTC (permalink / raw)
  To: Palle Girgensohn <girgen@partitur.se>; +Cc: Dirk Lutzebaeck <lutzeb@aeccom.com>; Patrik Kudo <kudo@partitur.se>; pgsql-sql

Palle Girgensohn <girgen@partitur.se> writes:
> Dirk Lutzebaeck wrote:
>> You might also need to patch vio.c. Get it from the latest snapshot...

> vio.c?  Can't find it the 6.5.3 sources. I guess that means I don't need to patch it, right? ;)

I think he meant src/backend/access/heap/hio.c; there's a patch in there
that defends against adding an oversize tuple to a relation, IIRC.

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: [SQL] Problem with large tuples.
  2000-01-21 15:05 Problem with large tuples. Patrik Kudo <kudo@partitur.se>
  2000-01-21 15:38 ` Re: [SQL] Problem with large tuples. Dirk Lutzebaeck <lutzeb@aeccom.com>
  2000-01-25 11:29   ` Re: [SQL] Problem with large tuples. Palle Girgensohn <girgen@partitur.se>
  2000-01-25 17:18     ` Re: [SQL] Problem with large tuples. Tom Lane <tgl@sss.pgh.pa.us>
@ 2000-01-26 00:26       ` Palle Girgensohn <girgen@partitur.se>
  0 siblings, 0 replies; 5+ messages in thread

From: Palle Girgensohn @ 2000-01-26 00:26 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Dirk Lutzebaeck <lutzeb@aeccom.com>; Patrik Kudo <kudo@partitur.se>; pgsql-sql

Tom Lane wrote:
> 
> I think he meant src/backend/access/heap/hio.c; there's a patch in there
> that defends against adding an oversize tuple to a relation, IIRC.

Thanks. I applied the patch.

/Palle



^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2000-01-26 00:26 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2000-01-21 15:05 Problem with large tuples. Patrik Kudo <kudo@partitur.se>
2000-01-21 15:38 ` Dirk Lutzebaeck <lutzeb@aeccom.com>
2000-01-25 11:29   ` Palle Girgensohn <girgen@partitur.se>
2000-01-25 17:18     ` Tom Lane <tgl@sss.pgh.pa.us>
2000-01-26 00:26       ` Palle Girgensohn <girgen@partitur.se>

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