惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

宝玉的分享
宝玉的分享
NISL@THU
NISL@THU
E
Exploit-DB.com RSS Feed
L
LINUX DO - 热门话题
L
Lohrmann on Cybersecurity
K
Kaspersky official blog
Project Zero
Project Zero
Cisco Talos Blog
Cisco Talos Blog
T
The Exploit Database - CXSecurity.com
P
Palo Alto Networks Blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
T
Threatpost
S
Schneier on Security
G
GRAHAM CLULEY
The Hacker News
The Hacker News
T
Threat Research - Cisco Blogs
Scott Helme
Scott Helme
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
P
Privacy & Cybersecurity Law Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
Cyberwarzone
Cyberwarzone
C
CERT Recently Published Vulnerability Notes
T
Tor Project blog
AWS News Blog
AWS News Blog
Simon Willison's Weblog
Simon Willison's Weblog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
爱范儿
爱范儿
P
Privacy International News Feed
云风的 BLOG
云风的 BLOG
P
Proofpoint News Feed
S
Securelist
G
Google Developers Blog
The Last Watchdog
The Last Watchdog
Google Online Security Blog
Google Online Security Blog
美团技术团队
F
Fortinet All Blogs
小众软件
小众软件
Recorded Future
Recorded Future
V
Visual Studio Blog
B
Blog RSS Feed
H
Help Net Security
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Google DeepMind News
Google DeepMind News
Blog — PlanetScale
Blog — PlanetScale
博客园 - 聂微东
Stack Overflow Blog
Stack Overflow Blog
Martin Fowler
Martin Fowler
Latest news
Latest news
Spread Privacy
Spread Privacy
H
Heimdal Security Blog

博客园 - Mr东方欲晓

软件测试经验与教训 SQL优化技术分析-4:其他 SQL优化技术分析-2:SQL书写的影响 SQL优化技术分析-1:操作符优化 如何做好一个Sprint Demo 每日Scrum站会实践推荐 Linux常见查看硬件信息指令 MS SQLServer 2008数据库处于SUSPECT情况下的处理 ALM损坏后的恢复步骤 WEB页面中常见的四种控件的必须的测试 敏捷测试模式之Scrum及其实践 CentOS如何查看硬盘品牌型号等具体信息 64-bit Applications WoW64 在未安装 Outlook 的情况下创建 MAPI 配置文件 Any CPU vs x86 vs x64 Solution Platforms 电脑的32位与64位是指的什么 How do exes/dlls generated with the /platform:x switch interact? C# Compiler Options
SQL优化技术分析-3:SQL语句索引的利用
Mr东方欲晓 · 2016-07-15 · via 博客园 - Mr东方欲晓
  使用索引来更快地遍历表。默认情况下建立的索引是非聚集索引,但有时它并不是最佳的。在非聚集索引下,数据
在物理上随机存放在数据页上。合理的索引设计要建立在对各种查询的分析和预测上。一般来说:
   有大量重复值且经常有范围查询(between,>,<,>=,< =)和order by、group by发生的列,可考虑建立聚集索引。
   经常同时存取多列,且每列都含有重复值可考虑建立组合索引。
   组合索引要尽量使关键查询形成索引覆盖,其前导列一定是使用最频繁的列。 
   ORDER BY和GROPU BY:使用ORDER BY和GROUP BY短语,任何一种索引都有助于SELECT的性能提高。注意如果索引列中
有NULL值,Optimizer将无法优化。
    IN、OR子句常会使用工作表,使索引失效。如果不产生大量重复值,可以考虑把子句拆开,拆开的子句中应该包含索
引。
    用聚集索引比用非聚集索引的主键速度快。
    用聚集索引比用一般的主键做order by时速度快,特别是在小数据量情况下。    
	
    1、操作符优化(同上)  
 
  2、对条件字段的一些优化   
    任何对列的操作都将导致表扫描,它包括数据库函数、计算表达式等,查询时要尽可能将操作移至等号右边。
  采用函数处理的字段不能利用索引,如:   

  substr(hbs_bh,1,4)=’5400’,优化处理:hbs_bh like ‘5400%’   

  trunc(sk_rq)=trunc(sysdate), 优化处理:sk_rq>=trunc(sysdate) and sk_rq

  进行了显式或隐式的运算的字段不能进行索引,如:ss_df+20>50,优化处理:ss_df>30   
  
  sk_rq+5=sysdate,优化处理:sk_rq=sysdate-5   

  hbs_bh=5401002554,优化处理:hbs_bh=’5401002554’,注:此条件对hbs_bh 进行隐式的to_number转换,
因为hbs_bh字段是字符型。   

  条件内包括了多个本表的字段运算时不能进行索引,如:ys_df>cx_df,无法进行优化