Data batch check insertion

data batch check and insert, because each record needs to be compared with the data already existing in the database, compare the insertion of OK, compare the generated error messages of non-OK, and export an excel file after all execution.

in the past, la was used to check one by one, but the efficiency is very slow, because every time you insert a piece of data, you have to execute a sql statement to verify it.

then pull out the associated data at one time and verify it in php, filter the data that can be inserted to generate an array, and insert it with insert at one time.

efficiency is fast, but will there be any problems?

Nov.20,2021
The optimization method of

is very common, which reduces the number of interactions between the application and mysql and the number of sql statements. You should know that each interaction and the parsing of each sql statement will cause a certain loss to the performance of mysql to a certain extent. Therefore, this method improves the performance of the mysql system and places the pressure on the specific operation of the application. It is good to improve the system capacity when the amount of data is small and the operation is simple, but it is also necessary to prevent excessive memory consumption when the amount of data is very large and the operation is complex. no, no, no.
you can test the details by yourself. What I said may not be absolutely correct. Testing is necessary, as long as it suits your business and architecture

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b32e5a-2be41.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b32e5a-2be41.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?