Re: [GENERAL] space-effective varchar(255)-like arrangement - Mailing list pgsql-general

From Jan Vicherek
Subject Re: [GENERAL] space-effective varchar(255)-like arrangement
Date
Msg-id Pine.LNX.4.04.9812261417170.11035-100000@ann.ied.com
Whole thread Raw
In response to Re: [GENERAL] space-effective varchar(255)-like arrangement  (Bruce Momjian <maillist@candle.pha.pa.us>)
Responses Re: [GENERAL] space-effective varchar(255)-like arrangement
Re: [GENERAL] space-effective varchar(255)-like arrangement
List pgsql-general

  Hmm,

On Sat, 26 Dec 1998, Bruce Momjian wrote:

> >   The main table might look like :
> > create table file (
> >         name    varchar(255),   -- file : name; tape : name / #; tapedata : #
 ...
> >         mjmn    int2            -- if device, major / minor #
> > );
> >
> >   However, the first line "name    varchar(255)" will waste a lot of
> > space, since only about %0.02 files will be over 200 chars, %0.1 over 100,
> > %0.2 over 64 and %1.6 over 32.
>
> See the FAQ under character types.  varcahr() does not store the max
> space, only used space.

   hmm, thus if one block has 8192 bytes, and if there is 9-byte overhead
for each row, then I can store 390 rows in one block if, on average,
"names" are 10 chars in length ? echo $[ 8192 / ( 9 + 10 + 2 ) ] # = 390

   If each record has variable length, pg has no way of calculating where
is start of next record, other than going through the block and summing up
lengths of varchars to determine where does next record begin, right ?
(above I use word "record" and "row" interchangeably).

    Thanx a bunch,

        Jan



 -- Gospel of Jesus is the saving power of God for all who believe --
                ## To some, nothing is impossible. ##
                   http://Vicherek.Waterloo.on.ca/


pgsql-general by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [GENERAL] space-effective varchar(255)-like arrangement
Next
From: Jan Vicherek
Date:
Subject: Re: [GENERAL] space-effective varchar(255)-like arrangement