I have the following situation with the tables below. I need to do some checks on "serial" (if the serial exists, if it is valid, etc, and other validations next to other tables) from several serial (up to thousands at a time) and, if not valid, register in "seriais_erros "the serial ID (if it is registered) or the serial itself, if it is not registered and is not valid.
What is the best way to solve this, since I need to treat each serial separately? As it comes to thousands of Serials each time, I worry a lot about performance.
CREATE TABLE IF NOT EXISTS 'seriais' (
'id' int(11) NOT NULL AUTO_INCREMENT,
'serial' int(11) NOT NULL,
PRIMARY KEY ('id')
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS 'serial_erros' (
'id' int(11) NOT NULL AUTO_INCREMENT,
'serial_id' int(11) NOT NULL,
'serial' int(11) NOT NULL,
'erro' text NOT NULL,
PRIMARY KEY ('id'),
KEY 'serial_id' ('serial_id')
) ENGINE=InnoDB DEFAULT CHARSET=utf8;