Hacker News new | past | comments | ask | show | jobs | submit login

What is a "non-unicode character"?

Why do you need a fixed character limit at all?




I don't know about your first question, but the reason you need a character limit is because each time a row is added to a database, enough space is set aside to contain that row.

Each row contains the same columns. For example: table Person: col1 label: name / type: text / size: 10 2 label: age / type: int / size: 3 3 label: address / type: text / size: 200

the type tells the database how to encode the data found in that column - an int takes less space than a string, so this is a space saving measure. The size refers to how many characters are allowed in that field, because that is how much space will be allocated when the row is created. If you don't need 200 characters of space, it's wasteful to allow it. But you kind of have to put a number in there, even if it's a big one.

Correct me if I'm wrong, all my knowledge comes from Dr. Marla Weston's 2nd year Databases Design course.


A very poor course indeed if it told you to use fixed-size data types for arbitrary string data, or implied all string types in databases were fixed-size. SQL string types like VARCHAR and TEXT are assuredly variable, using only the storage necessary to hold the actual data (plus bookkeeping overhead). CHAR is fixed-size, but I can't remember the last table I created with a CHAR column. They're quite uncommon in comparison.


Not all databases store varchar differently from a text column, for example I don't think PSQL distinguishes between the two in storage and there are no performances improvements from using varchar.

http://www.postgresql.org/docs/9.3/interactive/datatype-char...


> What is a "non-unicode character"?

A character with no representation in the latest Unicode standard.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: