<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>Margarita Naumova's life in SQL</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/magi/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/magi/feed.xml</link>
    <description>Let&amp;#039;s SQL Together!</description>
    <lastBuildDate>Wed, 17 Apr 2019 04:02:06 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>Error when applying Service Pack</title>
      <link>https://docs.microsoft.com/archive/blogs/magi/error-when-applying-service-pack</link>
      <pubDate>Wed, 16 Jan 2013 08:06:52 GMT</pubDate>
      <dc:creator><![CDATA[MNaumova]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/magi/2013/01/16/error-when-applying-service-pack/</guid>
      <description><![CDATA[You should be carefull when apllying changes to the producion system. This is especially true for...]]></description>
      <content:encoded><![CDATA[<p>You should be carefull when apllying changes to the producion system. This is especially true for applying Service Packs. The main steps before patching SQL Server are:</p>
<ol>
<li>Backup all the user and system databases (with checking integrity of the backup)</li>
<li>Check the health status of the user databases (DBCC CHECKDB)</li>
<li>Check if this specific SP has some issues, bugs, Connect items</li>
</ol>
<p>If you dont followi the steps it is not necesary to have a problem. But statistically it happens at some time.</p>
<p>Like in this case, when I am shaing my experience in applying SP2 of SQL Server 2008 R2: <a href="http://maginaumova.com/master-database-error-after-applying-sql-server-2008-r2-sp2/">http://maginaumova.com/master-database-error-after-applying-sql-server-2008-r2-sp2/</a></p>
<p>Good luck and thanks for reading! :-)</p>
<p>&nbsp;</p>]]></content:encoded>
    </item>
    <item>
      <title>Back in SQL Life</title>
      <link>https://docs.microsoft.com/archive/blogs/magi/back-in-sql-life</link>
      <pubDate>Sun, 01 Apr 2012 06:59:20 GMT</pubDate>
      <dc:creator><![CDATA[MNaumova]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/magi/2012/04/01/back-in-sql-life/</guid>
      <description><![CDATA[Hi again and sorry for such a long pause from blogging. During the past year I was focused on things...]]></description>
      <content:encoded><![CDATA[<p>Hi again and sorry for such a long pause from blogging. During the past year I was focused on things with highest priorities only, including SQL User Group Meetings and some important trainings for my customers. It was a year of stress and fears about our little baby. Thanks God everything went well and I gave a birth to my sweet little daughter in January this year. She is just brilliant <img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/75/36/metablogapi/6102.wlEmoticon-smile_2.png" original-url="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-75-36-metablogapi/6102.wlEmoticon_2D00_smile_5F00_2.png" /> I feel a way better&#160; now, even not sleeping much, but very happy. I am returning back to publishing and working, not full time of course since my little one wants me constantly to be near by. </p>  <p>MS Days 2012 was kind of a point of return to the SQL Life. I had two presentations and full room of attendees to which I am really thankful. The first presentation was “Top 10 things you shouldn’t do as a database developer”. I was thinking about such a presentation for a long time. On every SQL Server PTO project I phased some kind of coding problem that shouldn’t be a part of a good database project. Well, I realize that those practices are very hard to group in a list of 10, even 100, but its not a number that matters. The important is to show in a no-doubtable way why the respective thing is a bad practice and of course to propose a better solution. </p>  <p>My second presentation was “Optimizing SQL Server 2012 for Private Cloud”. The topic is modern and SQL Server 2012 is part of it also. The important there is not the Cloud part, but Consolidation and Virtualization part – the Cloud preparation phases. Dynamic Memory Support in virtualization, Resource Governor for Multi-Tenancy and Contained databases. </p>  <p>It was yet another great event and I am glad I was part of it!</p>  <p>I will blog some of my presentation’s focal points . “See” you soon <img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/75/36/metablogapi/6102.wlEmoticon-smile_2.png" original-url="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-75-36-metablogapi/6102.wlEmoticon_2D00_smile_5F00_2.png" /></p>]]></content:encoded>
    </item>
    <item>
      <title>Inside Hash and Sort Warnings</title>
      <link>https://docs.microsoft.com/archive/blogs/magi/inside-hash-and-sort-warnings</link>
      <pubDate>Tue, 01 Mar 2011 01:45:38 GMT</pubDate>
      <dc:creator><![CDATA[MNaumova]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/magi/2011/03/01/inside-hash-and-sort-warnings/</guid>
      <description><![CDATA[Recently I dove into Query Performance and troubleshooting topic. I delivered a couple of 400+...]]></description>
      <content:encoded><![CDATA[<p>Recently I dove into Query Performance and troubleshooting topic. I delivered a couple of 400+ Performance and Tuning Workshops as part of my SQL Master Academy Training Initiative. All of those very intensive and incredibly useful workshops focused my attention on several topics. I made an experiment presenting a session&#160; named Detecting Problems in Query Plans in our SQL User Group Meeting. The people in the audience were very happy to clarify some topics, and the feedback I received was very positive.</p>  <p>I will try to blog them in next few publications, but let me start with a first one, that I consider as underestimated and not very clear, at the same time very common.</p>  <p>In order to explain what exactly the Hash and Sort warning are and why they should be treated as a signal of a <font style="background-color: #ffff00"></font>performance problem <font style="background-color: #ffff00"></font>let me first pay more attention on Expensive Operators in query plans</p>  <p><strong>Expensive Operators</strong></p>  <p>Some operators in query plans have specific resource needs. They need more memory than the others in order to perform their tasks. Such operators are called memory consuming operators and they could make a query more expensive from the resource point of view. Such operators are SORT, SORT DISTINCT, HASH JOIN, HASH AGGREGATE. </p>  <p>At compilation time, based on estimated number of rows that the operator will have as an input, the QP calculates the number of pages in memory that this operator needs in order to execute. When a query has a memory consuming operator the QP calculates the memory needed to execute the query as a Memory Grant. The Memory Grant is a value that contains the sum of all pages needed by all expensive operators in order to execute the query plan. Occasionally, the query can become very expensive, especially when those operators process large numbers of rows. For example the Sort operator is very expensive because it’s “costs” is proportional to number of rows that have to be sorted, respectively the number of pages that those rows fit. </p>  <p>select so.SalesOrderID, so.ModifiedDate   <br />&#160;&#160;&#160;&#160;&#160; from&#160; Sales.SalesOrderDetail so    <br />&#160;&#160;&#160;&#160;&#160; where so.ModifiedDate between '2001-07-01 00:00:00.000' and '2002-02-01 00:00:00.000'     <br />&#160;&#160;&#160;&#160;&#160; order by so.SalesOrderDetailID    <br />&#160;&#160;&#160;&#160;&#160; option (maxdop 1)    <br />&#160;&#160;&#160;&#160;&#160; </p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/75/36/metablogapi/5340.image_2.png" original-url="http://blogs.technet.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-75-36-metablogapi/5340.image_5F00_2.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/75/36/metablogapi/3681.image_thumb.png" original-url="http://blogs.technet.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-75-36-metablogapi/3681.image_5F00_thumb.png" width="318" height="55" /></a></p>  <p>&#160;</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/75/36/metablogapi/6712.image_4.png" original-url="http://blogs.technet.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-75-36-metablogapi/6712.image_5F00_4.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/75/36/metablogapi/1033.image_thumb_1.png" original-url="http://blogs.technet.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-75-36-metablogapi/1033.image_5F00_thumb_5F00_1.png" width="212" height="273" /></a></p>  <p>We have a SORT operator which requires 1344 pages of memory in order to perform the sorting of data. The overall Query Memory required is 1344*8K=10.5MB</p>  <p>If I remove the need for SORT operator (you can comment ORDER BY clause to test that), then my query plan would be</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/75/36/metablogapi/1537.image_8.png" original-url="http://blogs.technet.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-75-36-metablogapi/1537.image_5F00_8.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/75/36/metablogapi/6712.image_thumb_3.png" original-url="http://blogs.technet.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-75-36-metablogapi/6712.image_5F00_thumb_5F00_3.png" width="244" height="56" /></a>&#160;</p>  <p>&#160;</p>  <p>&#160;</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/75/36/metablogapi/7801.image_10.png" original-url="http://blogs.technet.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-75-36-metablogapi/7801.image_5F00_10.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/75/36/metablogapi/0451.image_thumb_4.png" original-url="http://blogs.technet.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-75-36-metablogapi/0451.image_5F00_thumb_5F00_4.png" width="215" height="244" /></a></p>  <p>Note that I don’t have Memory Grant as part of the query plan description of the root operator.</p>  <p>In both cases the execution plan is 16 Bytes in cache. </p>  <p>&#160;</p>  <p><strong>The key points</strong></p>  <ul>   <li>Using Sort and hash operators in the query plan requires additional query memory or workspace memory, outside of the memory needed to store execution plan</li>    <li>The Memory Grant is a an allocated query memory. </li>    <li>The QP calculates Query Memory at the compilation time, but the real usage of this Memory is during the query execution.</li> </ul>  <p>&#160;</p>  <p><strong>How a query with expensive operators is executed</strong></p>  <p>Query memory is allocated outside of the buffer pool. The amount of space available for query memory allocation is dynamically managed between 25% and 75% of non-AWE buffer pool (only data pages can use AWE mechanism for page allocation). 5% of the Query Memory is reserved for small queries (queries with low costs). No query can take more than 20% of the Total Query Memory. There are 5 query Memory Grant queues as a mechanism to manage expensive queries and to allow less expensive queries to run. The queues are organized based on query cost. Every query containing hash/sort operators has to pass trough the global grant queue, where it is put in its respective queue based on its costs. Queues are served on first come first serve basis. There is a little probability more than a couple of expensive queries from a large cost queue to execute at the same time, they probably&#160; will execute one after another. </p>  <p>After such a query is compiled and the plan is cached, there comes the step of query execution or the moment of truth. At this time the query needs the memory to be allocated. There are couple of scenarios that could happen here. If there is no available memory&#160; or there are other expensive queries with similar cost (on the same queue) executing at the same time, then the query waits in the Memory Grant Queue.</p>  <p>If the query reaches the wait time threshold (the Query Wait Option on SQL Server Level), then the query times out. You can start query again later, but obviously this is a signal that you have more queries with expensive operators than your server can perform. So the possible focus for further troubleshooting is to try to optimize queries and reduce their expensive operators trough proper indexing, reconsiderations of using ORDER BY clause,&#160; , increase server memory could be also an option (that is too broad topic to discuss here)</p>  <p>If the query gains the memory the query execution starts. So far so good. But the real moment of truth comes here, because this is the moment of test if the QP calculations and the Memory Grant is enough. What are the possible scenarios then?</p>  <p>&#160;</p>  <p><strong>The Memory Grant is not enough for the query to execute smoothly</strong>. </p>  <p>This is when the Hash and Sort Warnings appear. Why would this memory grant be not enough? Because there is a misunderstanding and respectively a miscalculation of the memory needs at compilation time and at query execution time. Note that I don’t mention that the problem is in memory shortage/misconfiguration or that you have to add more memory to your server. Well, that could be the case, but the experience of Hash and Sort warnings alone doesn’t necessary mean than there is a performance problem and resource shortage. Why there could be miscalculations and when?</p>  <p>Imagine that you have a query plan cached&#160; with a specific parameter value that QP get at the compilation time, and actually based on that value it creates the plan. You execute the query (trough stored procedure, sp_executesql with parameters for example) and you provide different parameters value leading to differences in selectivity and the result set (a lot more rows for the sort operator input for example). </p>  <p>Using the cached plan and respectively the same Memory Grant is not enough for the memory consuming operators to perform their tasks.</p>  <p>To illustrate exactly what happens, let’s focus on some examples. Lets create a very simple procedure called <em>SalesOrderSelect</em>. I am going to rely on procedure plan caching that is provided in SQL Server, that is why I am using a stored procedure here rather than ad-hoc select statement. </p>  <p>create proc SalesOrderSelect    <br />@ModifiedDateFrom datetime,     <br />@ModifiedDateTo datetime as</p>  <p>begin</p>  <p>&#160;&#160;&#160;&#160;&#160; declare @SalesOrderID int,    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; @ProductID int,     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; @ModifiedDate datetime</p>  <p>&#160;&#160;&#160;&#160;&#160; select so.SalesOrderID, so.ModifiedDate   <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; from&#160; Sales.SalesOrderDetail so    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; where so.ModifiedDate between @ModifiedDateFrom and @ModifiedDateTo    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; order by so.SalesOrderDetailID    <br />&#160;&#160;&#160;&#160;&#160; option (maxdop 1)</p>  <p>&#160;&#160;&#160;&#160;&#160; end</p>  <p>go</p>  <p>No lets execute the procedure for the first time with the parameters defining the interval of 6588 rows, which is about <font style="background-color: #ffff00" color="#000000"></font><font color="#000000">5%</font><font style="background-color: #ffff00" color="#000000"></font> of the rows in the table. The first execution generates the procedure execution plan for this specific parameter values, and this plan is cached in memory. </p>  <p>exec SalesOrderSelect '2001-07-01 00:00:00.000', '2002-02-01 00:00:00.000' </p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/75/36/metablogapi/1033.image_12.png" original-url="http://blogs.technet.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-75-36-metablogapi/1033.image_5F00_12.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/75/36/metablogapi/7875.image_thumb_5.png" original-url="http://blogs.technet.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-75-36-metablogapi/7875.image_5F00_thumb_5F00_5.png" width="309" height="230" /></a></p>  <p>&#160;</p>  <p>Now lets execute the stored procedure again, but defining a larger result set. Let’s also profiler the query, including the Hash and Sort Warning events from the Errors and Warning Event group </p>  <p>exec SalesOrderSelect '2001-07-01 00:00:00.000', '2003-02-01 00:00:00.000'    <br /></p>  <p>The query returns 27405 rows, about 4 times more that in the first execution. And because it is using the same execution plan that is cached in memory, the resources for the query are the same, including the Memory Grant parameter. This time, the SORT operator must perform the sorting on 4 times more rows than in the first execution, using the same amount of Memory (10.5MB). Because of that the Engine raises the Sort Warnings Event. </p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/75/36/metablogapi/3162.image_14.png" original-url="http://blogs.technet.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-75-36-metablogapi/3162.image_5F00_14.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/75/36/metablogapi/4645.image_thumb_6.png" original-url="http://blogs.technet.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-75-36-metablogapi/4645.image_5F00_thumb_5F00_6.png" width="375" height="78" /></a></p>  <p>&#160;</p>  <p>The sort operation doesn’t fit in memory and continue sorting using the tempdb database and performing multiple passes over the data that are required to be sorted. This is the reason of performance degradation. The same applies to hash operators when the memory grant is not enough – the hash warning indicates that the hash recursion has occured , which is the build input doesn’t fit in the memory granted, resulting in&#160; the split of input into multiple partitions that are processed separately. If any of these partitions still do not fit into available memory, it is split into subpartitions, which are also processed separately. This splitting process continues until each partition fits into available memory or until the maximum recursion level is reached (displayed in the IntegerData data column). Hash bailout occurs when a hashing operation reaches its maximum recursion level and shifts to an alternate plan to process the remaining partitioned data. You can imagine that a query could be very slow once reaching that case. </p>  <p>&#160;</p>  <p><strong>The Memory Grant is more than it is needed</strong></p>  <p>What if we have an opposite case, where we execute the query with a cached plan using more restrictive clause, such ending up with more memory allocated then it is actually needed.</p>  <p>In order to do that I am recompiling the stored procedure and executing it after that</p>  <p>exec sp_recompile SalesOrderSelect</p>  <p>go</p> exec SalesOrderSelect '2001-07-01 00:00:00.000', '2003-02-01 00:00:00.000'   <br />  <p>go</p>  <p>&#160;</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/75/36/metablogapi/0447.image_16.png" original-url="http://blogs.technet.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-75-36-metablogapi/0447.image_5F00_16.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/75/36/metablogapi/5734.image_thumb_7.png" original-url="http://blogs.technet.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-75-36-metablogapi/5734.image_5F00_thumb_5F00_7.png" width="307" height="221" /></a></p>  <p>Note that the Memory Grant is calculated as 3904 pages or approx 31MB. If I execute the query using the smaller interval, I am going to need 10.5MB of memory. The query will not raise sort warning, but I am going to waste approx 20MB of the memory grant, my query will going to use 3 times more memory that it actually needs, and probably my query will go to inappropriate queue. . </p>  <p>&#160;</p>  <p><strong>What are the cases when Hash and Sort Warnings can occur</strong></p>  <p>All the Cardinality errors cases - <a title="http://msdn.microsoft.com/en-us/library/ms181034.aspx" href="http://msdn.microsoft.com/en-us/library/ms181034.aspx">http://msdn.microsoft.com/en-us/library/ms181034.aspx</a> – look at the cases when QP cannot accurately calculate cardinalities, I am not going to copy them here. If the QP cannot accurately calculate cardinalities of query plan operators, then it makes errors in calculating the query memory, sometimes even choosing the appropriate operator. When the QP have no idea what is the cardinality , for example if you have user-defined function whose argument is not a constant value in the where clause, then the QP has to guess and makes assumptions depending on the comparison operator (9-30% selectivity of the clause), which could be totally wrong in&#160; your case. (that is a good candidate for a next post)</p>  <p>Parameterized queries and stored procedures when the parameter values are very different leading to different selectivity of the query. This was the case I use in this post as an example. </p>  <p>&#160;</p>  <p><strong>The Solution</strong></p>              <p>Track events first. I am using the RML tools for monitoring, and <em>readtrace</em> after that to process traces, or SQL Nexus. You can run RML to capture the detailed trace for some period of time depending on your workload or periods of slow system response. Don’t use the Profiler, it will harm your performance. Beside that the RML tools can and will surprise you with how many other thinks you can find happening with your database and workload that could be optimized. Sort and Hash warning appears in the Interesting Event Reports with statements where they occur. Sometimes I work directly with PerfAnalysis database to find out more info that do not appear in the graphical reports. When you find out the statements when the sort/hash warnings occur try to perform the following optimizations:</p>  <ul>   <li>make sure statistics are maintained properly on database and object level</li>    <li>use compile hint, sometimes it is cheaper to recompile on every execution than to pay for sort/hash warnings, you can use plan guides if you don’t want to change your code </li>    <li>don’t confuse parameters and variables and make sure you have the right values at the compile time provided to the QP</li>    <li>make sure to eliminate/reduce cardinality error cases mentioned in the above link. Most of them need rewriting the query</li>    <li>reduce ODRER BY if you can</li> </ul>]]></content:encoded>
    </item>
    <item>
      <title>SharePoint 2010 for SQL Server Professionals</title>
      <link>https://docs.microsoft.com/archive/blogs/magi/sharepoint-2010-for-sql-server-professionals</link>
      <pubDate>Tue, 21 Dec 2010 08:14:02 GMT</pubDate>
      <dc:creator><![CDATA[MNaumova]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/magi/2010/12/21/sharepoint-2010-for-sql-server-professionals/</guid>
      <description><![CDATA[Yesterday we had a regular SQL User Group meeting this time the topic was SharePoint 2010 over SQL...]]></description>
      <content:encoded><![CDATA[<p>Yesterday we had a regular SQL User Group meeting this time the topic was SharePoint 2010 over SQL Server. And we were 2 Certified Masters presenting the topic (Radi and me<img style="border-bottom-style: none; border-right-style: none; border-top-style: none; border-left-style: none" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/75/36/metablogapi/8484.wlEmoticon-smile_2.png" original-url="http://blogs.technet.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-75-36-metablogapi/8484.wlEmoticon_2D00_smile_5F00_2.png" /> ). What to say – it was enjoyable! It was a great experience for me and hopefully to the people in the audience, because they were listening us about 3 and a half hours! Yep, we became unstoppable <img style="border-bottom-style: none; border-right-style: none; border-top-style: none; border-left-style: none" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/75/36/metablogapi/8484.wlEmoticon-smile_2.png" original-url="http://blogs.technet.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-75-36-metablogapi/8484.wlEmoticon_2D00_smile_5F00_2.png" />&#160; But you know, there is a lot more to say about SQL Server hosting..SharePoint databases <img style="border-bottom-style: none; border-right-style: none; border-top-style: none; border-left-style: none" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/75/36/metablogapi/8484.wlEmoticon-smile_2.png" original-url="http://blogs.technet.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-75-36-metablogapi/8484.wlEmoticon_2D00_smile_5F00_2.png" /></p>  <p>Thanks God (and Doncho &amp; Geri from MS) that we had catering after that <img style="border-bottom-style: none; border-right-style: none; border-top-style: none; border-left-style: none" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/75/36/metablogapi/8484.wlEmoticon-smile_2.png" original-url="http://blogs.technet.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-75-36-metablogapi/8484.wlEmoticon_2D00_smile_5F00_2.png" /></p>  <p>The link for the presentation:&#160; <a title="http://cid-7fb6c71238ff60f7.office.live.com/browse.aspx/.Public/Presentations?uc=1" href="http://cid-7fb6c71238ff60f7.office.live.com/browse.aspx/.Public/Presentations?uc=1">http://cid-7fb6c71238ff60f7.office.live.com/browse.aspx/.Public/Presentations?uc=1</a></p>  <p>Enjoy, and see you next time! <img style="border-bottom-style: none; border-right-style: none; border-top-style: none; border-left-style: none" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/75/36/metablogapi/8484.wlEmoticon-smile_2.png" original-url="http://blogs.technet.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-75-36-metablogapi/8484.wlEmoticon_2D00_smile_5F00_2.png" /></p>]]></content:encoded>
    </item>
    <item>
      <title>SQL Denali CTP1 Installation</title>
      <link>https://docs.microsoft.com/archive/blogs/magi/sql-denali-ctp1-installation</link>
      <pubDate>Sun, 14 Nov 2010 08:03:31 GMT</pubDate>
      <dc:creator><![CDATA[MNaumova]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/magi/2010/11/14/sql-denali-ctp1-installation/</guid>
      <description><![CDATA[Just Installed the Denali CTP1. Some experience shared here. I used iso file and installed the...]]></description>
      <content:encoded><![CDATA[<p>Just Installed the Denali CTP1. Some experience shared here. I used iso file and installed the Denali CTP in a Virtual Machine with Windows 2008 Standard, along with SQL Server 2008 Dev Edition with all components installed. </p>  <p>There are two <strong>requirements</strong> for the Denali CTP1 installation that you better pass before you got two separate stop errors on configuration and installation check steps</p>  <ol>   <li><a href="http://www.microsoft.com/downloads/en/details.aspx?FamilyID=74a30045-74b5-4165-8917-b65e5ebd8902&amp;displaylang=en" target="_blank">Microsoft .NET Framework 3.5 SP1 Update for Windows Vista and Windows Server 2008</a></li>    <li>     <h3><a href="http://support.microsoft.com/kb/968930" target="_blank">Windows Management Framework Core package (Windows PowerShell 2.0 and WinRM 2.0)</a></h3>   </li> </ol>  <p>&#160;</p>  <p>If you miss the first requirement then you will get the following message in the beginning of your installation at the Setup Support Rule Check.</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/75/36/metablogapi/8461.image_2.png" original-url="http://blogs.technet.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-75-36-metablogapi/8461.image_5F00_2.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/75/36/metablogapi/6811.image_thumb.png" original-url="http://blogs.technet.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-75-36-metablogapi/6811.image_5F00_thumb.png" width="394" height="222" /></a> </p>  <p>If&#160; you miss the second requirement you will get the error that Windows Power Shell 2.0 is not installed after you pass the feature selection at the Installation Rules Check. </p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/75/36/metablogapi/5238.image_4.png" original-url="http://blogs.technet.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-75-36-metablogapi/5238.image_5F00_4.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/75/36/metablogapi/3582.image_thumb_1.png" original-url="http://blogs.technet.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-75-36-metablogapi/3582.image_5F00_thumb_5F00_1.png" width="407" height="207" /></a> </p>  <p>&#160;</p>  <p>Because my VM is a DC, I cant use the built-in Windows accounts for services, and I created a separate Domain user account for SQL Services. Your case may be different. </p>  <p>&#160;</p>  <p>The are some strange <strong>rules</strong> listed in System Configuration and Installation Configuration Reports:</p>  <ul>   <li>BIDS2008InstalledCheck rule checks if any of SQL Server 2008 Business Intelligence Development Studio installation exists. It passed saying that SQL Server 2008 Business Intelligence Development Studio is not installed. Actually I have SQL Server 2008 with all the components Installed. </li>    <li>Shared Components Upgrade Rule checks whether SQL Server &quot;Denali&quot; CTP1 shared components (such as IS, BIDS, Tools, SSMS, or BOL) are present on the machine, because installing SQL Server &quot;Denali&quot; CTP1 shared components will automatically upgrade the existing shared components. The rule generated a warning message showing that there are one or more shared components of SQL Server &quot;Denali&quot; CTP1 installed on the machine. It warns that installing SQL Server &quot;Denali&quot; CTP1 shared components will automatically upgrade the existing shared components. Actually It is the first time I am doing Denali Installation, so there is no way I am aware of to have its Shared components on the VM.</li> </ul>  <p>&#160;</p>  <p><strong>Changes </strong>in the Installation Process</p>  <p>Actually the installation is the same as SQL Server 2008 with very small changes.</p>  <p>There is a new Setup Role page in the installation allowing you to choose the General SQL Server Features that you want to install. If you want to install everything as SQL Services and Shared tools then you can simply choose All Features with defaults service accounts (puts system accounts for Services). </p>  <p>&#160;</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/75/36/metablogapi/6712.image_6.png" original-url="http://blogs.technet.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-75-36-metablogapi/6712.image_5F00_6.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/75/36/metablogapi/5241.image_thumb_2.png" original-url="http://blogs.technet.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-75-36-metablogapi/5241.image_5F00_thumb_5F00_2.png" width="544" height="407" /></a> </p>  <p>The All features doesn't save you the Features selection box, it just checks all features for you.&#160;&#160;&#160; </p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/75/36/metablogapi/4657.image_8.png" original-url="http://blogs.technet.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-75-36-metablogapi/4657.image_5F00_8.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/75/36/metablogapi/2502.image_thumb_3.png" original-url="http://blogs.technet.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-75-36-metablogapi/2502.image_5F00_thumb_5F00_3.png" width="545" height="285" /></a> </p>  <p></p>  <p></p>  <p></p>  <p>&#160;</p>  <p>If you want just PowerPivot than you better prepare yourself for a lot of requirements and check for this installation, starting from 64-bit OS and ending with accounts for SQL server is SharePoint Farm requirement. </p>  <p>You can find all the Setup Rules requirements <a href="http://msdn.microsoft.com/en-us/library/ms143185(SQL.110).aspx" target="_blank">here</a>, but the requirements for PowerPivot for SharePoint Installation are not listed in this link.</p>  <p>I found the following from my Boot strap Report:</p>  <table border="0" cellspacing="0" cellpadding="2" width="914"><tbody>     <tr>       <td valign="top" width="200">Rule Name</td>        <td valign="top" width="712">Description</td>     </tr>      <tr>       <td valign="top" width="200">ASSPI64bitsMachineCheck</td>        <td valign="top" width="712">Checks whether the computer processor meets the 64-bit requirement for installing SQL Server PowerPivot for SharePoint.</td>     </tr>      <tr>       <td valign="top" width="200">ASSPIExistingFarmRequiresMoss14FarmCheck</td>        <td valign="top" width="712">Checks for membership in a SharePoint Server 2010 farm.</td>     </tr>      <tr>       <td valign="top" width="200">ASSPIExistingFarmRequiresUpgradeCheck</td>        <td valign="top" width="712">Checks existing farm for SharePoint Server 2010.</td>     </tr>      <tr>       <td valign="top" width="200">ASSPIIISVersionCheck</td>        <td valign="top" width="712">Checks for Internet Information Services 7.0 or later. IIS 7.0 or later is required for installing SQL Server PowerPivot for SharePoint.</td>     </tr>      <tr>       <td valign="top" width="200">ASSPIInstanceNameNotInUseCheck</td>        <td valign="top" width="712">Checks for the required instance name.</td>     </tr>      <tr>       <td valign="top" width="200">ASSPINewFarmNeedsUpgradeToO14MossEnterpriseCheck</td>        <td valign="top" width="712">Checks for an un-configured SharePoint Server 2010.</td>     </tr>      <tr>       <td valign="top" width="200">ASSPINewFarmRequiresMoss14BitsCheck</td>        <td valign="top" width="712">Checks whether SharePoint Server 2010 is installed.</td>     </tr>      <tr>       <td valign="top" width="200">ASSPINewFarmRequiresMossBitsCheck</td>        <td valign="top" width="712">Checks whether the SharePoint server can be configured.</td>     </tr>      <tr>       <td valign="top" width="200">ASSPINewO14EnterpriseFarmUnconfiguredCheck</td>        <td valign="top" width="712">Checks whether Setup will be able to configure the local SharePoint server.</td>     </tr>      <tr>       <td valign="top" width="200">ASSPINo32BitsOrWowCheck</td>        <td valign="top" width="712">Checks whether Setup is running in a 64-bit process on a computer that is running a 64-bit operating system. This is required for installing SQL Server PowerPivot for SharePoint.</td>     </tr>      <tr>       <td valign="top" width="200">ASSPINoExistingIMBICheck</td>        <td valign="top" width="712">Checks for an existing instance of SQL Server PowerPivot for SharePoint. You can have only one instance of PowerPivot for SharePoint on a computer.</td>     </tr>      <tr>       <td valign="top" width="200">ASSPIOperationSystemCheck</td>        <td valign="top" width="712">Checks for the Windows Server 2008 or later operating system. This operating system is required for installing SQL Server PowerPivot for SharePoint.</td>     </tr>      <tr>       <td valign="top" width="200">ASSPIProvisionResultValidCheck</td>        <td valign="top" width="712">Checks whether all of the SQL Server PowerPivot for SharePoint instances in the farm are the same version.</td>     </tr>      <tr>       <td valign="top" width="200">ASSPISharePointPlatformSupportedCheck</td>        <td valign="top" width="712">Checks whether SharePoint supports current .Net Framework version.</td>     </tr>      <tr>       <td valign="top" width="200">ASSPIUserIsFarmAdminCheck</td>        <td valign="top" width="712">Checks whether the user running Setup is also a SharePoint farm administrator.</td>     </tr>      <tr>       <td valign="top" width="200">&#160;</td>        <td valign="top" width="712">&#160;</td>     </tr>   </tbody></table>  <p>&#160;</p>  <p>I think I am not going to start the PowerPivto for SharePoint soon.</p>  <p>That is shortly the Denali Installation, pretty smart and easy. I am even thinking to repeat it on my laptop, seems that it is safe to play with (i remember those days when I had to prepare a separate and very isolated VM for installing first CTP of SQL 2005 :))</p>  <p>The most interesting and exciting part of playing with the product just begins. I found some new features in the SSMS already&#160; and I like them – the SSMS Add extended events that was a separate installation for 2008 is there, the SSMS itself looks very much like VS 2008. There are new <strong>Availability Groups</strong> and Integration <strong>Services</strong> folders that I am starting playing with. I know that there will be major changes to the SSIS, so i hope to find something in CTP1.</p>  <p>Will update you soon :)</p>]]></content:encoded>
    </item>
    <item>
      <title>SQL Denali CTP1 Released!</title>
      <link>https://docs.microsoft.com/archive/blogs/magi/sql-denali-ctp1-released</link>
      <pubDate>Wed, 10 Nov 2010 02:31:05 GMT</pubDate>
      <dc:creator><![CDATA[MNaumova]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/magi/2010/11/10/sql-denali-ctp1-released/</guid>
      <description><![CDATA[Another PASS Announcement (it must be a great conference, I am really sorry I couldn't make it): SQL...]]></description>
      <content:encoded><![CDATA[<p>Another PASS Announcement (it must be a great conference, I am really sorry I couldn't make it): SQL Denali CTP1 released! At last! :) I was so inpatient to share&#160; the new features coming and I hardly kept my mouth shut.</p>  <p>The HADR-on features are coming. Even with partial functionality enabled at CTP1 we are happy to have Availability Groups and Read Only Mirror! Let’s play with this CTP! Enjoy:</p>  <p><a href="http://www.microsoft.com/downloads/en/details.aspx?FamilyID=6a04f16f-f6be-4f92-9c92-f7e5677d91f9" target="_blank">Download SQL Denali CTP1</a></p>  <p>View <a href="http://www.sqlpass.org/summit/na2010/LiveKeynotes/Tuesday.aspx" target="_blank">Ted Kummert’s PASS Keynote Video</a> and read the <a href="http://www.sqlmag.com/blogs/database-administration/tabid/794/entryid/72349/SQL-Server-Denali-CTP-Available-to-PASS-Attendees.aspx" target="_blank">Interview</a></p>  <p>Waiting to hear your experience :)</p>]]></content:encoded>
    </item>
    <item>
      <title>SQL Server Masters Certification Changes</title>
      <link>https://docs.microsoft.com/archive/blogs/magi/sql-server-masters-certification-changes</link>
      <pubDate>Wed, 10 Nov 2010 01:48:48 GMT</pubDate>
      <dc:creator><![CDATA[MNaumova]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/magi/2010/11/10/sql-server-masters-certification-changes/</guid>
      <description><![CDATA[A PASS Announcement for SQL Master Certification and couple of links. Shortly you can reach SQL...]]></description>
      <content:encoded><![CDATA[<p>A PASS Announcement for SQL Master Certification and couple of links. Shortly you can reach SQL Master by taking the exams at 9 available certified Prometric Centers Worldwide. You are not required to go to Redmond for a 3 weeks training. You can choose by yourself how to prepare for the exams. There are two exams – a knowledge exams and a lab exam.</p>  <p>· <a href="http://www.microsoft.com/presspass/features/2010/nov10/11-09SQLServerMCM.mspx">SQL Server Masters Certification Goes Global</a> (the first press release and press video)</p>  <p>· <a href="http://www.microsoft.com/learning/en/us/certification/master-sql-path.aspx">New Path to Microsoft Certified Master: Microsoft SQL Server 2008</a></p>  <p>· <a href="http://www.microsoft.com/learning/en/us/certification/master-sql.aspx">Data sheet (executive summary)</a></p>  <p>· <a href="http://technet.microsoft.com/en-us/sqlserver/ff977043.aspx">SQL Server 2008 Microsoft Certified Master (MCM) Readiness Videos</a></p>]]></content:encoded>
    </item>
    <item>
      <title>SQL Server Unplugged Follow Up</title>
      <link>https://docs.microsoft.com/archive/blogs/magi/sql-server-unplugged-follow-up</link>
      <pubDate>Sat, 17 Apr 2010 02:43:00 GMT</pubDate>
      <dc:creator><![CDATA[MNaumova]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/magi/2010/04/17/sql-server-unplugged-follow-up/</guid>
      <description><![CDATA[As I promised recently I am following up some questions from the MS Days 2010 SQL Server Unplugged...]]></description>
      <content:encoded><![CDATA[<p>As I promised recently I am following up some questions from the MS Days 2010 SQL Server Unplugged Session.</p>  <p>&#160;</p>  <h5>Q: RBS and FILESTREAM Usage, why using the FILESTREAM/RBS functionality in SharePoint delayed?</h5>  <p>A: FILESTREAM and RBS are complementary approaches for storage and management of BLOBs and we see them both continuing to evolve.</p>  <ul>   <li>FILESTREAM provides a storage option that allows storage, efficient streaming and integrated management of large BLOBs in a SQL database by utilizing the underlying NTFS file system for BLOB storage/streaming. It offers fully transactional access and compatible operations as varbinary(max). The FILESTREAM support is built into SQL Server 2008 Database Engine.</li>    <li>RBS is a set of&#160; standardized APIs that allow storage/retrieval of BLOBs outside of your main SQL database where a dedicated BLOB store is desirable for various reasons. This uses a provider model for plugging in any dedicated BLOB store that implements these RBS APIs. We have also built an out-of-the-box RBS FILESTREAM provider that allows a deployment to use a SQL Database (local or remote) as a dedicated BLOB store. This provider utilizes the FILESTREAM as the BLOB storage mechanism and ties the two technologies together. SQL Server (RBS) is available as part of the <strong>Feature Pack RC0</strong> for Microsoft SQL Server 2008. The download includes a client-side DLL that you can use in your applications and also some stored procedures to install on the SQL Server itself. The RBS RC0 setup program is available for X86, X64, and IA64 computers. It requires the Microsoft Installer 4.5</li> </ul>  <p>Download the RBS RC0. Here’s the link: <a href="http://www.microsoft.com/downloads/details.aspx?displaylang=en&amp;FamilyID=089a9dad-e2df-43e9-9cd8-c06320520b40">http://www.microsoft.com/downloads/details.aspx?displaylang=en&amp;FamilyID=089a9dad-e2df-43e9-9cd8-c06320520b40</a></p>  <p>The RBS team also released a sample application showing the many ways to use this new feature, including: </p>  <ul>   <li>Basic store / fetch </li>    <li>Specifying collections / blob stores for store calls </li>    <li>Push and pull streaming APIs </li>    <li>Using the System.IO.Stream APIs to do asynchronous reads from the blob store</li> </ul>  <p>This package also includes a sample file provider, in case you do not have an RBS store to test your application. Be sure to install the sample provider (the instructions are available at the CodePlex site) before you try storing and reading blobs.</p>  <p>Download the sample and leave comments at <a href="http://www.codeplex.com/sqlrbs">http://www.codeplex.com/sqlrbs</a></p>  <p>Check the recently created RBS team blog at <a href="http://blogs.msdn.com/sqlrbs">http://blogs.msdn.com/sqlrbs</a></p>  <p>&#160; <br /></p>  <h5>Q: How to decide FILESTREAM or In Data Page storage and what are the FILESTREAM advantages?</h5>  <p>A: According to <strong>BOL</strong> use FILESTREAM when:</p>  <ul>   <li>You are storing BLOBs with an average size of 1 megabyte or more </li>    <li>Fast read access is important </li>    <li>You want to access BLOBs from your application's middle tier code</li> </ul>  <p>The advantages of using FILESTREAM are:</p>  <ul>   <li>You store and retrieve your BLOBs together with your relational data in a single data store&#160;&#160; </li>    <li>The BLOBs are included in database backups and restores </li>    <li>Inserting, updating and deleting BLOBs and your relational data happens in the same database transaction </li>    <li>The 2 GB max size for a varbinary(max) column doesn't apply; you are only limited by the available space on the NTFS file system </li>    <li>The SQL Server buffer pool memory is not used to operate on BLOBs; in previous versions large BLOBs could consume a lot of this memory </li>    <li>All BLOB access can be performed from .NET code, allowing your middle tier code to easily work with these objects </li>    <li>The NTFS file system can save and retrieve large BLOBs faster than SQL Server</li> </ul>  <p>&#160;</p>  <h5>Q: How the disk parameters should be setup for the disks where Transaction Log&#160; reside?</h5>  <p> A: To answer the question lets clarify some terms which will allow us to be on the same page </p>  <p><a name="_Toc136827167"><strong>Sector Size</strong> </a></p>  <p>The <i>sector size</i> is the smallest physical storage unit on the disk, the minimum data chunk that can be written to disk. . The sector size is a fixed size set by the disk manufacturer. Historically, sector size has been fixed at 512 bytes. (Newer drives make 1KB, 2KB, or 4KB sectors available.) </p>  <p><strong>Stripe Size</strong></p>  <p>The <i>stripe size</i> refers to the unit of data that is written and accessed from a disk in a RAID system. This is a configurable value that is set when designing the storage array system. A smaller stripe size allows data to be distributed to more disks and increase I/O parallelism. Note that the stripe size of a single SQL Server extent (64 KB) is the lower limit. For the same data, a larger stripe size means the data can be stored on fewer disks and decrease the I/O distribution and the degree of parallelism. </p>  <p><strong>File Allocation Unit Size</strong></p>  <p>When hard drives are formatted, the size of the file allocation unit defined by the OS (or user) determines the number of sectors per file allocation unit. The file allocation unit size is known also as cluster size. For example, if the sectors of a hard drive are 512 bytes &amp; a 64KB file allocation unit is defined, the cluster is comprised of 128 sectors.</p>  <p><strong>Partition Alignment</strong></p>  <p>Disk array hardware reports 63 reserved (hidden) sectors, and Windows obediently implements this information, reserving these sectors at the beginning of the first partition of a disk. The master boot record (MBR) resides within these hidden sectors. The compliance by Windows with 63 hidden sectors reported by disk hardware results in misalignment with stripe units, disk controllers, and cache segment lines. In all versions of Windows earlier than and including Windows XP and Windows Server 2003, these reserved sectors do not coincide with fundamental physical boundaries. The result is that single clusters of user data are written across multiple stripe units of the RAID. Every nth operation is affected (n depends on file allocation unit (cluster) size and stripe unit size). Fundamental physical boundaries in disk controllers and other hardware are also violated. (<a href="http://msdn.microsoft.com/en-us/library/dd758814.aspx" target="_blank">Disk Partition Alignment Best Practices SQL CAT Team Article</a>)</p>  <h4>Correlations: Partition Offset, File Allocation Unit Size, &amp; Stripe Unit Size</h4>  <p>There are two correlations which when satisfied are a fundamental precondition for optimal disk I/O performance. The results of the following calculations must result in an integer value:</p>  <p><b>Partition_Offset ÷ Stripe_Unit_Size </b></p>  <p><b>Stripe_Unit_Size ÷ File_Allocation_Unit_Size </b></p>  <p>Of the two, the first is by far the most important for optimal performance.</p>  <p>&#160;</p>  <h4>What is the role of the sector size for the transaction log?</h4>  <p>Although SQL Server tries to use the log space as efficiently as possible, certain application patterns cause the log-block fill percentages to remain small. The following extreme example points out the clear difference in the transaction log space requirements as the sector size varies.</p>  <p>&#160; WHILE(@I &lt; 10000)</p>  <p>&#160; BEGIN</p>  <p>&#160;&#160;&#160; BEGIN TRAN</p>  <p>&#160;&#160;&#160; INSERT INTO tblTest values (‘A’, @I)</p>  <p>&#160;&#160;&#160; COMMIT TRAN</p>  <p>&#160;&#160;&#160; SET @I = @I + 1</p>  <p>&#160; END</p>  <p>- vs -</p>  <p>BEGIN TRAN</p>  <p>&#160; WHILE(@I &lt; 10000)</p>  <p>&#160; BEGIN</p>  <p>&#160;&#160;&#160; INSERT INTO tblTest values (‘A’, @I)</p>  <p>&#160;&#160;&#160; SET @I = @I + 1</p>  <p>&#160; END</p>  <p>&#160; COMMIT TRAN</p>  <p>The first example requires SQL Server to write the log records 10,000 times, as each commit is processed. The second example enables SQL Server to pack log records and write all 10,000 inserts and the single commit at the same time. </p>  <p>Calculating the log usage for the examples results in the following approximations.</p>  <p>· By using a 4-KB sector size for the first example, ~40 MB of disk space is used. </p>  <p>· By using a 512-byte sector size for the first example, ~5 MB of disk space is used.</p>  <p>· By using a 4-KB sector size for the second example, ~1 MB of disk space is used.</p>  <p>·&#160;&#160; By using a 512-byte sector size for the second example, ~1 MB of disk space is used.</p>  <p>How the 40MB and 5MB disk space comes from - It is 10 000Transactions * 4K or 512byte respectively. With first two examples where we have large number of small transactions all that matters is the sector size. When you have one large transaction, the 1MB of disk space is calculated as just the total amount of data that need to be saved in the log unrelated to the sector size, because SQL Server is able to pack the log records. With smaller number of larger transactions and wrapping inserts you can gain sequential writes up to 64K blocks for writing the Transaction and not wasting log space, and because you have smaller number of transactions you get smaller MB/s and performance benefits. </p>  <p>Not that the example shows how the different sector sizes affect the log size in those particular cases. We however don't have much choice for the sector size because it is set by the hardware vendor. We however do have control for our transaction size and data layer application, and we should prefer to batch such kind of data modification instead of sending them as a separate small transactions.</p>  <p>&#160;</p>  <h4>Transaction Log structures and how they are written</h4>  <p>The typical pattern of transaction log workload in OLTPs are sequential Log writes up to 60k and sequential Log reads up to 60k. Operations inside the database generate transaction log records. A log record contain information about data modifications (Prev/Next data pages LSNs, data values modified, transaction information). In the beginning of a transaction a beginning record is created,&#160; and the end of a typical transaction is marked as Commit Record, which indicates that the transaction must be reflected in the database’s data files or redone if necessary. You can easily find all the records for a transaction using the non-documented function fn_dblog</p>  <p>For example executing SELECT *&#160; FROM fn_dblog (NULL, NULL) for the current database, returns the following table result where you can easily see the transaction records for transaction 544 (from row 7 to row 17), the begin transaction record (LOP_BEGIN_XACT), the commit transaction record (LOP_COMMIT_XACT), their size and lot more information.&#160; </p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_technet/magi/WindowsLiveWriter/SQLServerUnpluggedFollowUp_E459/image_6.png" original-url="http://blogs.technet.com/blogfiles/magi/WindowsLiveWriter/SQLServerUnpluggedFollowUp_E459/image_6.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_technet/magi/WindowsLiveWriter/SQLServerUnpluggedFollowUp_E459/image_thumb_2.png" original-url="http://blogs.technet.com/blogfiles/magi/WindowsLiveWriter/SQLServerUnpluggedFollowUp_E459/image_thumb_2.png" width="801" height="356" /></a> </p>  <p></p>  <p>As you probably know at least from my previous blog posts for Log Fragmentation, the Transaction Log is a sequential file which contains VLFs – a smallest unit of Log management – making log part active, truncating the log. VLFs are split internally into dynamically sized log blocks, ranging from 512-bytes to 64KB in 512-byte increments, as needed. </p>  <p>When a transaction commits, all the transaction log records should be written to disk, which force the actual physical IO operation. Not every transaction log record is written as a separate IO operation to disk. Log records are grouped into log blogs, which are the unit of a write IO operation in the transaction log. The log block are dynamically sized according to specific internal algorithms, but their size definitely divides to sector size (usually 512) and their max size is 64KB. The log block change can be obtained from Current_LSN Column in the <em>fn_dblog</em> result set as a change in the middle number (000000a2 for the Transaction 544). Note that log blocks have different sizes according to the transaction (Summary of Log Record Length column in Bytes). Paul has a good <a href="http://www.sqlskills.com/BLOGS/PAUL/post/Benchmarking-1-TB-table-population-(part-2-optimizing-log-block-IO-size-and-how-log-IO-works).aspx" target="_blank">post</a> showing the importance of transaction size, batching data modification for log block sizes and the resulting TLog IO optimizations. Again the large number of very small transactions as well as the large transactions could affect negatively. </p>  <h4>What we can do and what are the configurable values?</h4>  <p>We can configure the Stripe Size, File Allocation Unit Size and we have to make sure the partitions are aligned (for OS prior to Windows Server 2008)</p>  <p>We recommend a 64 KB or 256 KB <strong>stripe size</strong> for most workloads. When the workload includes table and index range scans on tables that are larger than 100 MB, a stripe size of 256 KB allows for more efficient read-ahead. </p>  <p>It is very hard to know in detail the workload and to configure those values in the best possible way. That is why the recommendation exists covering the average workload type and mentioning exceptions. </p>  <p>Small stripe sizes work better for small IO requests because you can process lots of them in parallel using most of your spindles. A large IO request requires large seek time to read only few KBytes on each spindle, so in case your IO requests are large, increasing the stripe size can help to get more throughput, reading lots of data with small costs. Long stripe sizes usually work better in scenarios with not too many parallel requests.</p>  <p>If your IO requests are small and you have large stripe sizes you can end up with a not so good distributed load among the disks, and you cannot evenly utilize lots of spindles you have (in case you have them). You cannot get the maximum throughput because you do not parallel your IO operation. The small addressable unit of the array is the stripe so having very large stripes can hurt performance when storing small files or writing transaction log streams.</p>  <p>The <strong>file allocation unit size (cluster size)</strong> recommended for SQL Server is 64 KB</p>  <p>An appropriate value for most installations should be 65,536 bytes (that is, 64 KB) for partitions on which SQL Server data or log files reside. In many cases, this is the same size for Analysis Services data or log files, but there are times where 32 KB provides better performance. To determine the right size, you will need to do performance testing with your workload comparing the two different block sizes.</p>  <p>In the absence of an explicit vendor recommendation, use a <strong>partition offset that</strong> complies with the correlation discussed in the section “Correlations: Partition Offset, File Allocation Unit Size, and Stripe Unit Size”. 64 KB is a common, valid starting partition offset because it correlates well with fundamental physical boundaries in disks, controllers, and cache. Other valid starting partition offsets exist. The Windows Server 2008 default is 1024 KB. </p>  <p>The most important think to consider however are not those configurations. Even when we have those settings as a fact that we cannot change (Shared SAN, storage admins decisions, etc) we can live with that. Those that are really important are our database and transaction log initial file size and auto growth settings. If we don't set them correctly and/or leave them by default we risk to end up with huge disk and file fragmentation and hurt IO Performance. (see my previous blogs addressing fragmentation)</p>]]></content:encoded>
    </item>
    <item>
      <title>The Greatest MS Days Ever!</title>
      <link>https://docs.microsoft.com/archive/blogs/magi/the-greatest-ms-days-ever</link>
      <pubDate>Thu, 08 Apr 2010 06:10:59 GMT</pubDate>
      <dc:creator><![CDATA[MNaumova]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/magi/2010/04/08/the-greatest-ms-days-ever/</guid>
      <description><![CDATA[MS Days has just passed. It has been a great event, actually the greatest one I’ve ever attended as...]]></description>
      <content:encoded><![CDATA[<p>MS Days has just passed. It has been a great event, actually the greatest one I’ve ever attended as a presenter. And it is not just because of the award I received from Ogi as a recognition for leading the Bulgarian SQL Community (It was very kind, but I accept it not only as an award for me personally, but for all the SQL Community members for their passion to “&quot;SQL Together!”&quot; ). The MS Days event 2010 was the greatest ever because of the logistics, excellent ideas, and all the events arrangements. Congratulations to our colleagues from BMO Department for the great job done!</p>  <p>Most popular and highest rated presentations were those where I shared my experience. The “Top 10 thinks you shouldn't do”&quot; session was enjoyable. There were so many people wanted to attend the session that some of them were sitting on the floor. I really hope I haven't disappointed them (Well, according to the feedbacks... I haven't so much:). I was really happy when I received a feedback the day after the session from a customer’s DBA. She said: “After your session I checked out &amp; fixed the settings in our SQL Servers”. That is one of the best feedback I’ve received, because it makes me feel like my session helped someone not just having a good time, but doing the job better. I am really excited about how my “Top 10 thinks “ session&#160; series go. I have so much ideas about it, at least I have almost structured my next Top 10 :) Responding to the request for ppt slides – see the link at the end.</p>  <p>SQL Server Unplugged session was the one I think I did best, it was so funny, I really enjoyed the time. I got some tricky questions, some funny questions and ..a&#160; bunch of flowers at the end (many thanks to the HP people from the SQL User Group, you made my day :) Actually the session was one of the highest rated during the whole event. It was so nice to get this feedback, it was definitely energizing, something that keeps me going! I am really happy that the idea behind SQL Server Unplugged session worked out and was accepted by the audience. I will definitely continue to deliver and improve it. I will follow up some questions from the session in my next posts (one step at a time, by the way I am on a vacation right now, what a great time for blog postings, everyone is watching me in the SPA center while I am writing on my laptop:) Thanks God I got an IT husband)</p>  <p>I will not comment as much the R2 session because I feel it is not my best one. The jet lag, the fairy of the demos, almost everything was against me during that one hour :) But I hope my audience forgave me, taking the main point I wanted to give them - the feeling of what is coming, what to expect as a trends, not just showing some cool features. </p>  <p>My slides from MS Days 2010: </p>  <p><a title="http://cid-7fb6c71238ff60f7.skydrive.live.com/browse.aspx/.Public/MSDays2010" href="http://cid-7fb6c71238ff60f7.skydrive.live.com/browse.aspx/.Public/MSDays2010">http://cid-7fb6c71238ff60f7.skydrive.live.com/browse.aspx/.Public/MSDays2010</a></p>]]></content:encoded>
    </item>
    <item>
      <title>My ZDNet Interview</title>
      <link>https://docs.microsoft.com/archive/blogs/magi/my-zdnet-interview</link>
      <pubDate>Tue, 06 Apr 2010 09:36:23 GMT</pubDate>
      <dc:creator><![CDATA[MNaumova]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/magi/2010/04/06/my-zdnet-interview/</guid>
      <description><![CDATA[As probably many of you noticed I was kind of exposed to the public in the past couple of months...]]></description>
      <content:encoded><![CDATA[<p>As probably many of you noticed I was kind of exposed to the public in the past couple of months trough lot of interviews and events. I could say I like it. It is so nice to share your thoughts, your motivation drivers, your path as a person and professional, and to have a chance to send a message to people that want to hear from you. </p>  <p>Last but not least it is so enjoying to meet people not part of the usual technical community you you work with. Mary-Jo Foley is one of those impressive persons that can energize you from the very first contact. She will get you out from your comfort zone trying to hear beyond your words. It is a challenge and a great pleasure to talk with her. As one of my colleagues said: “Mary-Jo is an Institution, one of the last remaining truly IT journalists. Her book “Microsoft 2.0” is a must-read (and must-not-agree-with :))”</p>  <p>I am so proud to present you the result of my contact with Mary-Jo:</p>  <p><b></b></p>  <p><b>Margarita Naumova: Microsoft Women Worth Watching</b></p>  <p><a href="http://blogs.zdnet.com/microsoft/?p=5799&amp;tag=trunk;content">http://blogs.zdnet.com/microsoft/?p=5799&amp;tag=trunk;content</a></p>  <p>&#160;</p>  <p>It is so nice, thank you Mary-Jo! </p>]]></content:encoded>
    </item>
  </channel>
</rss>