Ich zitiere einfach mal aus der PostgreSQL Doku:

--------------------
"Values of type character are physically padded with spaces to the
specified width n, and are stored and displayed that way. However, the
padding spaces are treated as semantically insignificant. Trailing
spaces are disregarded when comparing two values of type character,
and they will be removed when converting a character value to one of
the other string types. Note that trailing spaces are semantically
significant in character varying and text values.

The storage requirement for a short string (up to 126 bytes) is 1 byte
plus the actual string, which includes the space padding in the case
of character. Longer strings have 4 bytes overhead instead of 1. Long
strings are compressed by the system automatically, so the physical
requirement on disk might be less. Very long values are also stored in
background tables so that they do not interfere with rapid access to
shorter column values. In any case, the longest possible character
string that can be stored is about 1 GB. (The maximum value that will
be allowed for n in the data type declaration is less than that. It
wouldn't be very useful to change this because with multibyte
character encodings the number of characters and bytes can be quite
different anyway. If you desire to store long strings with no specific
upper limit, use text or character varying without a length specifier,
rather than making up an arbitrary length limit.)

Tip
There are no performance differences between these three types, apart
from increased storage size when using the blank-padded type, and a
few extra cycles to check the length when storing into a
length-constrained column. While character(n) has performance
advantages in some other database systems, it has no such advantages
in PostgreSQL. In most situations text or character varying should be
used instead."
--------------------

Mit anderen Worten: Entweder gleich eine unbegrenzte Spalte nehmen
(text) oder eine character varying (varchar bei mysql) wobei dort die
Groeße keinerlei Performanceauswirkungen hat bzw. nur negative dadurch
das die Länge geprüft werden muss.

Lars

_______________________________________________
Talk-de mailing list
Talk-de@openstreetmap.org
http://lists.openstreetmap.org/listinfo/talk-de

Antwort per Email an