MySQL Forums
Forum List  »  MyISAM

why bigger index of ascii than utf8?
Posted by: 武士 小浜
Date: March 20, 2013 09:01PM

Hello all,

I compared the size of index file of MyISAM
with charset=ascii and utf8,
as the followings:


create table TESTT_ASCII_test1 (
pid int,
pcode char(11),
primary key(pid, pcode)
) ENGINE=MyISAM DEFAULT CHARSET=ascii;

load data local infile 'test.dat'
into table TESTT_ASCII_test1;
flush table TESTT_ASCII_test1;

create table TESTT_UTF8_test1 (
pid int,
pcode char(11),
primary key(pid, pcode)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
load data local infile 'test.dat'
into table TESTT_UTF8_test1;
flush table TESTT_UTF8_test1;

The 'test.dat' is:
1 A0000000001
1 A0000000002
1 A0000000003
...
1 A0000100000

Then sizes of MyISAM files are:

# ls -l TESTT_*
-rw-rw---- 1 mysql mysql 1600000 Mar 21 11:06 TESTT_ASCII_test1.MYD
-rw-rw---- 1 mysql mysql 2350080 Mar 21 11:06 TESTT_ASCII_test1.MYI
-rw-rw---- 1 mysql mysql 8590 Mar 21 11:06 TESTT_ASCII_test1.frm
-rw-rw---- 1 mysql mysql 3800000 Mar 21 11:06 TESTT_UTF8_test1.MYD
-rw-rw---- 1 mysql mysql 852992 Mar 21 11:06 TESTT_UTF8_test1.MYI
-rw-rw---- 1 mysql mysql 8590 Mar 21 11:06 TESTT_UTF8_test1.frm


Why is the size of TESTT_ASCII_test1.MYI
larger than TESTT_UTF8_test1.MYI ,
and which is better performance?

In the case that the primary key has only pcode,
these files were the same size.

(MySQL version is 5.6.10, OS version is CentOS 6.3)

Thanks.
Kohama

Options: ReplyQuote


Subject
Views
Written By
Posted
why bigger index of ascii than utf8?
3075
March 20, 2013 09:01PM


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.