I am looping through a number of values (1 to 100 for example) and executing a prepared statement inside the loop.
Is there and advantage to using a transaction - co
I faced the same question when I had to implement a CSV file (possibly quite long) data import (I know you can use the LOAD DATA INFILE syntax for that but I had to apply some processing on my fields before insertion).
So I made an experiment with transactions and a file with about 15k rows. The result is that if I insert all records inside one unique transaction, it takes only a few seconds and it's cpu bound. If I don't use any transaction at all, it takes several minutes and it's IO bounded. By committing every N rows, I got intermediate results.