| From: | Einar Karttunen <ekarttun(at)cs(dot)helsinki(dot)fi> | 
|---|---|
| To: | Nikola Milutinovic <Nikola(dot)Milutinovic(at)ev(dot)co(dot)yu> | 
| Cc: | pgsql-general(at)postgresql(dot)org | 
| Subject: | Re: TEXT datatype: compared to CHAR and VARCHAR | 
| Date: | 2001-11-23 13:33:09 | 
| Message-ID: | 20011123153309.C13842@shellak.helsinki.fi | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-general | 
On 23.11.01 13:43 +0100(+0000), Nikola Milutinovic wrote:
> Hi all.
> 
> One quick question. I have a doubt, should I use CHAR/VARCHAR or TEXT 
> data types in my database?
> 
> Two points are of most concern:
> 
> - performance
> - compatibility
> 
> Is VARCHAR faster for access/storing operations than TEXT? Since it 
> specifies the max. amount of space, one would think that it is better...
> 
> If I should choose to migrate my data to, say, Oracle, will TEXT field 
> cause problems in any way? I would have to rewrite the schema 
> definition, which can be painful for a larger database...
> 
Text doesn't have a worse performance than varchar, but you don't
have to try to remember the limit yourself. Both of them are stored
as variable length data.
Mysql supports the text-datatype but you cannot use it as primary
key in certain table types. Oracle AFAIK doesn't support text.
You have to use varchar2(n) for n<4000, or else CLOB.
- Einar Karttunen
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Jarmo Paavilainen | 2001-11-23 14:24:29 | Re: rollback question | 
| Previous Message | Nikola Milutinovic | 2001-11-23 12:54:39 | Classes (Object Oriented) in PostgreSQL question |