java: SQL duplicate key exception or query for key is faster
i have to do some (hundreds of) INSERT operations in a database table. However, many of the data that are to be inserted, have already been inserted. Would it be faster to (1) wait for an SQL duplicate key exception or (2) to check the existence of the key by using a PreparedStatement query?
Is (2) faster than (1)?