简体   繁体   English

python sqlite3执行方法慢

[英]python sqlite3 execute method slow

I'm using Python 2.7.5 in Spyder along with Sqlite3 3.6.21. 我在Spyder中使用python 2.7.5以及Sqlite3 3.6.21。 I have noticed the execute method to be pretty slow, pretty much regardless of the size of the database I'm creating. 我注意到execute方法非常慢,几乎与我创建的数据库大小无关。 After doing some research, no solution really works for me: 经过研究后,没有任何解决方案真正适合我:

  • Python 3 is not supported by Spyder yet Spyder尚不支持Python 3
  • updating the Sqlite3 version does not work (replacing the dll file causes problems) 更新Sqlite3版本不起作用(替换dll文件会导致问题)

Is there a way around this? 有没有解决的办法? If any more details are needed, I'm glad to elaborate further. 如果需要更多详细信息,我很高兴进一步阐述。

Indeed, inspired by Colonel Thirty Two's comment above, I just realized that I need to wrap all my operations into one transaction. 确实,受到三十二上校的上述评论的启发,我才意识到我需要将我的所有业务包装到一个事务中。 This was trivial to implement and improved overall efficiency drastically. 这对于实现和大幅提高整体效率来说是微不足道的。 Thanks once again! 再次感谢!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM