With navicat built set after the uniqueness of the primary key table, there was a problem in importing data, Measured, entry mode selection is added, when the source data is the primary key column have duplicate values duplicates complains are not recorded, but at the same time some no repetitive data may also be missing, such as article 500 data, of which 200 are duplicates, under normal circumstances should be recorded 300 data, measured in the process of normal school of less than 300, Actually this entry mode selection can add or update seems to solve, but a great deal of drag down the speed of the input, especially when data accumulated more, the causes of the problem and solution, please?
CodePudding user response:
This kind of situation, when import should not be directly imported into the target table, Add a transition table TMP, import the data to the TMP table, then TMP the data in the table according to the condition can be inserted into the target table: Similar:
INSERT INTO targetTable (c1, c2) SELECT c1 and c2 FROM TMP AS a WHERE NOT the EXISTS ( SELECT * FROM targetTable AS b WHERE a.c 1=1 AND biggest a.c=biggest 2 );