Thread: Which character data type to use?

Which character data type to use?

From
martin.chantler@convergys.com
Date:

Hello everyone,

For storing character data such as surname, email address which
is the best data type to use?

This is my guess:
Char - For small columns, fixed length in record
VarChar - Is this fixed length in record? If not then is it stored in an
'overflow' area
which will effect performance. Maybe theres an allocated length that sets how
much is stored in the record
Text - Only differences seems to be that no length is specified

Can each of these be indexed???

Which of these is fastest considering hard disks are so cheap I don't much care
about which takes the most bytes!

NB The HTML manual didn't seem to explain this in detail - can anyone help me?

Cheers,
MC



Re: Which character data type to use?

From
Peter Eisentraut
Date:
martin.chantler@convergys.com writes:

> For storing character data such as surname, email address which
> is the best data type to use?

See FAQ item 4.15.  VARCHAR is my suggestion.

> Can each of these be indexed???

Yes

> Which of these is fastest considering hard disks are so cheap I don't much care
> about which takes the most bytes!

You're dead wrong if you're thinking that way.  The issue is not that hard
disk space is cheap, it's that cache memory is scarce.

--
Peter Eisentraut      peter_e@gmx.net       http://yi.org/peter-e/