热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

是否有工具来分析sqlite查询?-Isthereatooltoprofilesqlitequeries?

IamusingaSQLitedatabaseandwouldliketospeedupmyqueries,perhapswithindexesorbyrestr

I am using a SQLite database and would like to speed up my queries, perhaps with indexes or by restructuring them altogether.

我正在使用SQLite数据库,并希望加快我的查询,可能是索引或完全重组它们。

Is there a tool to profile queries, that might help me decide where things are slowing down?

是否有一个工具来分析查询,这可能有助于我决定哪些方面正在放缓?

I know I could just enter queries into a tool like SQLite Administrator to time them, but I'm looking for something a bit more systematic than that -- perhaps something that sits in the background and looks at all the queries that I enter over a period, giving a breakdown of any bottle necks.

我知道我可以在SQLite管理员这样的工具中输入查询来计算它们,但我正在寻找比这更有系统性的东西 - 也许是在后台的东西,看着我输入的所有查询期间,给出任何瓶颈的细分。

3 个解决方案

#1


20  

You have a mix of questions in here. To view what queries are run and how long each takes, you'll need to either modify sqlite3.dll if an application is linking to that or if it's your own application you can write it into your code easier (we do this and long all queries, transactions, timings, etc.).

你在这里有各种各样的问题。要查看运行的查询以及每个查询需要多长时间,您需要修改sqlite3.dll(如果应用程序链接到该应用程序)或者如果它是您自己的应用程序,则可以更轻松地将其写入代码中(我们这样做并且很长时间查询,交易,时间等)。

For individual query analysis, you can use EXPLAIN. It won't tell you timing of individual steps within a query but it will tel you how the query was executed.

对于单个查询分析,您可以使用EXPLAIN。它不会告诉您查询中各个步骤的时间,但它会告诉您查询的执行方式。

http://www.sqlite.org/lang_explain.html

http://www.sqlite.org/lang_explain.html

An SQL statement can be preceded by the keyword "EXPLAIN" or by the phrase "EXPLAIN QUERY PLAN". Either modification causes the SQL statement to behave as a query and to return information about how the SQL statement would have operated if the EXPLAIN keyword or phrase had been omitted.

SQL语句前面可以是关键字“EXPLAIN”或短语“EXPLAIN QUERY PLAN”。这两种修改都会导致SQL语句表现为查询,并返回有关如果省略EXPLAIN关键字或短语后SQL语句将如何操作的信息。

When the EXPLAIN keyword appears by itself it causes the statement to behave as a query that returns the sequence of virtual machine instructions it would have used to execute the command had the EXPLAIN keyword not been present. When the EXPLAIN QUERY PLAN phrase appears, the statement returns high-level information about what indices would have been used.

当EXPLAIN关键字本身出现时,它会使该语句表现为一个查询,该查询返回如果没有EXPLAIN关键字,它将用于执行命令的虚拟机指令序列。当EXPLAIN QUERY PLAN短语出现时,该语句返回有关将使用哪些索引的高级信息。

The output from EXPLAIN and EXPLAIN QUERY PLAN is intended for interactive analysis and troubleshooting only. The details of the output format are subject to change from one release of SQLite to the next. Applications should not use EXPLAIN or EXPLAIN QUERY PLAN since their exact behavior is undocumented, unspecified, and variable.

EXPLAIN和EXPLAIN QUERY PLAN的输出仅用于交互式分析和故障排除。输出格式的详细信息可能会从SQLite的一个版本更改为下一个版本。应用程序不应使用EXPLAIN或EXPLAIN QUERY PLAN,因为它们的确切行为是未记录的,未指定的和可变的。

#2


32  

This will only answer one part of the question (the most unhelpful part, unfortunately).

这只会回答问题的一部分(不幸的是,这是最无益的部分)。

I googled this up because I was looking for something to time queries and the sqlite3 client has a timer meta command.

我搜索了这个因为我正在寻找时间查询的东西,而sqlite3客户端有一个计时器元命令。

sqlite> .timer on

sqlite> .timer

from there on in, all query results will have cpu timer statistics appended. Hope this helps at least a little bit.

从那里开始,所有查询结果都会附加cpu计时器统计信息。希望这有助于至少一点点。

#3


2  

