I want to insert data frames into sqlite
table. The data frame contains thousands of rows. I am now using RSQLite
package for database operation. For inserting data frame into table i am using dbWriteTable(conn, name, value, ...)
method. But the repeated insertion to the table makes the program slower. Is there any other better option to insert data frame into a table?
Thanks.
Asked
Active
Viewed 421 times
0

Dinoop Nair
- 2,663
- 6
- 31
- 51
1 Answers
3
If you don't use explicit transactions, each SQL statement is wrapped into an automatic transaction. At the end of each transaction, the data is synchronized with the disk.
Wrap all inserts into a single transaction.

CL.
- 173,858
- 17
- 217
- 259
-
what about using commit or rollback after insertion? – Dinoop Nair Oct 11 '13 at 05:21
-
1Yes, that's what you do at the end of a transaction. – CL. Oct 11 '13 at 07:20