in recent days, I have been doing database optimization. Due to the relatively large amount of data, some of the problems encountered are a machine that can put paper towels and count the income of each machine. Now there is a table recording machine information (paper_device) and a machine-related order table (paper_order). Here, there is a new machine details table (paper_device_details) with only two fields in it. Equipment id (device_id) and the amount of income (money) field, but there are more than 80,000 old data online, write an interface, use for cycle to deal with, very slow, there is a long delay in the middle, the data does not seem to be finished, and finally reported 404, asking for advice.