Now SQLite has experimental sqlite3_trace and sqlite3_profile (see https://www.sqlite.org/c3ref/profile.html for details). They can come in handy for having statistics/investigating culprit during long tests.

现在SQLite有实验性的sqlite3_trace和sqlite3_profile(详见https://www.sqlite.org/c3ref/profile.html)。在长时间的测试中,他们可以派遣统计/调查罪魁祸首。


推荐阅读
  • 有没有人用过sqlite?关于tablehasnocolumnnamedcolumn插入数据的时候报上边的错。问题是我明明有这一列。直接在sqlitedevoloper里执 ... [详细]
  • SQLite3是一个广泛使用的数据库,从linux,windows到安卓都有SQLite的应用。本文介绍SQLite3在windows上的编译。SQLite3提供了多种源代码的下载 ... [详细]
  • 本文介绍了一个在线急等问题解决方法,即如何统计数据库中某个字段下的所有数据,并将结果显示在文本框里。作者提到了自己是一个菜鸟,希望能够得到帮助。作者使用的是ACCESS数据库,并且给出了一个例子,希望得到的结果是560。作者还提到自己已经尝试了使用"select sum(字段2) from 表名"的语句,得到的结果是650,但不知道如何得到560。希望能够得到解决方案。 ... [详细]
  • Easyui + asp.net mvc + sqlite 开发教程(录屏)适合入门
    第一节:前言(技术简介)EasyUI是一套js的前端框架利用它可以快速的开发出好看的前端系统web它是在jquery的框架基础上面现在越来越多的企业用它来开发web系统 ... [详细]
  • 转自:http:www.cnblogs.comzeroonep4316346.html如果一个.NET应用要自适应32位64位系统,只需要在项目的“目标平台”设置为“AnyCPU”。但是 ... [详细]
  • 本文介绍了设计师伊振华受邀参与沈阳市智慧城市运行管理中心项目的整体设计,并以数字赋能和创新驱动高质量发展的理念,建设了集成、智慧、高效的一体化城市综合管理平台,促进了城市的数字化转型。该中心被称为当代城市的智能心脏,为沈阳市的智慧城市建设做出了重要贡献。 ... [详细]
  • 本文介绍了OpenStack的逻辑概念以及其构成简介,包括了软件开源项目、基础设施资源管理平台、三大核心组件等内容。同时还介绍了Horizon(UI模块)等相关信息。 ... [详细]
  • REVERT权限切换的操作步骤和注意事项
    本文介绍了在SQL Server中进行REVERT权限切换的操作步骤和注意事项。首先登录到SQL Server,其中包括一个具有很小权限的普通用户和一个系统管理员角色中的成员。然后通过添加Windows登录到SQL Server,并将其添加到AdventureWorks数据库中的用户列表中。最后通过REVERT命令切换权限。在操作过程中需要注意的是,确保登录名和数据库名的正确性,并遵循安全措施,以防止权限泄露和数据损坏。 ... [详细]
  • 本文分析了Wince程序内存和存储内存的分布及作用。Wince内存包括系统内存、对象存储和程序内存,其中系统内存占用了一部分SDRAM,而剩下的30M为程序内存和存储内存。对象存储是嵌入式wince操作系统中的一个新概念,常用于消费电子设备中。此外,文章还介绍了主电源和后备电池在操作系统中的作用。 ... [详细]
  • OCI连接MySQL_PLSQL Developer连接远程数据库OCI客户端安装方法
    本文介绍了使用OCI客户端连接MySQL和PLSQL Developer连接远程数据库的安装方法,避免了在本地安装Oracle数据库或类似的开发套件的麻烦,同时解决了PLSQL Dev连接远程Oracle时的配置问题。 ... [详细]
  • 州的先生(https:zmister.com)在很多项目中都有使用到SQLite数据库作为数据存储的工具,其中包括一些桌面图形界面程序和线上的Web应用程序。至今为止,它们都运行良 ... [详细]
  • Python使用SQLite1.sqlite3的安装python2.5.x以上版本默认自带sqlite3模块。2.链接sqlite3数据库```#导入sqlite3模块import ... [详细]
  • iOS关于移动端SQLite,你想知道的都有
    一、SQLite简介SQLite,是一款轻型的数据库,是遵守ACID的关系型数据库管理系统,它包含在一个相对小的C库中。它是D.RichardHipp建立的公有领域项目。它的设计目 ... [详细]
  • ImtryingtosetupavotingsysteminusingDjangothatlimitsaregisteredusertovotingonlyon ... [详细]
  • 最近用到SQLite数据库,刚开始想用ADO来搞,毕竟经常用,结果发现还挺麻烦,要装SQLite的ODBC驱动,装了以后还是连不上,听说这SQLite是开源项目,可以将开发库引入项目来 ... [详细]
author-avatar
晨雨心秋-济微路唐姜合
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有