简体   繁体   English

如何使用CSharp SQLite加快SQL查询?

[英]How can I speed up SQL queries using CSharp SQLite?

Background: 背景:
I have a SQLite3 database and I am using CSharp SQLite to query data. 我有一个SQLite3数据库,正在使用CSharp SQLite查询数据。 My problem is that any queries with JOIN or ORDER BY calls are really slow (0.1 sec using CSharp-SQLite vs 0.003 sec using orig. SQLite ). 我的问题是有任何疑问JOIN或ORDER BY调用是很慢(0.1秒使用CSharp-SQLite使用原稿VS 0.003秒。 SQLite )。

The latest benchmarks for CSharp SQLite indicate that it is at most 2x slower, which would be fine, but I'm getting times that are 30x slower. CSharp SQLite的最新基准表明它最多慢2倍,这很好,但是我得到的时间慢30倍。

Now, I have indexed all the necessary fields in my database and have the appropriate Primary and Foreign keys. 现在,我已经索引了数据库中所有必需的字段,并具有适当的主键和外键。 Plus, the original SQLite runs these queries fine. 另外,原始SQLite可以很好地运行这些查询。

Question: 题:
I have to use a managed code port of SQLite, so is there something I'm missing here or a call I need to make to CSharp SQLite ? 我必须使用SQLite的托管代码端口,所以这里缺少我想要的东西,或者需要对CSharp SQLite进行调用吗? Is there an alternative SQLite library port out there somewhere? 是否有其他地方的替代SQLite库端口?

This precise question was asked in the Csharp-sqlite forums and the successful solution was to remove the SQLITE_ENABLE_OVERSIZE_CELL_CHECK flag at compile time. Csharp-sqlite论坛中提出了这个确切的问题,成功的解决方案是在编译时删除SQLITE_ENABLE_OVERSIZE_CELL_CHECK标志。 This is a DEBUG flag that results in unneeded but intensive calculations. 这是一个DEBUG标志,会导致不必要但密集的计算。

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

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