I have a table like the following:
CREATE TABLE `demo_upsert` (
`ID` BIGINT(20) NOT NULL AUTO_INCREMENT,
`Url` TEXT NOT NULL COLLATE 'utf8mb4_unicode_ci',
`LastListID` BIGINT(20) NULL DEFAULT NULL,
`Statistics` BIGINT(20) NOT NULL DEFAULT '0',
PRIMARY KEY (`ID`) USING BTREE,
UNIQUE INDEX `Url` (`Url`) USING HASH
)
COLLATE='utf8mb4_unicode_ci'
ENGINE=InnoDB
;
When I try a bulk upsert operation:
INSERT INTO demo_upsert (Url, LastListID) VALUES (?, 9)
ON DUPLICATE KEY UPDATE LastListID=9
Out of ~15K rows for insert, I'm getting ~200 rows actually affected. The latter number depends on the previous number of rows in demo_upsert
table.
The MariaDB versions tried are 10.4.12
and 10.4.13
- same problem.
UPDATE: I've implemented a reproducer program and submitted a bug https://jira.mariadb.org/browse/CONC-472
LastListID
value was NOT9
.INSERT .. ODKU
, like: Query OK, 5 rows affected (0.10 sec) Records: 4 Duplicates: 2 Warnings: 0. What number you tell about?mysql_affected_rows()
from Connector/C.