Hi,
> I did some tests earlier where I inserted 100,000 rows into a
> table (table definition below). First, I did it without using
> transactions and it took 243 seconds approximately. Then, I
> did the same test using transactions, and it took 28 seconds.
>
> I am using MySQL v4. Here is the table definition:
>
> CREATE TABLE users (
> id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
> num1 FLOAT(9,2) NOT NULL DEFAULT 0.0,
> num2 FLOAT(9,2) NOT NULL DEFAULT 0.0,
> ) TYPE=InnoDB;
>
> I guess my question is, how can this be? I was lead to believe that
> using transactions would slow things down but the opposite appears
> to be happening. Can anyone offer an explanation as to why it took
> so much longer to do the inserts when not using transactions ?
Well, "not using transactions" might be an auto-started and committed
transaction for each insert: 100.000 transactions instead of 1 (started
by you).
Either way, Heiko probably will comment as well :-)
With regards,
Martijn Tonies
Database Workbench - developer tool for InterBase, Firebird, MySQL & MS SQL
Server.
Upscene Productions
http://www.upscene.com