mysql - Getting number of rows inserted for ON DUPLICATE KEY UPDATE multiple insert? -
i have large table primary key of binary(20)
.
the table has around 17 million rows. every hour cron job tries insert many 50,000 new entries table on_duplicate_key_update
syntax.
each insert in cronjob 1,000 values (multiple insert). how can number of rows inserted table query? cannot row count before , after there around 17million rows , query expensive.
in manual mysql says row inserted affected number of rows 1
, updated field 2
, meaning in 1000 insert on duplicate key update query have affected rows ranging 1000 - 2000, have no way of telling how many records inserted number?
how can overcome this?
thanks
the number of inserts 2000 minus number of affected rows. more generally:
(numberofvaluesininsert * 2) - mysql_affected_rows()
Comments
Post a Comment