MySQL Forums :: Newbie :: Estimating Index Size on Innodb Tables


Advanced Search

Estimating Index Size on Innodb Tables
Posted by: Paulo Victor Maluf Alves ()
Date: July 23, 2010 02:07PM

Dears,

I want to estimate an index size, based on innodb tables.


For instance:


Employees:
+------------+---------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+------------+---------------+------+-----+---------+-------+
| emp_no | int(11) | NO | PRI | NULL | |
| birth_date | date | NO | | NULL | |
| first_name | varchar(14) | NO | MUL | NULL | |
| last_name | varchar(16) | NO | | NULL | |
| gender | enum('M','F') | NO | | NULL | |
| hire_date | date | NO | | NULL | |
+------------+---------------+------+-----+---------+-------+

select count(1) from employees;
+----------+
| count(1) |
+----------+
| 300024 |
+----------+

I try:

SELECT ROUND(AVG(LENGTH(first_name)),2) FROM employees;
+----------------------------------+
| ROUND(AVG(LENGTH(first_name)),2) |
+----------------------------------+
| 6.22 |
+----------------------------------+

So:
(6.22 * 300024)/1024/1024 = 1.77 MB


That´s correct? I don´t think so...


mysql> create index first_idx01 on employees(first_name);

mysql> SELECT ROUND(index_length/1024/1024,2) as total_index_size_mb FROM information_schema.TABLES WHERE table_name = 'employees';
+---------------------+
| total_index_size_mb |
+---------------------+
| 9.52 |
+---------------------+


Thanks.

Options: ReplyQuote


Subject Written By Posted
Estimating Index Size on Innodb Tables Paulo Victor Maluf Alves 07/23/2010 02:07PM
Re: Estimating Index Size on Innodb Tables Rick James 07/26/2010 11:39PM
Re: Estimating Index Size on Innodb Tables Paulo Victor Maluf Alves 07/27/2010 02:43PM
Re: Estimating Index Size on Innodb Tables Rick James 07/27/2010 07:27PM


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.