Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Please note that .MYI is your index, and .MYD is your data. The only way to reduce the size of your .MYD is to delete rows or alter your column sizes.</p> <p>50MB for an index on 2 million rows is not large.</p> <p>Let's look at the size breakdown of your table:</p> <ul> <li><strong>company_id</strong> - 4 Bytes</li> <li><strong>emp_number</strong> - 101 Bytes</li> <li><strong>card_date</strong> - 11 Bytes</li> <li><strong>total_ot</strong> - 17 Bytes</li> <li><strong>total_per</strong> - 17 Bytes</li> <li><strong>leave_taken</strong> - 9 Bytes</li> <li><strong>total_lop</strong> - 9 Bytes</li> <li><strong>time_entry</strong> - avg(length(time_entry)) + 3 Bytes </li> </ul> <p>This gives us a row length of 172 + time_entry bytes. If time_entry averages out at 100 bytes. You're looking at 272 * 2000000 = 544MB</p> <p>Of significance to me is the number of VARCHARs. Does employee number need to be a varchar(100), or even a varchar at all? You're duplicating that data in it's entirety in your index on (company_id,emp_number,card_date) as you're indexing the whole column. </p> <p>You probably don't need a varchar here, and you possibly don't need it included in the primary key.</p> <p>Do you really need time_entry to be a TEXT field? This is likely the biggest consumer of space in your database. </p> <p>Why are you using varchar(10) for card date? If you used DATETIME you'd only use 8 Bytes instead of 11, TIMESTAMP would be 4 Bytes, and DATE would be 3 Bytes.</p> <p>You're also adding 1 Byte for every column that can be NULL.</p> <p>Also try running ANALYZE/REPAIR/OPTIMIZE TABLE commands as well.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload