in reply to Cycle through primary key with DBI

And yet another idea would be to just keep on going with the primary key number, checking the total records on each write and deleting any > 1000.

This would probably avoid more of the race conditions, allow for the same or faster execution time (I believe DELETing a "specified" row and WRITing the "next" would be at least as fast as an UPDATE or REPLACE), and give you cleaner code as you would always know the "last inserted" id, should you need it at some point.

My $0.02...

D a d d i o