博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
SQL Server调整以实现更快的查询
阅读量:2507 次
发布时间:2019-05-11

本文共 4469 字,大约阅读时间需要 14 分钟。

Your is capable of lightening-fast performance and stunningly efficient service even while handling huge work loads. But without regular SQL sever performance tuning, you can’t expect it to “win the race” any more than a race car could without regular tune ups.

您的即使在处理大量工作负载时也能够提供快速的性能和出众的高效服务。 但是,如果没有常规SQL服务器性能调整,就不能期望它能比没有常规调整的赛车更能“赢得比赛”。

You will have an opportunity to read in-depth information about SQL Server performance if you page. But for a basic overview of the most important principles for your SQL tune-ups, keep reading right here.

如果页面,您将有机会阅读有关SQL Server性能的深入信息。 但是,要获得有关SQL调整最重要原则的基本概述,请继续阅读此处。

race car maintenance

关于SQL Server调整 (About SQL Server Tuning)

It would be nice to think that you could handle SQL performance tuning in a single, end-all strike, but what it’s really going to take is a targeted, involved, and “never-ending” campaign. Slow SQL performance may be caused by only one or two slow but frequently used queries that are eating up all your active memory. It’s a “search and destroy mission.” Realize that your query processor has to compile, perfect, and generate an execute plan before it can even start an actual performance. Also realize that there may be numerous ways to do any given query, but only one of them is the most efficient. And what works in one scenario won’t work somewhere else. And what worked best last year may be only second-best (at best) this year.

认为您可以一次完成所有最终操作来处理SQL性能调整,将是一件很不错的事,但是真正要采取的是针对性,参与性和“永无止境”的活动。 缓慢SQL性能可能仅由一两个缓慢但经常使用的查询占用了所有活动内存引起。 这是“搜索和摧毁任务”。 意识到您的查询处理器必须编译,完善并生成执行计划,然后才能开始实际性能。 还应意识到,有多种方法可以执行任何给定的查询,但是只有其中一种是最有效的。 在一种情况下有效的方法在其他地方则行不通。 去年最有效的方法可能只是今年(最好)的第二好方法。

时段和指标 (Buckets and Metrics)

As you regularly test and retest, record the result and search for of the fastest, least expensive, lowest memory consumption solution, you need to learn to “think in buckets.” “Buckets” is tech-talk for units of similar data-types. It’s the way you organize things when you are looking for a problem. You ask, “Is the issue in resources, in query structure, in indexing, or somewhere else?” It’s the equivalent to a mechanic asking, “Is the problem with the engine, transmission, electrical system, or the body?”

在定期测试和重新测试,记录结果并寻找最快,最便宜,最低内存消耗的解决方案时,您需要学习“三思而后行”。 “桶”是针对类似数据类型的单元的技术讲座。 这是您寻找问题时组织事情的方式。 您会问:“问题是资源,查询结构,索引还是其他地方?” 这相当于机械师问:“发动机,变速箱,电气系统或车身出现问题了吗?”

Next, keep in mind you will be using numerous data metrics as you fine tune your query searches for optimal performance. Your boss will likely be happy with even a slight uptick, just like a track runner shaving seconds off his mile.

接下来,请记住,在微调查询搜索以获取最佳性能时,将使用大量数据指标。 您的老板可能会对一点点的增加感到满意,就像田径赛跑者减少英里数一样。

The key is to not only understand and have access to great metrics, but to know how to correlate them correctly. You have to be able to deduce where the problem is by comparing various metrics. You look at wait states, CPU, throughput, memory pressure, bandwidth, usage, and more, and “triangulate” to find the issue. Use the Database Performance Analyzer dashboard to make this process much easier!

关键是不仅要了解并获得出色的指标,而且要知道如何正确地将它们关联起来。 您必须能够通过比较各种指标来推断问题出在哪里。 您查看等待状态,CPU,吞吐量,内存压力,带宽,使用情况等,然后“三角剖分”以发现问题。 使用数据库性能分析器仪表板可以使此过程更加轻松!

跟踪结果 (Track Results Over Time)

Again, this is a long-term undertaking, a never-ending war. To win, you need to keep collecting data at regular intervals (we’re talking about days, weeks, months); and then, compare this against last year’s or the last few year’s stats. That gives you perspective on how well you are doing and if you are improving/declining.

同样,这是一项长期的工作,一场永无止境的战争。 为了获胜,您需要定期收集数据(我们所说的是几天,几周,几个月); 然后,将其与去年或最近几年的统计数据进行比较。 这使您可以了解自己的表现如何以及是否在改善/下降。

Of course, you’ll also want to get information on the industry average and pay attention to any goals your superiors may have set for you (or you may have set for yourself).

当然,您还希望获得行业平均水平的信息,并注意上级可能为您设定的目标(或者您可能为自己设定的目标)。

进行定期维护 (Do Regular Maintenance)

Maintenance of your database is also key. As you pay attention to maintenance tasks, you both prevent SQL issues and gather the data that can help you solve certain SQL problems should they arise.

维护数据库也是关键。 当您注意维护任务时,既可以防止SQL问题,又可以收集数据来帮助您解决某些SQL问题(如果出现)。

Specifically, hour-by-hour transaction log backups plus daily and weekly backups; daily index maintenance (not necessarily rebuilding indexes every day though), statistic updating, and corruption checks should all be a part of your maintenance routine.

具体来说,按小时进行的事务日志备份以及每日和每周的备份; 日常索引维护(虽然不一定每天都重建索引),统计信息更新和损坏检查都应作为维护例程的一部分。

翻译自:

转载地址:http://vmggb.baihongyu.com/

你可能感兴趣的文章
sessionStorage
查看>>
代码示例_进程
查看>>
Java中关键词之this,super的使用
查看>>
人工智能暑期课程实践项目——智能家居控制(一)
查看>>
前端数据可视化插件(二)图谱
查看>>
kafka web端管理工具 kafka-manager【转发】
查看>>
获取控制台窗口句柄GetConsoleWindow
查看>>
Linux下Qt+CUDA调试并运行
查看>>
51nod 1197 字符串的数量 V2(矩阵快速幂+数论?)
查看>>
OKMX6Q在ltib生成的rootfs基础上制作带QT库的根文件系统
查看>>
zabbix
查看>>
多线程基础
查看>>
完美解决 error C2220: warning treated as error - no ‘object’ file generated
查看>>
使用SQL*PLUS,构建完美excel或html输出
查看>>
前后台验证字符串长度
查看>>
《算法导论 - 思考题》7-1 Hoare划分的正确性
查看>>
win64 Python下安装PIL出错解决2.7版本 (3.6版本可以使用)
查看>>
获取各种类型的节点
查看>>
表达式求值-201308081712.txt
查看>>
centos中安装tomcat6
查看>>