MySQL Insert/Update across 3 tables with 1m+ rows
LEFt JOIN increases the Number of Records, you will have only have 2 two people with the same name and the same pets name and age, but hopefully you get not much of them.
But still you want only a INNER JOIN, vecause you only want records, that are actual in the MasterTable and have a pet.
so you should switch to inner joins
INSERT INTO Records(PersonID, PetID, ID)
SELECT People.PersonID, Pets.PetID, MasterTable.ID
FROM MasterTable
INNER JOIN People ON MasterTable.FirstName = People.FirstName AND People.LastName = MasterTable.LastName
INNER JOIN Pets ON Pets.PetName = MasterTable.PetName AND Pets.PetAge = MasterTable.PetAge
WHERE MasterTable.ID BETWEEN  0 AND 50000

But you limit the number of rows inserted, by only choosing a number records, try as i shown in theexampe with 50000 at first, and see if that is fast enough
And the take the next.
In case you want all people, regardless if the have a pet.
INSERT INTO Records(PersonID, PetID, ID)
SELECT p.PersonID, pe.PetID, m.ID
FROM People p
LEFT JOIN MasterTable m ON m.FirstName = p.FirstName AND p.LastName = m.LastName
INNER JOIN Pets pe ON pe.PetName = m.PetName AND pe.PetAge = m.PetAge
WHERE p.PersonID BETWEEN  0 AND 50000

Here you see that all pöople are choosen to be in the records, even when they have no pets, that is what LEFT JOIN mean.
But here you must limit the number of Entries to be inserted with person.PersonID
With a million records, you need a lot of buffer and tmp space to pluu that of, but you can serialize  by dividing the number of MasterTable.
FYI: If something like this occurs, look into the error logs of MySQL. It will show you what you have to do and what MySQL has encountered for a problem