Search code examples
mysqlinnodb

Could MySQL innoDB pages get fragmented inside hard disk? Or InnoDB prevents that from happening to speed up queries?


By pages i mean:

https://dev.mysql.com/doc/internals/en/innodb-page-structure.html

Could these 16KB MySQL pages get fragmented inside memory or disk? meaning if we take a disk image or memory image, could there be a chance that these 16KB pages be fragmented? Meaning if I take an Image of the MySQL folder, will the 16KB pages be in continuous blocks or some of them could get fragmented?

or MySQL implement them in a way that they don't get fragmented? if so, how?


Solution

  • This is more of a filesystem or operating system question than MySQL or InnoDB. InnoDB is writing to a file, and it is indeed possible that the filesystem fragments the writes to a single 16 KiB InnoDB page so that it is not contiguous on the physical disk. However, with modern servers and SSD storage, this basically happens 100% of the time anyway on the underlying media.

    It is generally not a concern for me, at least.