Problem of late insertion in mysql database
While I am inserting approx 50000 or more ro开发者_开发百科ws in a database, It seems insertion still running in backend even though database pointer is seems free in process.
every time I refresh the database, total rows shows increasing every time.
So should I use transaction to insert them in a single stroke?
The purpose of transactions is to be able to rollback the complete process if one of the insertions fail. It makes no sense to use transactions as a way to speed up things since it obviously adds additional overhead, thus making it all slower.
No, don't insert so many rows in a single transaction. You would end up running out of log space.
精彩评论