Thread: TEXT datatype: compared to CHAR and VARCHAR

TEXT datatype: compared to CHAR and VARCHAR

From
Nikola Milutinovic
Date:
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.


Re: TEXT datatype: compared to CHAR and VARCHAR

From
Einar Karttunen
Date:
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