查看执行时间 1 show profiles; 2 show variables;查看profiling 是否是on状态: 3 如果是off,则 set profiling = 1: 4 执行自己的sql语句: 5 show profiles:就可以查到sql语句的执行时间: 查看操作了多少行 在sql语句前面加上 explain就可以了: explain select * from event; +—-+————-+——-+——+—————+——+———+——+——+——-+ | id | s
在manage.py的同级目录下新建一个run.py import os if __name__ == '__main__': #加载Django项目的配置信息 os.environ.setdefault("DJANGO_SETTINGS_MODULE","myblog.settings") #导入Django,并启动Django项目 import django django.setup() #导入相应的models from person import model
有时候我们经常为我们的sql语句执行效率低下发愁,反复优化后,可还是得不到提高 那么你就用这条语句找出你sql到底是在哪里慢了 示例: SET STATISTICS io ON SET STATISTICS time ON go ---你要测试的sql语句 select top 100 * from TBL_Cot_RecStaticList go SET STATISTICS profile OFF
SET STATISTICS io ON SET STATISTICS time ON go ---你要测试的sql语句 select top 100 * from TBL_Cot_RecStaticList go SET STATISTICS profile OFF SET STATISTICS io OFF SET STATISTICS time OFF 显示信
为了让您的程序执行的效率更高,SQL的效率一定不可忽视. 现有以下方法去检测SQL的执行效率. 对于多表查询的效率测试: )直接from ,where方式. SET STATISTICS io ON SET STATISTICS time ON go ---你要测试的sql语句 select g.grpName,t.grpID,t.flowID,t.typeName,t.description from hyGroup g ,hyType t where t.grpID = g.flowID g
先要自行了解sql的几个概念: 1. or '1'='1' 2. order by 3. union : 联合查询需要表字段相同 sql注入攻击漏洞判断步骤: 1.‘ 2.查看数据库信息 3.绕过过滤 /**/ 如:url编码绕过 or 1=1即 %6f%72%20%31%3d%31 (%3d为=,%31为1,%6f%72为or) 参考:http://www.w3school.com.cn/tags/html_ref_urlencode.html 那么 1%20or%