当前位置:网站首页>Database tuning solution
Database tuning solution
2022-07-05 21:58:00 【Short section senior】
Factors affecting system performance
There are many factors that affect system performance , In order to better analyze these factors that affect the system performance , These factors can be divided into 6 Categories: :
Server hardware class
Operating system class
Network class
SQL Server System class
Database application class
Customer application class
Strategies for performance monitoring and tuning
Monitoring and adjusting system performance is a comprehensive problem , There is no fixed pattern . however , It is necessary to understand and master the framework steps of monitoring and adjusting the system .
The framework steps of monitoring and adjusting the system are as follows :
Develop strategies for monitoring and adjusting the system
Choose a scheme to adjust performance
Develop specific methods for performance monitoring and tuning
Establish the performance baseline of the system
Detect performance bottlenecks
Understand common monitoring tasks
SQL Server Profiler
SQL Server Profiler Tools can be used to track various activities of servers and databases . These activities can be captured in the table 、 File or a script file , For later analysis .
Use SQL Server Profiler The process of the tool includes creating a trace 、 Run and reproduce tracking, etc .
Common monitoring and adjustment tasks
Common monitoring and adjustment tasks include monitoring memory usage 、 Monitor thread and processor usage 、 Monitor the input of the hard disk / Output 、 Monitor lock information and query statements with poor performance . Commonly used counters for monitoring system performance .
Methodology of performance tuning
How to design a good relational database architecture
Judgment of data hot area
Define the index according to the data hot area 、 Table split definition
Optimize SELECT Inquire about
Try to store data in the same table
Use index and index coverage policy
Optimize UPDATE Business
Try to put the data that needs to be updated in a smaller table
Optimize DELETE Business
Evaluate the effect of partitions in large-scale deletion
Optimize INSERT Business
Reduce dependence on automatic numbering
Use valid query parameters
SARGs( Valid format of query parameters )
Limit to full compliance 、 A range of values 、 Or with AND Connect more than two items to define the search .
Format
Data field Partial operators < Constant or variable >
< Constant or variable > Partial operators Data field
accord with SARGs Example of
FirstName=‘ king ’
6000060000
Easy mistakes
Operate on data fields
Select * from Employees where LastName+’,’+FirstName=‘Davolio,Nancy
Make a negative query
Not、Exists、Not IN、Not Like、!= <> !> !< etc.
stay where Use functions for data fields in statements
Select * from [order details] where ABS(quantity-100)<1
Use OR Operator
Use OR Do operators , You need all fields to have available indexes
Query optimization
Use T-SQL Precautions for
Select grammar
Try not to return all fields in the data table without configuring filter conditions
If composite index is used , Then the first field in the index order is suitable for filtering
Distinct,Order by Wait for the syntax to be used when the query results are needed
Union All than Union good
If the connection transaction level is not reduced to Read Uncommited, Or through the lock prompt NOLOCK To reduce the chance of congestion , Best configuration SET LOCK_TIMEOUT Options , Avoid users' endless waiting
Insert、Delete and Update
When a large number of batch data operations , nothing Log The behavior must be better than writing data twice ( First record Log Write the database again ) fast .
stay Update and Delete use Where When clause , Remember to meet the conditions SARGs Format
Query tuning options
Use OPTION Clause call table prompt or view prompt
OPTION (TABLE OPTION(dbo.Orders, IDNEX(IX_OrderID)))
FORCESEEK Tips
FROM Orders WITH (FORCESEEK)
OPTION (TABLE HINT(dbo.Orders, IDNEX(0), FORCESEEK))
sys.fn_validate_plan_guide Function is used to verify the effectiveness of the mandatory plan
Program guide support XML ShowPlan Parameters
A new event class is designed for monitoring mandatory plans (Plan Guide Successful and Plan Guide Unsuccessful) And performance counters (SQL Server SQL Statistics Under the object Guided Plan Executions/sec The counter and Misguided Plan Executions/sec Counter )
Welcome to join me for wechat exchange and discussion ( Please note csdn Add )
边栏推荐
- Cross end solutions to improve development efficiency
- 让开发效率提升的跨端方案
- K210 learning notes (IV) k210 runs multiple models at the same time
- 从零开始实现lmax-Disruptor队列(四)多线程生产者MultiProducerSequencer原理解析
- Reptile practice
- Poj3414 extensive search
- 多家呼吸机巨头产品近期被一级召回 呼吸机市场仍在增量竞争
- Summary of El and JSTL precautions
- Oracle HugePages没有被使用导致服务器很卡的解决方法
- Summarize the reasons for 2XX, 3xx, 4xx, 5xx status codes
猜你喜欢
[Yugong series] go teaching course 003-ide installation and basic use in July 2022
"Grain mall" -- Summary and induction
Countdown to 92 days, the strategy for the provincial preparation of the Blue Bridge Cup is coming~
华为游戏多媒体服务调用屏蔽指定玩家语音方法,返回错误码3010
场景化面试:关于分布式锁的十问十答
Experienced inductance manufacturers tell you what makes the inductance noisy. Inductance noise is a common inductance fault. If the used inductance makes noise, you don't have to worry. You just need
[Yugong series] go teaching course in July 2022 004 go code Notes
The real situation of programmers
微服务入门(RestTemplate、Eureka、Nacos、Feign、Gateway)
Defect detection - Halcon surface scratch detection
随机推荐
每日刷题记录 (十四)
NET中小型企业项目开发框架系列(一个)
QML reported an error expected token ";", expected a qualified name ID
Installation of VMware Workstation
Codeforces 12D Ball 树形阵列模拟3排序元素
Basic grammar of interview (Part 1)
Poj 3237 Tree (Tree Chain Split)
Image editor for their AutoLayout environment
Advantages of robot framework
EL与JSTL注意事项汇总
Alibaba cloud award winning experience: build a highly available system with polardb-x
大约SQL现场“这包括”与“包括在”字符串的写法
Implementing Lmax disruptor queue from scratch (IV) principle analysis of multithreaded producer multiproducersequencer
poj 3237 Tree(树链拆分)
Defect detection - Halcon surface scratch detection
从零开始实现lmax-Disruptor队列(四)多线程生产者MultiProducerSequencer原理解析
SQL common syntax records
The American Championship is about to start. Are you ready?
"Grain mall" -- Summary and induction
[Yugong series] go teaching course in July 2022 004 go code Notes