java - Batch insert in MariaDB with on duplicate key update -
i have following table cl:
id - int(10) primary key contact - int(10) list - int(10)
with unique index on contact , list. when run concurrently following query in batch 100 records:
insert cl(list, contact) values (?, ?) on duplicate key update cl.id = cl.id
under high pressure fails in 20% following error:
java.sql.sqlsyntaxerrorexception: have error in sql syntax; check manual corresponds mariadb server version right syntax use near 'on duplicate key update cl.id = cl.id' @ line 1
80% of queries runs fine. when rerun failed queries same parameters, again 20% fail.
why of queries fail , produce no errors when executed second time?
changing query to
insert ignore cl(list, contact) values (?, ?)
solved issue. though unclear why mysql throwing java.sql.sqlsyntaxerrorexception instead of more unambiguous.
Comments
Post a Comment