Re: [GENERAL] space-effective varchar(255)-like arrangement

From: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
To: honza(at)ied(dot)com (Jan Vicherek)
Cc: pgsql-general(at)postgreSQL(dot)org
Subject: Re: [GENERAL] space-effective varchar(255)-like arrangement
Date: 1998-12-26 18:18:11
Message-ID: 199812261818.NAA00775@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Constantin Teodorescu 1998-12-26 18:54:40 Re: pgaccess 0.93 problem.
Previous Message KARASAEV Askar 1998-12-26 06:25:29 How to begin understanding PostgreSQL?