Re: <char dimension with charset UTF8>
Posted by:
Rick James
Date: November 28, 2010 07:06PM
You are into small differences.
Each of these is 1 byte:
TINYINT UNSIGNED NOT NULL
CHAR(1) NOT NULL CHARACTER SET ASCII
ENUM('x', 'y', 'z') NOT NULL
BINARY(1) NOT NULL
INT is 4 bytes
VARCHAR has a length field
CHAR(1) with utf8 involves complex collation, and will occupy 3 bytes. (A new charset name will be used for 4-byte utf8, coming in 5.5(?))
NULL takes an extra bit for NULLness (in MyISAM)
UNSIGNED makes no difference in this context, but it seems 'right'
ENUM often seems the 'best', but it is messy if you need to add a new value.
TINYINT is cryptic; you need to remember what '1' means.
BINARY(1), with a letter in it, is a compromise.
CREATE TABLE 'user'( 'level' int );
-->
CREATE TABLE `user`( `level` int );
(note backtics instead of apostrophes)
Subject
Views
Written By
Posted
4357
November 27, 2010 03:31PM
Re: <char dimension with charset UTF8>
1561
November 28, 2010 07:06PM
1534
November 29, 2010 05:46AM
1437
November 29, 2010 09:07AM
1438
November 29, 2010 10:03AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.