sqlite3中更快的批量插入? [英] Faster bulk inserts in sqlite3?

查看:892
本文介绍了sqlite3中更快的批量插入?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个大约30000行数据的文件,我想加载到sqlite3数据库。有没有比为每行数据生成insert语句更快的方法?



数据是空格分隔的,并直接映射到sqlite3表。是否有任何类型的批量插入方法,用于向数据库添加卷数据?



有没有人设计了一些非常好的方法,如果不是内置? >

我应该先问这个问题,是否有一个C ++方法来从API做呢?

解决方案

您还可以尝试调整一些参数,以获得额外的速度。具体来说,你可能想要 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;.

这篇关于sqlite3中更快的批量插入?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