1

Why MyISAM uses 3 files per table?

I know one of the file contains table definition, another contains primary key and all other indexes, third the data.

What is unclear for me, what is the benefit to keep the data in 3 files, instead in one, or in many - every index in separate file like dbase.

Nick
  • 141
  • 7
  • 2
    It was a design decision, not really something we can answer. – Philᵀᴹ Oct 21 '15 at 07:50
  • but what are the advantages? – Nick Oct 21 '15 at 11:42
  • 1
    MyISAM is no longer the default Engine. The future: MyISAM will be deprecated and possibly removed. – Rick James Nov 03 '15 at 16:03
  • I dont think MyISAM will be removed ever. It have lots of advantages over other engines (such InnoDB) . It does not support transactions and this happens to be bad for Oracle advertisement. However my question was why MyISAM is designed the way it is, and not like dbase / Paradox for example, where table definition and table data share single file and each index have separate file... – Nick Nov 03 '15 at 20:16

1 Answers1

1

As Phil already said 'It was a design decision'. This is the main difference between InnoDB Engine. Because InnoDB Engine is store all databases in one file. And each MyISAM table is stored on disk in three files (if it is not partitioned). The files have names that begin with the table name and have an extension to indicate the file type. MySQL uses a .frm file to store the definition of the table, but this file is not a part of the MyISAM engine; instead it is a part of the server. The data file has a .MYD (MYData) extension. The index file has a .MYI (MYIndex) extension.

for your ref https://en.wikipedia.org/wiki/MyISAM

Even RolandoMySQLDBA and ypercube has well defined InnoDB Engine with respect to MyISAM engine Why does InnoDB store all databases in one file?

Md Haidar Ali Khan
  • 6,447
  • 9
  • 38
  • 60