- 15
- 0
- 约1.35万字
- 约 11页
- 2017-10-06 发布于河南
- 举报
如何提高数据库的查询效率(How to improve the query efficiency of database)
如何提高数据库的查询效率(How to improve the query efficiency of database)
Reprint - how to improve the efficiency of database queries?
1, use Profiler to track queries, get the time needed to query, find the SQL problem, and index optimizer to optimize the index
2, pay attention to the difference between UNion and UNion all. UNION all okay
3, pay attention to the use of DISTINCT, when necessary, do not use, and it will slow down the query as UNION. Duplicate records are no problem in the query
4, do not return rows and columns that are not needed when querying
5, use sp_configure,query, governor, cost, limit, or SET QUERY_GOVERNOR_COST_LIMIT to limit query consuming resources. When evaluating the resource consumed by the query exceeds the limit, the server automatically cancels the query and kills it before the query. SET LOCKTIME sets the lock time
6, use select top 100 / 10 Percent to limit the number of rows returned by the user or SET ROWCOUNT to restrict the rows of the operation
7, before SQL2000, generally do not use the following words: IS NULL, , ! = ! , !, NOT, NOT EXISTS, NOT IN, NOT LIKE, and LIKE%500, because they not all table scan is cited ropewalking. Not in the words WHere column name and function, such as Convert, substring and so on, if must use function, create a calculated column to create index instead. Can also be accommodated written: WHERE SUBSTRING (firstname, 1,1) =mfirstname likem% to WHERE (index scan), must function and listing separate. And indexes cant be built too much and too big. NOT IN will repeatedly scan the table, using EXISTS, NOT EXISTS, IN, LEFT OUTER to replace JOIN, especially the left connection, while the Exists is faster than IN, NOT is the slowest operation. If the value of the column contains a null, before its index doesnt work, now 2000 of the optimizer can handle the. The same is the IS NULL, NOT, NOT EXISTS, NOT IN can optimize her, and or not optimization, use index.
8, use Query Analyzer to see if the query plan and eval
您可能关注的文档
- 复查测验 市场营销学2012年下半年第一次作业(Re examination Marketing for the first time in the second half of 2012).doc
- 复试、拟录取与公费界定(Re examination, proposed admission and public expense definition).doc
- 复试调剂攻略(Reexamination strategy).doc
- 复试英语口语中,老师会问的问题汇总(In the oral English test, the questions that the teacher will ask are summarized).doc
- 夏天婚礼文库(Summer wedding Library).doc
- 复合维生素b、b2 、b6(Vitamin B, B2, B6).doc
- 夏季日常生活实用小窍门大全(Practical tips for daily living in summer).doc
- 夏普代码(SHARP code).doc
- 外企职业经理人在国内企业的深潜模式(Deep dive model of foreign professional managers in domestic enterprises).doc
- 外体中用的情境管理(Situational management in an external body).doc
最近下载
- 分点进水多级AO污水处理工艺设计计算探讨.pdf VIP
- 高中物理必修二圆周运动习题精选.doc VIP
- (必会)军队文职(中医学)近年考试真题题库资料汇总(含答案).pdf VIP
- 2025年安徽分类考试对口升学语文真题试卷 .pdf VIP
- (必会)军队文职(公共科目)近年考试真题题库资料汇总(含答案).pdf VIP
- 专题01-语言文字运用【真题汇编】(2021-2025)五年高考真题语文分类汇编-含答案解析.pdf VIP
- 分段进水多级 AO 工艺的特点与问题.pdf VIP
- 沉淀+多级 AO+混凝沉淀废水处理工艺.docx VIP
- 2025年新版对口高考试卷及答案安徽.doc VIP
- 不同回流比对多级AO工艺污染物去除的影响.docx VIP
原创力文档

文档评论(0)