库升级后,虚拟表上的sqlite查询速度降低
我最近将SQLite3库从3.8.7.1版本升级到版本3.32.3,并注意到数据集中的基本选择查询的速度大约为大约。升级后,有50,000行慢了70%。客户端软件通过创建虚拟表(通过 sqlite3_exec())来工作,然后文本编辑器接口允许用户执行SQL查询。我使用 sqlite3_prepare_v2()来测试以下线的升级:
Select * from SomeTable Where SomeFloatField > 0.99
此SQL字符串将其变成a sqlite3_stmt 然后通过不断应用 sqlite3_step()来执行查询,直到返回 sqlite_done 。
我可以包含代码片段,但这真的不会比我上面解释的要多得多。据我所知,这是API的相当标准的实现。 但是,我正在尝试弄清为什么升级的库在其他相同的情况下要慢得多。我预计由于多年来的优化,升级会更快。因此,我只能假设由于升级而忽略了我需要做出的其他一些更改。 我已经通过将计时器放入代码来确定sqlite3_step()函数为瓶颈,但是我不知道为什么它会更慢,并且会喜欢在哪里看的建议。 值得的是Visual Studio 2019中的C ++项目。
I recently upgraded my sqlite3 library from version 3.8.7.1 to version 3.32.3, and noticed that the speed of a basic select query on a dataset of approx. 50,000 rows was about 70% slower following the upgrade. The client software works by creating a virtual table (via sqlite3_exec()) and then a text editor interface allows a user to execute a sql query. I was testing the upgrade with a query along the lines of:
Select * from SomeTable Where SomeFloatField > 0.99
This sql string is turned into a sqlite3_stmt using sqlite3_prepare_v2()
and then the query is executed by continually applying sqlite3_step() until it returns SQLITE_DONE.
I could include code snippets but that really wont tell you much more than I’ve explained above. It’s a fairly standard implementation of the API as far as I can tell.
But I’m trying to work out why the upgraded library is so much slower for an otherwise identical scenario. I was expecting the upgrade to be a little faster as a result of small optimizations over the years. So I can only assume I’ve overlooked some other changes I needed to make as a result of the upgrade.
I’ve identified the sqlite3_step() function as the bottleneck by putting timers into the code, but I don’t know why it would be slower and would appreciate suggestions on where to look.
For what it’s worth this is a c++ project in visual studio 2019.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论