Because the company's project encountered database operation performance problems after going online and running, it needs not to be changedCodeIn this case, the database performance is optimized, so I found the relevant information and wrote down my experience.
1. most database performance bottlenecks are concentrated on query statements. for SQL Server, you must first use the Event Viewer to find out which SQL statements and stored procedures have performance problems. the basic operation procedure is to create a trail, enter the login account and password, and select the method to save the query results. There are two optional methods: file mode and database table mode, the latter is recommended. select SQL completed and RPC completed in the event. the filtering condition filters out the objects to be tracked.
2. Observe for a period of time, find out the statements with the largest Io and time occupation from the trace results, and analyze their execution frequency.
3. use the query analyzer to break down the execution plan of SQL statements and determine whether indexes and indexes are fully utilized during execution. normally, if the index is fully utilized, the name of the execution step will be index seek. note: When analyzing Io, You need to execute the set statistics Io on statement to open the IO analysis.
4. Based on the analysis results, add the corresponding indexes and reduce the I/O later.
5. for stored procedures, the event viewer should be used to further filter their information. If spid is used (which can be obtained through select @ spid), then the maximum cost of a statement in the stored procedure is observed, then optimize the SQL statement. The step is the same as step 3.
References:
1.
SQL Server Performance Tuning entry (graphic version)
Http://blog.joycode.com/juqiang/archive/2007/01/19/91848.aspx)