mysql-native: SQL Transaction support?

salvari via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Sep 17 12:47:31 PDT 2015


I'm using mysql-native library for massive data load. I've been 
trying to use transactions to improve performance but it doesn't 
seem to work.

I'm parsing a text input file, the generated sql is about 1 
million lines of SQL. By using mysql-native it takes about 4 
hours to load data.

I've tried to divide the sql in transactions by calling:

auto cmdStartTran = cdb.Command("start transaction;");
cmdStartTran.execSQL();

And some inserts later:
auto cmdCommit = cdb.Command("commit;");
cmdCommit.execSQL();

Parsing the input file to plain sql and executing the one million 
lines into the db takes more or less the same 4 hours.

But, by using transactions in the text file, the performance 
improves dramatically: 60 sec to load all data.

Is it posible that my mysql-native database connection has 
autocommit activated? How can I know?






More information about the Digitalmars-d-learn mailing list