Databases Reference
In-Depth Information
What about the index on
col2
? Is there anything special about it? As it turns out, no—
it's just an index like any other.
Figure 5-6
illustrates the
col2
index.
Figure 5-6. MyISAM col2 index layout for the layout_test table
In fact, in MyISAM, there is no structural difference between a primary key and any
other index. A primary key is simply a unique, nonnullable index named
PRIMARY
.
InnoDB stores the same data very differently because of its clustered
organization. InnoDB stores the table as shown in
Figure 5-7
.
InnoDB's data layout.
Figure 5-7. InnoDB primary key layout for the layout_test table
At first glance, that might not look very different from
Figure 5-5
. But look again, and
notice that this illustration shows the
whole table
, not just the index. Because the
clustered index “is” the table in InnoDB, there's no separate row storage as there is for
MyISAM.