Go Back   Cloud Computing > General Discussion > General Discussion Forum
 

Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 03-31-11, 19:31
BOD Member
 
Join Date: Mar 2011
Posts: 14
Default Very large INNODB table file

One of the tables in my database has grown to a very large size, and I'm trying to determine why. innodb_file_per_table is enabled in my.cnf, so there are individual .ibd files for each table.

The table in question has a ibd of 40gb, but I'm unable to account for 10 gb of data. The table structure is as follows:

p_id --- int(10)
a_id --- int(5) [max value 72]
e_id --- tinyint(2) [max value 10]


Only one index exists, on p_id (cardinality of 1,326,888). According to the table status, I'm using 10gb in index and ~20gb in data. The total usage is 30gb.

Where are the other 10gb coming from?

Also, procedure_analyze suggests converting p_id to a MEDIUM, and a_id and e_id to ENUM. Will this result in substantial disk space savings?

Any suggestions or pointers please......

Thanx
Reply With Quote
  #2 (permalink)  
Old 03-31-11, 19:35
BOD Member
 
Join Date: Mar 2011
Posts: 19
Default

Quote:
Originally Posted by UserName View Post
Also, procedure_analyze suggests converting p_id to a MEDIUM, and a_id and e_id to ENUM. Will this result in substantial disk space savings?

Thanx
it might, but not enough, in my opinion, to compensate for the evil introduced into your application by using ENUM

a_id should be TINYINT like e_id, i.e. just 1 byte

the number in parentheses behind TINYINT does not mean what you think it does .

Regards,

Ronaldo
Reply With Quote
  #3 (permalink)  
Old 03-31-11, 19:37
BOD Member
 
Join Date: Mar 2011
Posts: 14
Default

Changing from TINYINT(2) to TINYINT(1) made a slight change in file size on my test database. I'm waiting for the system to finish altering the a_id field now. This operation usually takes an hour or so.. will reply back with my findings.
Reply With Quote
  #4 (permalink)  
Old 03-31-11, 19:39
BOD Member
 
Join Date: Mar 2011
Posts: 19
Default

Quote:
Originally Posted by UserName View Post
Changing from TINYINT(2) to TINYINT(1) made a slight change in file size on my test database.
I doubt that very much

TINYINT(2) is the same as TINYINT(1) is the same as TINYINT(937)

like i said, the number in parentheses doesn't do what you think it does.

Regards,

Ronaldo
Reply With Quote
  #5 (permalink)  
Old 03-31-11, 19:41
BOD Member
 
Join Date: Mar 2011
Posts: 14
Default

Initial results show that the ibd file decreased from 40gb to 23gb. Doing a little testing to make sure the system works ok.
Reply With Quote
  #6 (permalink)  
Old 03-31-11, 19:52
BOD Member
 
Join Date: Mar 2011
Posts: 14
Default

Quote:
Originally Posted by Ronaldo View Post
I doubt that very much

TINYINT(2) is the same as TINYINT(1) is the same as TINYINT(937)

like i said, the number in parentheses doesn't do what you think it does.
I read on mysql that the parenthesis number has to do with what's shown in display. TINYINT can hold values up to 127. So that's why it's oky for a_id and e_id.

The biggest change was going from INT to MEDIUMINT on p_id. At least I think that's where my disk savings came from.
Reply With Quote
  #7 (permalink)  
Old 03-31-11, 19:53
BOD Member
 
Join Date: Mar 2011
Posts: 19
Default

Quote:
Originally Posted by UserName View Post
The biggest change was going from INT to MEDIUMINT on p_id. At least I think that's where my disk savings came from.
yup

that's because INTEGER is 4 bytes and MEDIUMINT is only 3
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump


All times are GMT -6. The time now is 15:04.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
Copyright © 1999-2012, BODHost Ltd. All rights reserved.