Skip to main content
added 42 characters in body
Source Link
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 alwaysfor most ROW_FORMATs? 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?

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?

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 for most ROW_FORMATs? 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?

Source Link
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?