postgresql - Postgres string data type storage allocation -


we running postgres 8.3.3 , documentation (http://www.postgresql.org/docs/8.3/static/datatype-character.html) leaves me few questions how storage allocated.

for purposes of discussion i'd stick assuming character = 1 byte.

i understand character(n) blank pads have n bytes stored.

if char(n) > 126 characters long, have overhead of 4 bytes (presumably storing length), otherwise overhead of 1 byte.

i'm interested in happens varchar(n).

if use varchar(255) , store 4 character string in it, have 4 bytes string & 4 bytes overhead, or have 1 byte overhead until hit 126 character limit?

i've googled , can't find documented anywhere.

any thoughts?

it's length of data store controls overhead, not maximum length of column. have 1 byte overhead until hit 126.


Comments

Popular posts from this blog

silverlight - Applying a style to ItemContainerStyle in C# -

c# - NullReferenceException in MySqlClient.NativeDriver -

php - Updating recent updates - Problem in procedure - Any other approach? -