0

I am trying to understand how MyISAM physically store its records. In MyISAM Storage engine Variable-sized record there is some unused data after each record. how many bytes is reserved as unused data? is there any specific algorithm which MyISAM is using?

Edit: I have to ask another question here. when new record is inserted any free space is reseverd at the end of that record before the next record starts for future use?

  • See this link for a great answer http://stackoverflow.com/questions/16711983/understanding-myisam-record-structure – Namphibian Jul 15 '13 at 05:39
  • yes I read that answer but it doesn't talk about how the engine manages unused data part of each record. – ali akhbarizadeh Jul 15 '13 at 05:43
  • "Unused data" arises as a result of deleting records, or updating variable-length strings with shorter values. – eggyal Jul 15 '13 at 07:11
  • @eggyal: you mean when myisam inserts a new record, it doesn't reserve any space at the end of that record for unused data? – ali akhbarizadeh Jul 15 '13 at 07:21
  • I wouldn't swear to it, but that's certainly my interpretation of [Dynamic Table Characteristics](http://dev.mysql.com/doc/en/dynamic-format.html) and [MyISAM Record Structure](http://dev.mysql.com/doc/internals/en/myisam-record-structure.html). To be more certain would require delving into the source. – eggyal Jul 15 '13 at 07:35

1 Answers1

0

What eggyal said is true: "Unused data arises as a result of deleting records, or updating variable-length strings with shorter values".

It also means, unless you "vacuum" your database, that each new record is going to take that free space, even if the record is longer then the available space. There is different blocktype for each record depending on how the record is saved.

If the record is longer than the free space, it's going to take all that space, and "look" for other unused data until the record is completely written.

If there is no unused data, the record is written at the end.

AForget
  • 11
  • 2