Multiple row inserts overhead
-
I have a scenario where I have lots of rows (thousands) to insert (from a plugin) which I am doing as a single query, something like this
INSERT INTO inPxUtBI_follow_data (screen_name, name, description, active, time) values (%s, %s, %s, %s, %s),(%s, %s, %s, %s, %s),(%s, %s, %s, %s, %s),(%s, %s, %s, %s, %s)
$wpdb->query($wpdb->prepare($sql, $x[‘sqldata’]))
However, if a different user inserts a record with a unique key then this command above will fail. (I presume the whole rows will fail).
A way around it is to do one row at a time, but would that be much slower?
Or is there a way of doing the multiple insert which only fails for the unique rows?
Regards,
Rupert
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Multiple row inserts overhead’ is closed to new replies.