且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

sqlite3中更快的批量插入?

更新时间:2023-02-01 08:43:14

您还可以尝试调整一些参数,以获得额外的速度。具体来说,你可能想要 PRAGMA synchronous = OFF;


I have a file of about 30000 lines of data that I want to load into a sqlite3 database. Is there a faster way than generating insert statements for each line of data?

The data is space-delimited and maps directly to an sqlite3 table. Is there any sort of bulk insert method for adding volume data to a database?

Has anyone devised some deviously wonderful way of doing this if it's not built in?

I should preface this by asking, is there a C++ way to do it from the API?

You can also try tweaking a few parameters to get extra speed out of it. Specifically you probably want PRAGMA synchronous = OFF;.