sqlite从api解释
我的应用程序执行了一个复杂的 SQL 查询。该查询在 3.6.11 版本(64ms)上运行良好。在 3.6.22 中运行时,需要超过 100 秒才能完成。从命令行客户端执行时,11 和 22 中的执行速度都很快。因此,我想从应用程序内部使用“EXPLAIN”运行查询。是否可以?我尝试准备并步进查询,然后将列作为文本读取,但结果为空。
可以使用 C++ API 从我的应用程序执行“EXPLAIN”吗?
I have a complicated SQL query executed from my application. The query runs fine with the version 3.6.11 (64ms). When run in 3.6.22 it takes more than 100 sec to finish. When executed from the command line client, the execution is quick both in 11 and 22. Therefore I want to run the query with "EXPLAIN" from inside my application. Is it possible? I tried to prepare and step the query and then read the column as as text but the result is empty.
Can be "EXPLAIN" executed from my application using C++ API ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据SQLite opcode page:
根据编译时选项,您可以将SQLite 虚拟机处于一种模式,通过将消息写入标准输出来跟踪其执行情况。非标准 SQL“PRAGMA”注释可用于打开和关闭跟踪。要打开跟踪,请输入:
您可以通过输入类似的语句但将值“on”更改为“off”来关闭跟踪。
此外,
的输出EXPLAIN ...
查询只是一组(有序的)记录,如果您愿意的话,您可以对其进行解码。请参阅:此 SQLite 页面According to the SQLite opcode page :
Depending on compile-time options, you can put the SQLite virtual machine in a mode where it will trace its execution by writing messages to standard output. The non-standard SQL "PRAGMA" comments can be used to turn tracing on and off. To turn tracing on, enter:
You can turn tracing back off by entering a similar statement but changing the value "on" to "off".
Also, the output from an
EXPLAIN ...
query is just a (an ordered) set of records that you can decode if you're up to it. See: this SQLite page