当前位置:网站首页>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 )
边栏推荐
- Daily question brushing record (XIV)
- EL与JSTL注意事项汇总
- Summary of El and JSTL precautions
- "Chris Richardson microservices series" uses API gateway to build microservices
- MATLAB | App Designer·我用MATLAB制作了一款LATEX公式实时编辑器
- 极狐公司官方澄清声明
- 【愚公系列】2022年7月 Go教学课程 004-Go代码注释
- Making global exception handling classes with aspect
- SQL common syntax records
- poj 3237 Tree(树链拆分)
猜你喜欢
2.2.5 basic sentences of R language drawing
How can Huawei online match improve the success rate of player matching
Drawing HSV color wheel with MATLAB
Uni app Bluetooth communication
QML reported an error expected token ";", expected a qualified name ID
2.2 basic grammar of R language
Daily question brushing record (XIV)
总结出现2xx、3xx、4xx、5xx状态码的原因
装饰器学习01
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
随机推荐
Sitge joined the opengauss open source community to jointly promote the ecological development of the database industry
Learning notes of statistical learning methods -- Chapter 1 Introduction to statistical learning methods
Emotional analysis of wechat chat records on Valentine's day based on Text Mining
MySQL disconnection reports an error MySQL ldb_ exceptions. OperationalError 4031, The client was disconnected by the server
HYSBZ 2243 染色 (树链拆分)
"Chris Richardson microservices series" uses API gateway to build microservices
极狐公司官方澄清声明
Kingbasees v8r3 cluster maintenance case -- online addition of standby database management node
Xlrd common operations
Ethereum ETH的奖励机制
Codeforces 12D ball tree array simulation 3 sorting elements
How to add new fields to mongodb with code (all)
Efficiency difference between row first and column first traversal of mat data types in opencv
Image editor for their AutoLayout environment
Summary of data analysis steps
装饰器学习01
让开发效率提升的跨端方案
ICMP introduction
Incentive mechanism of Ethereum eth
微服务入门(RestTemplate、Eureka、Nacos、Feign、Gateway)