[GENERAL] row is too big

2011-08-31 Thread Sim Zacks

select version()
PostgreSQL 8.2.19 on i686-pc-linux-gnu, compiled by GCC gcc (Debian 
4.3.2-1.1) 4.3.2


Before you jump down my throat about bad design, this is a reporting 
table that is generated based on what the users want to see in their 
rows and columns. (I'm basically generating a spreadsheet for the user 
to copy and paste and then play with graphing functions)


I have a table with 952 fields one text, one int, all the rest numeric 
(no precision or scale defined).
The value of one row is the sum of all the other rows (insert into table 
select sum(a),sum(b),sum(c)...)
The values in this case all fit into an integer size, int column is a 
sum of all the other columns and is 300,000
The text value is blank ('' not null. When I made it null it took up 16 
more bytes)

I am getting an error on inserting the total row:
ERROR:  row is too big: size 11436, maximum size 8136

The manual doesn't say exactly how much storage a numeric type uses, but 
it seems to me that it is taking up about 12 bytes per field. Does this 
make any sense?


Thanks
Sim


--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] row is too big

2011-08-31 Thread Tom Lane
Sim Zacks s...@compulab.co.il writes:
 The manual doesn't say exactly how much storage a numeric type uses, but 
 it seems to me that it is taking up about 12 bytes per field. Does this 
 make any sense?

Yeah, that would be the minimum size of a nonzero numeric value in 8.2.
(More recent versions can pack them a bit tighter in many cases.)

You might consider whether you can put all those numeric fields into an
array.

regards, tom lane

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general