php backend needs to insert records into the mysql database table. The id of this table is primary key but not self-growing, which needs to be calculated by some rules. For example, if you first check that there are N records created that day, then set the id to xxxN+1. this time. If there is a large number of visits, multiple requests may get the same number of records first, so it is possible to generate the same id, and insert it into the database, then an error will be reported. How should we deal with this situation?