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

From Bruce Momjian
Subject Re: [GENERAL] space-effective varchar(255)-like arrangement
Date
Msg-id 199812261818.NAA00775@candle.pha.pa.us
Whole thread Raw
In response to space-effective varchar(255)-like arrangement  (Jan Vicherek <honza@ied.com>)
Responses Re: [GENERAL] space-effective varchar(255)-like arrangement
List pgsql-general
>
>  Hello,
>
>    I'm creating a list of all my files anywhere in a 60' diameter on any
> possible media around me.
>
>    For such purpose I'm planning to use PostgreSQL.
>
>   The main table might look like :
> create table file (
>         name    varchar(255),   -- file : name; tape : name / #; tapedata : #
>         am      int,            -- method of accessing contained file(s)/data
>                                 -- one of tape,gz,tar,Z,zip,spio,afio,cab,crypt
>                                 -- pgp,AUTO
>         size    int8,           -- file : file size up to 2 ^ 64
>                                 -- tape : sum of datablock sizes
>         md5     char(32),       -- MD5 sum of the data of size
>         created datetime,       -- date of creation timestamp
>         modified datetime,      -- date of last modification timestamp
>         type    int,            -- directory entry type :
>                                 --   file,dir,link,device,pipe
>         mode    int2,           -- 16 mode bits
>         ownernm char(8),        -- owner name
>         ownerid int2,           -- owner id
>         groupnm char(8),        -- group name
>         groupid int2,           -- group id
>         links   int,            -- number of hard links
>         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.

--
  Bruce Momjian                        |  http://www.op.net/~candle
  maillist@candle.pha.pa.us            |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

pgsql-general by date:

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