TEXT datatype: compared to CHAR and VARCHAR

Started by Nikola Milutinovicover 24 years ago2 messagesgeneral
Jump to latest
#1Nikola Milutinovic
Nikola.Milutinovic@ev.co.yu

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...

Your thoughts?

Nix.

#2Einar Karttunen
ekarttun@cs.Helsinki.FI
In reply to: Nikola Milutinovic (#1)
Re: TEXT datatype: compared to CHAR and VARCHAR

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