Search code examples
mysqlinnodb

What does the physical structure of InnoDB secondary index pages looks like


According to this https://dev.mysql.com/doc/internals/en/innodb-fil-header.html and did some searching on google. I can see that a record is stored in the user records area on the page with it's FIL_PAGE_TYPE = FIL_PAGE_INDEX(17855 also 0x45BF).

But I am now confused about the secondary index. Did it stored on the same page type with the FIL_PAGE_TYPE = FIL_PAGE_INDEX?

I created a table with some index, added some data. Found that my ibd file contains a FIL_PAGE_INODE page. So I am guessing that the secondary index was stored on the page with FIL_PAGE_TYPE = FIL_PAGE_INODE .

If so, How can I found the index content on that page?


Solution

  • Secondary indexes do indeed use FIL_PAGE_INDEX just as the primary/clustered key does. There is no structural difference between the primary key and any secondary indexes. The FIL_PAGE_INODE page type is part of the space management system, and is described in my blog post on Page management in InnoDB space files.