_php tutorial on the problem of MSSQL consuming too much memory

Source: Internet
Author: User
Often see someone ask, MSSQL occupied too much memory, but also constantly grow, or have set up the use of memory, but it does not use so much, what is the matter?
First, let's take a look at how MSSQL uses memory.
The biggest overhead is typically used for data caching, and if enough memory is available, it will throw the used data and the data that you would like to use in memory, until the memory is low, and the data that is less than the hit is cleared. So generally when we look at statistics IO, we see that the physics read is 0.
The second is the cost of the query, generally, the hash join will bring a relatively large memory overhead, and the merge join and nested loop overhead is relatively small, there are sorting and intermediate tables, cursors will have a relatively large overhead.
Therefore, indexes are generally required on the columns used for correlation and sorting.
Second is the implementation of the plan, the storage of system data, these are relatively small.
 
Let's take a look at the performance impact of data caching, and if there are no other applications competing for memory in the system, the data cache is generally as good as possible, and sometimes we force some data pins in the cache. However, if there are other applications, while MSSQL frees up memory when needed, thread switching, io waiting for these tasks also takes time, so it can cause performance degradation. This way we must set the maximum memory usage for MSSQL. You can find a place to configure the maximum memory usage in the SQL Server properties (Memory tab), or you can use sp_configure to do so. If there are no other applications, then do not limit the use of MSSQL to the memory.
Then look at the cost of the query, which is obviously the lower the better, because we can not benefit from it, on the contrary, the more memory used means that the query speed is reduced. So we generally avoid the use of intermediate tables and cursors, and build indexes on columns that are often associated and sorted.
 


http://www.bkjia.com/PHPjc/631123.html www.bkjia.com true http://www.bkjia.com/PHPjc/631123.html techarticle often see someone ask, MSSQL occupied too much memory, but also constantly grow, or have set up the use of memory, but it does not use so much, what is the matter? ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.