sqlite插入需要很长时间 [英] sqlite insert taking long time

查看:99
本文介绍了sqlite插入需要很长时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将不足200,000行插入到sqlite数据库表中.我只是通过sqlite3在终端中使用非常简单的.sql文件.我敢打赌它已经运行了至少30分钟.这是正常现象还是我应该关闭进程并尝试其他操作?

I'm inserting just short of 200,000 rows into an sqlite database table. I'm just using a very plain .sql file via sqlite3 in terminal. I'd bet it's been running for at least 30 minutes. Is this normal or should I shut the process down and try something differently?

推荐答案

在sqlite中插入速度主要取决于:

Insert speed in sqlite mainly depends on:

  • 每笔交易的插入量(无交易的插入是一个原子插入,每个插入都在它自己的交易中,这意味着它非常慢)
  • 数据库模式-WAL或普通日记
  • 插入字段的索引数
  • 磁盘速度

如果速度是一个问题,那么您应该就我所写的每个因素并向Google咨询并采取适当的行动.

If speed is a problem, then you should consult google for each of those factors I wrote and act appropriately.

这篇关于sqlite插入需要很长时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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