I'm no expert either in C or in SQLite but what Igor is pointing out is extremely important, because I have noticed myself the benefit of using sqlite3_prepare_v2() and sqlite3_reset() instead of just using sqlite3_exec() within iterations. And this is what SQLite documentation is talking about.
The speed optimization in my C++ program was incredible and the code structure was like this (just like Igor's recommendations): sqlite3_exec(... "BEGIN TRANSACTION" ...); sqlite3_prepare_v2(); for (int i=0; i<100; i++){ sqlite3_reset(); sqlite3_bind_int(); sqlite3_step(); } sqlite3_exec(... "COMMIT TRANSACTION" ...); Sorry if this is too basic and you already knew it, but I felt like sharing my basic knowledge :P Marian Cascaval ________________________________ From: Igor Tandetnik <itandet...@mvps.org> To: sqlite-users@sqlite.org Sent: Wed, January 26, 2011 2:51:38 PM Subject: Re: [sqlite] how to create sqlite3_value structure to be used with sqlite3_bind_value()? Bella Chan <bella.c...@synopsys.com> wrote: > I am surprised to see that C is slower than Perl when inserting lots of data >into DB sequentially as I have 100 columns in a row > so I have been making 100 bind_int calls while Perl I only need to do execute >once. You are doing something wrong. Are you re-preparing the statement for each row, by any chance? Are you grouping your inserts within a transaction? Show some code. > Trying to see if I can use bind_value() > instead but no clue ho to create the sqlite3_value structure. sqlite3_bind_value is only useful inside custom functions. In any case, your problem lies elsewhere. -- Igor Tandetnik _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users