Обсуждение: finding out actual tuple size

Поиск
Список
Период
Сортировка

finding out actual tuple size

От
Linh Luong
Дата:
Hi All,

1. I have been reading and the max size of a tuple is 8K.
I have also read that I can it to a larger size in some config file.  Where is
this file? is it called pg_config.h and is the variable called BLKSZ??

2. Is there a way I can find the actual size of the tuple? Do you go into each
column and find the length of each value and sum it up? I am out of ideas..

if someone knows how please shine some light on my situation..

thanks

--------------------------------
Linh Luong


Re: finding out actual tuple size

От
Andrew Sullivan
Дата:
On Tue, Feb 17, 2004 at 03:39:25PM -0700, Linh Luong wrote:
> Hi All,
>
> 1. I have been reading and the max size of a tuple is 8K.

That hasn't been true for ages.  Use a newer PostgreSQL; any modern
one will have the TOAST capability and won't have this limitation.

A

--
Andrew Sullivan

Re: finding out actual tuple size

От
"scott.marlowe"
Дата:
On Tue, 17 Feb 2004, Linh Luong wrote:

> Hi All,
>
> 1. I have been reading and the max size of a tuple is 8K.
> I have also read that I can it to a larger size in some config file.  Where is
> this file? is it called pg_config.h and is the variable called BLKSZ??

You'd have to set the way back machine for a couple years ago to run into
the 8k block size limit.  If someone recently told you this to steer you
away from Postgresql their knowledge is quite old, and anything they tell
you about anything since, say, the first gulf war should be viewed with
suspicion :-)

the maximum size of an idividual FIELD in a row is about 2 gigabytes.
Since text may be multi-byte, it's a good idea to call it 1 gig (of
characters) for text and you're gold.

> 2. Is there a way I can find the actual size of the tuple? Do you go into each
> column and find the length of each value and sum it up? I am out of ideas..

Why would you need to know an idividual tuple size?  There's a bit of
extra data for each field, but generally if the size of the data in the
field is 1k or more, you're not likely to notice the overhead Postgresql
is producing.

Each tuple uses about 30 some bytes, (I could be way off there, it might
be bits.)  then each field uses another byte or two to keep track of
things like the size of the field etc on top of the actual data it stores.


Re: finding out actual tuple size

От
Tom Lane
Дата:
Andrew Sullivan <ajs@crankycanuck.ca> writes:
> On Tue, Feb 17, 2004 at 03:39:25PM -0700, Linh Luong wrote:
>> 1. I have been reading and the max size of a tuple is 8K.

> That hasn't been true for ages.  Use a newer PostgreSQL; any modern
> one will have the TOAST capability and won't have this limitation.

Actually it is still true, but with TOAST compression available for
individual columns it hardly ever matters anymore.  If you have enough
columns in your table to be running afoul of the limit, you probably
oughta be thinking about a redesign of your database schema anyway.

But for the record: BLCKSZ is the thing to poke if you really must.

            regards, tom lane