Say I have a 1-to-N relationship `(person_id, pet_id)`. I have a table where `pet_id` is the primary key.

I understand that an InnoDB secondary index is essentially a B-tree where the values are the corresponding primary key values for the row.

Now, suppose one person can have thousands of pets and I often want a person's pets in order of `pet_id`. Then it would matter if records in the secondary index are sorted by `(person_id, pet_id)` or just `person_id` with the `pet_id`'s for that `person_id` being unsorted. Guessing the later.

So, if `person_id` is non-unique, are records physically sorted by `(person_id, pet_id)` or JUST `pet_id`?

Thanks