Yesterday, because of the character set conversion related errors, today want to verify the next UTF8 and gbk the gap between the respective space. This test, the absolute destruction of the three views, whether Chinese or Chinese + English, GBK and UTF8 occupy the actual physical size is exactly the same, is not theoretically described as "UTF-8 to Chinese 3 bytes, the English use 1 bytes, GBK to both English and Chinese use 2 bytes", as follows:
Empty table:
GBK as follows:
CREATE TABLE ' TEST_CHAR_GBK ' (
' gbk_str ' varchar (+) DEFAULT NULL
) Engine=innodb DEFAULT CHARSET=GBK;
INSERT into TEST_CHAR_GBK VALUES (' ffhpf2fhfh2hfh32h82h832h328fhf28fh3283h83h8h82h382 ');
INSERT INTO TEST_CHAR_GBK select * from TEST_CHAR_GBK
Total 65536 rows affected
UTF8:
CREATE TABLE ' Test_char_utf8 ' (
' utf8_str ' varchar (+) DEFAULT NULL
) Engine=innodb DEFAULT Charset=utf8;
INSERT into Test_char_utf8 VALUES (' ffhpf2fhfh2hfh32h82h832h328fhf28fh3283h83h8h82h382 ');
INSERT INTO Test_char_utf8 select * from Test_char_utf8
Total 65536 rows affected
============= again the combination of English, the actual majority is also a combination of =============
TRUNCATE TABLE Test_char_utf8;
INSERT into Test_char_utf8 VALUES (' ffhpf2fhfh2hfh32h82h832h328fhf28fh3283h83h8h82h382 ');
INSERT into Test_char_utf8 VALUES (' China China China, China, China ');
INSERT INTO Test_char_utf8 select * from Test_char_utf8
Total 65536 rows affected
TRUNCATE TABLE TEST_CHAR_GBK;
INSERT into TEST_CHAR_GBK VALUES (' ffhpf2fhfh2hfh32h82h832h328fhf28fh3283h83h8h82h382 ');
INSERT into TEST_CHAR_GBK VALUES (' China China China, China, China ');
INSERT INTO TEST_CHAR_GBK select * from TEST_CHAR_GBK
Total 65536 rows affected
I'll go..... Not so fun ....
MySQL innodb table UTF8 GBK occupy the same space, destroy three views