For MySQL speciffically, but I’m guessing the structures are similar across most brands of SQL. Are combination indexes much bigger than single indexes? For example, would the amount of space needed to hold INDEX(col1, col2) be the same as the amount of space to hold INDEX(col1) + INXEX(col2)? I’m not exactly running into this in development right now, just curious.
For MySQL speciffically, but I’m guessing the structures are similar across most brands of
Share
With InnoDB, The size of the combined index would be roughly the size of
col1plus the size ofcol2plus the size of the table’s primary key (or 4 bytes if using MyISAM).With InnoDB or MyISAM, the combined index should be smaller than two separate indexes, since with two separate indexes the primary key (or 4 byte row pointer) would be included twice (once in each index).