<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:copyright="http://blogs.law.harvard.edu/tech/rss" xmlns:image="http://purl.org/rss/1.0/modules/image/">
    <channel>
        <title>SQL Server</title>
        <link>http://geekswithblogs.net/maxonweb/category/10894.aspx</link>
        <description>SQL Server</description>
        <language>en-AU</language>
        <copyright>Max</copyright>
        <managingEditor>rm.manickam@gmail.com</managingEditor>
        <generator>Subtext Version 0.0.0.0</generator>
        <item>
            <title>Synchronous Vs Asynchronous Statistics auto update in SQL Server</title>
            <link>http://geekswithblogs.net/maxonweb/archive/2009/11/24/136505.aspx</link>
            <description>&lt;p align="justify"&gt;&lt;strong&gt;Asynchronous statistics&lt;/strong&gt; auto update in SQL Server would ensure that the statistics are not updated when a query is executed, ensuring timely response. For this option, we need to set &lt;strong&gt;AUTO_UPDATE_STATISTICS_ASYNC to ON and also AUTO_UPDATE_STATISTICS to ON. &lt;/strong&gt;Here, a separate thread runs in the background, which actually does the job of updating the statistics. So updated stats are available the next time for a query. This can also work the way round, meaning that a query might be using old stats and hence would be taking more time.&lt;/p&gt;  &lt;p align="justify"&gt;Synchronous statistics auto update in SQL Server would ensure that the stats are up-to date, every time a query is executed. This can be very much time consuming and is in proportion with the number of rows in a table. For this option, we need to set &lt;strong&gt;AUTO_UPDATE_STATISTICS_ASYNC to OFF.&lt;/strong&gt;&lt;/p&gt;  &lt;p align="justify"&gt;Wise decisions had to made considering the scenario. For me, it helped me a lot by turning &lt;strong&gt;AUTO_UPDATE_STATISTICS_ASYNC to ON. &lt;/strong&gt;This query below can be used to get the statistics status across all the databases in an instance.&lt;/p&gt;  &lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;   &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;     &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;SELECT&lt;/span&gt; name &lt;span style="color: #0000ff"&gt;AS&lt;/span&gt; "Name", &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    is_auto_create_stats_on &lt;span style="color: #0000ff"&gt;AS&lt;/span&gt; "Auto &lt;span style="color: #0000ff"&gt;Create&lt;/span&gt; Stats",&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    is_auto_update_stats_on &lt;span style="color: #0000ff"&gt;AS&lt;/span&gt; "Auto &lt;span style="color: #0000ff"&gt;Update&lt;/span&gt; Stats",&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;    is_auto_update_stats_async_on &lt;span style="color: #0000ff"&gt;AS&lt;/span&gt; "Asynchronous &lt;span style="color: #0000ff"&gt;Update&lt;/span&gt;" &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;FROM&lt;/span&gt; sys.databases&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;GO&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;The below queries can be used to set the ASYNC on.&lt;/p&gt;

&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;
  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;
    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;ALTER&lt;/span&gt; &lt;span style="color: #0000ff"&gt;DATABASE&lt;/span&gt; &amp;lt;DB_NAME&amp;gt; &lt;span style="color: #0000ff"&gt;SET&lt;/span&gt; AUTO_UPDATE_STATISTICS &lt;span style="color: #0000ff"&gt;ON&lt;/span&gt; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;ALTER&lt;/span&gt; &lt;span style="color: #0000ff"&gt;DATABASE&lt;/span&gt; &amp;lt;DB_NAME&amp;gt; &lt;span style="color: #0000ff"&gt;SET&lt;/span&gt; AUTO_UPDATE_STATISTICS_ASYNC &lt;span style="color: #0000ff"&gt;ON&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;This article has been prepared by referring to various other sources in the internet. Here are they:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://weblogs.sqlteam.com/tarad/archive/2008/06/16/Asynchronous-Update-Statistics.aspx" target="_blank"&gt;http://weblogs.sqlteam.com/tarad/archive/2008/06/16/Asynchronous-Update-Statistics.aspx&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a title="http://www.sql-server-performance.com/articles/per/asynchronous_statistics_p1.aspx" href="http://www.sql-server-performance.com/articles/per/asynchronous_statistics_p1.aspx" target="_blank"&gt;http://www.sql-server-performance.com/articles/per/asynchronous_statistics_p1.aspx&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;SQL Server BOL&lt;/p&gt; &lt;img src="http://geekswithblogs.net/maxonweb/aggbug/136505.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Max</dc:creator>
            <guid>http://geekswithblogs.net/maxonweb/archive/2009/11/24/136505.aspx</guid>
            <pubDate>Mon, 23 Nov 2009 23:08:00 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/maxonweb/comments/136505.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/maxonweb/archive/2009/11/24/136505.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/maxonweb/comments/commentRss/136505.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/maxonweb/services/trackbacks/136505.aspx</trackback:ping>
        </item>
    </channel>
</rss>
