Executing BEGIN TRANSACTION before and END TRANSACTION after the full insert will greatly improve Your performance.
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Vincent Vega Sent: Sunday, March 09, 2008 12:44 PM To: sqlite-users@sqlite.org Subject: [sqlite] Bulk insert Hi all , I need to insert 500 records (each record has 12 bytes) to a table and it takes me approximately 2 seconds. Is there a way to improve my code so it can do it faster? Thanks in advance, Marco. Here is my code: query = sqlite3_mprintf("Insert into Inventory (Tag) values (?)"); rc=sqlite3_prepare_v2(DB,query ,-1,&Statement,NULL); if (rc!=SQLITE_OK) error_print(); for (i=1;500;i ++) { rc=sqlite3_bind_text(Statement,1,list[i],-1,NULL); if (rc!=SQLITE_OK) error_print(); rc=sqlite3_step(Statement); if (rc!=SQLITE_DONE) error_print(); sqlite3_reset(&Statement) ; } --------------------------------- Never miss a thing. Make Yahoo your homepage. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users ************************************************************************************* This e-mail is confidential, the property of NDS Ltd and intended for the addressee only. Any dissemination, copying or distribution of this message or any attachments by anyone other than the intended recipient is strictly prohibited. If you have received this message in error, please immediately notify the [EMAIL PROTECTED] and destroy the original message. Messages sent to and from NDS may be monitored. NDS cannot guarantee any message delivery method is secure or error-free. Information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. We do not accept responsibility for any errors or omissions in this message and/or attachment that arise as a result of transmission. You should carry out your own virus checks before opening any attachment. Any views or opinions presented are solely those of the author and do not necessarily represent those of NDS. NDS Limited Registered office: One Heathrow Boulevard, 286 Bath Road, West Drayton, Middlesex, UB7 0DQ, United Kingdom. A company registered in England and Wales Registered no. 3080780 VAT no. GB 603 8808 40-00 To protect the environment please do not print this e-mail unless necessary. ************************************************************************************** _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users