Causes and solutions of slow queries

Reasons for the slow queries

1, no index or index is not used (this is the most common query slow problem is the program design defects) 
2, the I / O throughput of small and formed a bottleneck effect. 
3, did not create computed column does not result in query optimization. 
4, insufficient memory 
5, the network is slow 
6, check out the data too large (can use multiple queries or other ways to reduce the amount of data) 
7, lock or deadlock (which is the most common query slow problem is the program design flaws) sp_lock, sp_who, activities of users to view, read and write due to compete for resources. 
9, to return the unwanted rows and columns 

10, the query is not good, not optimized 

Slow query optimization

1, the data log, the index placed on a different I / O devices, to increase the read speed, before you can Tempdb should be placed on RAID0, SQL2000 is not supported. Data amount (size) increases, improving I / O more important. 
2, vertical, horizontal partition table, to reduce the size of the table (sp_spaceuse) 
. 3, the hardware upgrade 
4, according to query, indexing, index optimization, optimizing access mode, limiting the amount of data in the result set. Note that the fill factor should be appropriate (preferably using the default value 0). Index should be as small as possible, use a small number of bytes a column built a good index (see index creation), not to field a limited number of values of a single index such as the construction of gender fields 
5, to improve network speed; 

6, expand the server's memory, Windows 2000 and SQL server 2000 to support 4-8G of memory. 

7, the server increases the number of the CPU; but must understand the need of parallel processing serial processing resources such as memory. Use the parallel or serial assessment of stroke is automatically selected MsSQL. Single task into multiple tasks to run on a processor. For example, the query delay sorting, connectivity, scanning and words simultaneously GROUP BY execution, SQL SERVER to determine the optimal level of parallelism depending on the load of the system, complex consumes a lot of CPU for parallel processing of most queries. However, the update operation UPDATE, INSERT, DELETE can not be processed in parallel. 

8. If you are using a query like, then simply use the index does not work, but the full-text index, consumption of space.

Guess you like

Origin www.cnblogs.com/xiongying4/p/12517274.html