Skip to main content
1 of 2
Rick James
  • 79.4k
  • 5
  • 51
  • 117

Plan A: Use INSERT IGNORE in your batched inserts. That way the dup keys do not cause trouble.

Plan B: Insert into a table with INDEX, not UNIQUE. Then you can investigate the duplicates before deciding what to do with them.

You understand that CHAR(15) utf8 occupies 45 bytes always? Perhaps VARCHAR(15) would be better? (Please don't quote the debunked wives' tale about FIXED being better in MyISAM.)

Or maybe the data is, say, old IPv4 strings? They work fine with CHARACTER SET ascii -- 15 bytes for CHAR(15) or 1-16 bytes for VARCHAR(15). Then, what about IPv6? And about inability to compare ranges?

Rick James
  • 79.4k
  • 5
  • 51
  • 117