如何让你的SQL运行得更快
select count(*) from record where date >'' and date < ''and amount >2000 (25秒)
select date ,sum(amount) from record group by date(55秒)
select count(*) from record where date >'' and place in ('BJ','SH') (27秒)
select count(*) from record where date >'' and date < '' and amount >2000 (14秒)
select date,sum(amount) from record group by date(28秒)
select count(*) from record where date >'' and place in ('BJ','SH')(14秒)
select count(*) from record where date >'' and date < '' and amount >2000 (26秒)
select date,sum(amount) from record group by date(27秒)
select count(*) from record where date >'' and place in ('BJ, 'SH')(< 1秒)
select count(*) from record where date >'' and date < '' and amount >2000(< 1秒)
select date,sum(amount) from record group by date(11秒)
select count(*) from record where date >'' and place in ('BJ','SH')(< 1秒)
select sum(a.amount) from account a,card b where a.card_no = b.card_no(20秒) select sum(a.amount) from account a,card b where a.card_no = b.card_no and a.account_no=b.account_no(< 1秒)
select * from record wheresubstring(card_no,1,4)=''(13秒) select * from record whereamount/30< 1000(11秒) select * from record whereconvert(char(10),date,112)=''(10秒)
select * from record where card_no like'5378%'(< 1秒) select * from record where amount< 1000*30(< 1秒) select * from record where date= '1999/12/01'(< 1秒)
create proc count_stuff asdeclare @a intdeclare @b intdeclare @c intdeclare @d char(10)beginselect @a=count(*) from stuff where id_no=''select @b=count(*) from stuff where id_no=''endselect @c=@a+@bselect @d=convert(char(10),@c)print @d
如何让你的SQL运行得更快的更多相关文章
- 使用QFileInfo类获取文件信息(在NTFS文件系统上,出于性能考虑,文件的所有权和权限检查在默认情况下是被禁用的,通过qt_ntfs_permission_lookup开启和操作。absolutePath()必须查询文件系统。而path()函数,可以直接作用于文件名本身,所以,path() 函数的运行会更快)
版权声明:本文为博主原创文章,未经博主允许不得转载. https://blog.csdn.net/Amnes1a/article/details/65444966QFileInfo类为我们提供了系统无 ...
- 如何让Hadoop运行得更快一些
在数据处理方面,我们发现数据输入速度一般要比的数据处理速度快很多,这种现象在大多数据领域尤为明显.随着数据不断膨胀,相应的响应时间自然要有所增加,数据处理的复杂度也在不断提高.作为一个开发者,我们自然 ...
- 如何让python程序运行得更快
原则1:不优化 原则2:不要优化那些不重要的部分(否则会降低可读性) 解决方案: 1. 使用函数,局部变量比全局变量快很多.尽量使用函数,如main() 2. 有选择性的消除属性访问. 如多用 fro ...
- SQL运行优化收藏
如何让你的SQL运行得更快(转贴) ---- 人们在使用SQL时往往会陷入一个误区,即太关注于所得的结果是否正确,而忽略了不同的实现方法之间可能存在的性能差异,这种性能差异在大型的或是复杂的数据库环境 ...
- 让Python代码更快运行的 5 种方法
不论什么语言,我们都需要注意性能优化问题,提高执行效率.选择了脚本语言就要忍受其速度,这句话在某种程度上说明了Python作为脚本语言的不足之处,那就是执行效率和性能不够亮.尽管Python从未如C和 ...
- Five things that make Go fast-渣渣翻译-让GO语言更快的5个原因
原文地址:https://dave.cheney.net/2014/06/07/five-things-that-make-go-fast 翻译放在每个小段下面 Anthony Starks has ...
- SQL运行内幕:从执行原理看调优的本质
相信大家看过无数的MySQL调优经验贴了,会告诉你各种调优手段,如: 避免 select *: join字段走索引: 慎用in和not in,用exists取代in: 避免在where子句中对字段进行 ...
- spark sql运行原理
Spark sql 对SQL语句的处理,先将SQL语句进行解析(parse)形成一个tree,然后使用Rule对Tree进行绑定,优化等处理过程,通过模式匹配对不同类型的节点采用不同操作.查询优化器是 ...
- Spring AOP监控SQL运行
对数据库连接池Proxool比較熟悉的读者,都知道Proxool能够记录SQL运行内容和时间等信息日志. 我们能够将该日志记录专门的SQL日志文件.对于查找运行特别耗时的SQL起了不小的作用. 对于一 ...
随机推荐
- C#获取QQ旋风的下载记录
/* * 用户:从前的我 * 日期:2015/8/26 */ using System; using System.IO; namespace GetXf { class Program { publ ...
- 一个数n的最大质因子
#include<cstdio> #include<cmath> using namespace std; #define Max(x, y) (x > y ? x : ...
- 解决MySQL中文乱码的问题
遇到中文乱码问题,首先用status命令检查数据库的配置,如下: 上图会显示数据库配置的各项信息. 还可以用 show create database XXX,来显示创建数据库的时候的编码设置. 一般 ...
- [Head First Python]3. 文件与异常:处理错误
datafile.txt Man: Is this the right room for an argument? Other Man: I've told you once. Man: No you ...
- 快速下单!简化EcStore的购物结算流程
EcStore拥有完善的购物车功能,方便顾客浏览挑选商品,但是在提交订单时必须要求用户先登录注册 如果是未注册用户还多出一个注册用户的步骤这些多出来的步骤和操作会影响购物下单的流畅性,降低了用户购物下 ...
- log4net使用(包括单个文件和按日期生成多个文件)
1.log4net生成单个文件 直接将这段代码考到config中即可用 <log4net> <!--定义输出到文件中--> <appender name="Lo ...
- 巧用Graphviz和pvtrace等工具可视化C函数调用
http://guiquanz.github.io/2012/10/15/linux_c_call_trace/
- C 语言---漂亮的宏定义
写好C 语言,漂亮的宏定义很重要,使用宏定义可以防止出错,提高可移植性,可读性,方便性等等.下面列举一些成熟软件中常用得宏定义. 1.防止一个头文件被重复包含 #ifndef COMDEF_H #de ...
- html 知识
<pre name="code" class="python"><pre name="code" class=" ...
- PV与并发之间换算的算法 换算公式