<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0" xml:base="http://www.itbully.com">
<channel>
 <title>ITBully</title>
 <link>http://www.itbully.com</link>
 <description>Η πληροφορική που λειτουργεί για εσάς και όχι εσείς για αυτήν</description>
 <language>en</language>
<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/Itbully" /><feedburner:info uri="itbully" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:feedFlare href="http://add.my.yahoo.com/rss?url=http%3A%2F%2Ffeeds.feedburner.com%2FItbully" src="http://us.i1.yimg.com/us.yimg.com/i/us/my/addtomyyahoo4.gif">Subscribe with My Yahoo!</feedburner:feedFlare><feedburner:feedFlare href="http://www.newsgator.com/ngs/subscriber/subext.aspx?url=http%3A%2F%2Ffeeds.feedburner.com%2FItbully" src="http://www.newsgator.com/images/ngsub1.gif">Subscribe with NewsGator</feedburner:feedFlare><feedburner:feedFlare href="http://www.bloglines.com/sub/http://feeds.feedburner.com/Itbully" src="http://www.bloglines.com/images/sub_modern11.gif">Subscribe with Bloglines</feedburner:feedFlare><feedburner:feedFlare href="http://www.netvibes.com/subscribe.php?url=http%3A%2F%2Ffeeds.feedburner.com%2FItbully" src="http://www.netvibes.com/img/add2netvibes.gif">Subscribe with Netvibes</feedburner:feedFlare><feedburner:feedFlare href="http://fusion.google.com/add?feedurl=http%3A%2F%2Ffeeds.feedburner.com%2FItbully" src="http://buttons.googlesyndication.com/fusion/add.gif">Subscribe with Google</feedburner:feedFlare><feedburner:feedFlare href="http://www.pageflakes.com/subscribe.aspx?url=http%3A%2F%2Ffeeds.feedburner.com%2FItbully" src="http://www.pageflakes.com/ImageFile.ashx?instanceId=Static_4&amp;fileName=ATP_blu_91x17.gif">Subscribe with Pageflakes</feedburner:feedFlare><feedburner:feedFlare href="http://www.plusmo.com/add?url=http%3A%2F%2Ffeeds.feedburner.com%2FItbully" src="http://plusmo.com/res/graphics/fbplusmo.gif">Subscribe with Plusmo</feedburner:feedFlare><feedburner:feedFlare href="http://www.thefreedictionary.com/_/hp/AddRSS.aspx?http%3A%2F%2Ffeeds.feedburner.com%2FItbully" src="http://img.tfd.com/hp/addToTheFreeDictionary.gif">Subscribe with The Free Dictionary</feedburner:feedFlare><feedburner:feedFlare href="http://www.bitty.com/manual/?contenttype=rssfeed&amp;contentvalue=http%3A%2F%2Ffeeds.feedburner.com%2FItbully" src="http://www.bitty.com/img/bittychicklet_91x17.gif">Subscribe with Bitty Browser</feedburner:feedFlare><feedburner:feedFlare href="http://www.live.com/?add=http%3A%2F%2Ffeeds.feedburner.com%2FItbully" src="http://tkfiles.storage.msn.com/x1piYkpqHC_35nIp1gLE68-wvzLZO8iXl_JMledmJQXP-XTBOLfmQv4zhj4MhcWEJh_GtoBIiAl1Mjh-ndp9k47If7hTaFno0mxW9_i3p_5qQw">Subscribe with Live.com</feedburner:feedFlare><feedburner:feedFlare href="http://www.webwag.com/wwgthis.php?url=http%3A%2F%2Ffeeds.feedburner.com%2FItbully" src="http://www.webwag.com/images/wwgthis.gif">Subscribe with Webwag</feedburner:feedFlare><feedburner:feedFlare href="http://www.wikio.com/subscribe?url=http%3A%2F%2Ffeeds.feedburner.com%2FItbully" src="http://www.wikio.com/shared/img/add2wikio.gif">Subscribe with Wikio</feedburner:feedFlare><item>
 <title>ASP.NET MVC 3 : DLLs needed to run app on Windows Azure</title>
 <link>http://feedproxy.google.com/~r/Itbully/~3/FYYtSpAvgXE/aspnet-mvc-3-dlls-needed-run-app-windows-azure</link>
 <description>&lt;p&gt;If you develop any &lt;a title="ASP.NET MVC" href="http://www.asp.net/mvc" target="_blank"&gt;ASP.NET MVC 3&lt;/a&gt; application (which currently is in RC 2 release) with Razor view engine and you need to run it on &lt;a title="Windows Azure" href="http://www.microsoft.com/windowsazure/" target="_blank"&gt;Windows Azure&lt;/a&gt; then you have to upload some extra DLLs to the cloud. Below is a list of DLLs you need to have as local copies to get ASP.NET MVC 3 run in &lt;a title="Windows Azure" href="http://www.microsoft.com/windowsazure/" target="_blank"&gt;Windows Azure&lt;/a&gt; web role. Have also in mind that if your project uses dynamically loaded assemblies that are not referenced in you project you have to also include them as project items under bin folder. By doing this these DLLs are included to deployment package so you don’t have to create code level references to them.&lt;/p&gt;  

&lt;p&gt;
&lt;strong&gt;List of assemblies:&lt;/strong&gt;
&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Microsoft.Web.Infrastructure &lt;/li&gt;    &lt;li&gt;System.Web.Helpers &lt;/li&gt;    &lt;li&gt;System.Web.Mvc &lt;/li&gt;    &lt;li&gt;System.Web.Razor &lt;/li&gt;    &lt;li&gt;System.Web.WebPages &lt;/li&gt;    &lt;li&gt;System.Web.WebPages.Razor &lt;/li&gt;    &lt;li&gt;WebMatrix.Data &lt;/li&gt; &lt;/ul&gt;  

&lt;p&gt;You can find Razor and ASP.NET Web Pages related assemblies in that folder: &lt;/p&gt;  

&lt;p&gt;
&lt;em&gt;C:\Program Files\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\Assemblies\&lt;/em&gt;
&lt;/p&gt;  

&lt;p&gt;Or if you have x64 OS (as I do)&lt;/p&gt;  

&lt;p&gt;
&lt;em&gt;C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\Assemblies\&lt;/em&gt;
&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/Itbully/~4/FYYtSpAvgXE" height="1" width="1"/&gt;</description>
 <comments>http://www.itbully.com/articles/aspnet-mvc-3-dlls-needed-run-app-windows-azure#comments</comments>
 <category domain="http://www.itbully.com/category/tags/net">.NET</category>
 <category domain="http://www.itbully.com/category/tags/aspnet-mvc-3">ASP.NET MVC 3</category>
 <category domain="http://www.itbully.com/category/tags/azure">Azure</category>
 <category domain="http://www.itbully.com/category/tags/dlls">DLLs</category>
 <category domain="http://www.itbully.com/category/tags/mvc">MVC</category>
 <category domain="http://www.itbully.com/category/tags/razor">Razor</category>
 <category domain="http://www.itbully.com/category/tags/webpages">WebPages</category>
 <category domain="http://www.itbully.com/category/tags/windows-azure">Windows Azure</category>
 <pubDate>Tue, 14 Dec 2010 17:14:00 +0000</pubDate>
 <dc:creator>George Chatzimanolis</dc:creator>
 <guid isPermaLink="false">70 at http://www.itbully.com</guid>
<feedburner:origLink>http://www.itbully.com/articles/aspnet-mvc-3-dlls-needed-run-app-windows-azure</feedburner:origLink></item>
<item>
 <title>SQL Indexing and Performance Part 4: Design Considerations</title>
 <link>http://feedproxy.google.com/~r/Itbully/~3/si-T1GkZPUI/sql-indexing-and-performance-part-4-design-considerations</link>
 <description>&lt;p align="justify"&gt;In the &lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-3-queries-indexes-and-query-optimizer" target="_blank"&gt;previous part&lt;/a&gt; of the blog post series you’ve seen that the &lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-3-queries-indexes-and-query-optimizer" target="_blank"&gt;query optimizer&lt;/a&gt; examines query predicates in order to analyze &lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-3-queries-indexes-and-query-optimizer" target="_blank"&gt;statistics&lt;/a&gt; for useful indexes in the &lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-3-queries-indexes-and-query-optimizer" target="_blank"&gt;execution plan&lt;/a&gt; decision process. Since indexes are quite important to the &lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-3-queries-indexes-and-query-optimizer" target="_blank"&gt;query optimization process&lt;/a&gt;, the first design tip is to consider &lt;em&gt;WHERE, JOIN, MERGE, ORDER BY&lt;/em&gt; and &lt;em&gt;GROUP BY&lt;/em&gt; clauses in your application queries to determine the most suitable columns for indexing in your tables.&lt;/p&gt;  &lt;h3&gt;Use narrow and arithmetic data type indexes&lt;/h3&gt;  &lt;p align="justify"&gt;Taking into consideration &lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-1-sql-storage-and-indexing" target="_blank"&gt;the way that SQL server stores and retrieves data&lt;/a&gt;, it is quite reasonable to maximize your performance if you can fit as many rows as possible to a single &lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-1-sql-storage-and-indexing" target="_blank"&gt;index page&lt;/a&gt;. This would improve IO performance, DB caching and storage allocation space since fewer pages would have to be read, stored and cached by the system. &lt;/p&gt;  &lt;p align="justify"&gt;To achieve fewer &lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-1-sql-storage-and-indexing" target="_blank"&gt;pages&lt;/a&gt; per index you have to decrease index row size, meaning that you would use as fewer columns as possible and as smaller column types as possible. An &lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-1-sql-storage-and-indexing" target="_blank"&gt;index page&lt;/a&gt; in MS SQL is always 8KB long. If you use a single column index of&amp;#160; &lt;em&gt;INT&lt;/em&gt; type (4 bytes), an &lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-1-sql-storage-and-indexing" target="_blank"&gt;index page&lt;/a&gt; could store&amp;#160; more than 2000 rows as opposed to a &lt;em&gt;CHAR(200)&lt;/em&gt; type (200 bytes) that could less than 40 rows. In a situation were a table has 3500 rows the &lt;em&gt;INT&lt;/em&gt; column index would allocate approximately 2 &lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-1-sql-storage-and-indexing" target="_blank"&gt;index pages&lt;/a&gt; while the &lt;em&gt;CHAR(200)&lt;/em&gt; would allocate 88! &lt;/p&gt;  &lt;p align="justify"&gt;System CPU performs arithmetic and not string operations, thus it needs to convert strings to something understandable in order to process it. Have this in mind when designing your index keys strategy since an arithmetic type index key like &lt;em&gt;INT&lt;/em&gt; is usually faster than a string type key like &lt;em&gt;CHAR&lt;/em&gt;, although you can configure &lt;em&gt;CHAR(4)&lt;/em&gt; to have the same size as &lt;em&gt;INT&lt;/em&gt;. &lt;/p&gt;  &lt;h3&gt;Column order matters&lt;/h3&gt;  &lt;p align="justify"&gt;In a composite &lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-2-clustered-and-non-clustered" target="_blank"&gt;index key&lt;/a&gt;,&amp;#160; column order matters. When you create an index on two columns (A,B), the index is sorted on column A and then sub-sorted on column B. If you execute a query with a &lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-3-queries-indexes-and-query-optimizer" target="_blank"&gt;predicate&lt;/a&gt; on column B the &lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-3-queries-indexes-and-query-optimizer" target="_blank"&gt;query optimizer&lt;/a&gt; won’t benefit from the index much, because the index has been constructed with column A, as the first &lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-2-clustered-and-non-clustered" target="_blank"&gt;key column&lt;/a&gt;, although column B is part of the key. &lt;/p&gt;  &lt;p align="justify"&gt;Because useful indexes are the ones with high selectivity, it is best to set the most distinctive column first, followed by the next distinctive column, etc. &lt;/p&gt;  &lt;p align="justify"&gt;To better understand the above arguments, consider the following example; Table &lt;em&gt;application&lt;/em&gt; consists of two columns: &lt;em&gt;app_id&lt;/em&gt; and &lt;em&gt;computer_id&lt;/em&gt;. The &lt;em&gt;app_id&lt;/em&gt; column has a higher selectivity than &lt;em&gt;computer_id&lt;/em&gt; and a non-clustered index &lt;em&gt;IX_APP_ID_COMPUTER_IX&lt;/em&gt; has been created on &lt;em&gt;app_id&lt;/em&gt; (first) and &lt;em&gt;computer_id&lt;/em&gt;.&lt;/p&gt;  &lt;div id="codeSnippetWrapper"&gt;   &lt;div id="codeSnippetWrapper"&gt;     &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 50%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;span style="color: #0000ff"&gt;GO&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #0000ff"&gt;CREATE&lt;/span&gt; &lt;span style="color: #0000ff"&gt;INDEX&lt;/span&gt; IX_APP_ID_COMPUTER_ID &lt;span style="color: #0000ff"&gt;ON&lt;/span&gt; [application]&lt;br /&gt;(app_id &lt;span style="color: #0000ff"&gt;ASC&lt;/span&gt;, computer_id &lt;span style="color: #0000ff"&gt;ASC&lt;/span&gt;);&lt;br /&gt;&lt;span style="color: #0000ff"&gt;GO&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #0000ff"&gt;GO&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #0000ff"&gt;SELECT&lt;/span&gt; [app_id],[computer_id] &lt;span style="color: #0000ff"&gt;FROM&lt;/span&gt; [application]&lt;br /&gt;&lt;span style="color: #0000ff"&gt;WHERE&lt;/span&gt; [computer_id] = 5000025;&lt;br /&gt;&lt;span style="color: #0000ff"&gt;GO&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;
  &lt;/div&gt;

  &lt;div&gt;&amp;#160;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;&lt;a href="http://www.itbully.com/sites/default/files/wlw/image_44.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.itbully.com/sites/default/files/wlw/image_thumb_44.png" width="397" height="86" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The &lt;em&gt;WHERE&lt;/em&gt; clause caused the scan of the entire index because the first column defined as index key was &lt;em&gt;app_id&lt;/em&gt; and not &lt;em&gt;computer_id&lt;/em&gt;. If you filter on a subset of &lt;em&gt;app_id&lt;/em&gt; column you get an &lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-2-clustered-and-non-clustered" target="_blank"&gt;index seek&lt;/a&gt; instead of an &lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-2-clustered-and-non-clustered" target="_blank"&gt;index scan&lt;/a&gt;&lt;/p&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;div id="codeSnippetWrapper"&gt;
    &lt;div id="codeSnippetWrapper"&gt;
      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 50%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;span style="color: #0000ff"&gt;SELECT&lt;/span&gt; [app_id],[computer_id] &lt;span style="color: #0000ff"&gt;FROM&lt;/span&gt; [application]&lt;br /&gt;&lt;span style="color: #0000ff"&gt;WHERE&lt;/span&gt; [app_id] &amp;gt; 241&lt;br /&gt;&lt;/pre&gt;
      &lt;a href="http://www.itbully.com/sites/default/files/wlw/image_45.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.itbully.com/sites/default/files/wlw/image_thumb_45.png" width="383" height="83" /&gt;&lt;/a&gt; 

      &lt;br /&gt;&lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;h3 align="justify"&gt;Examine the selectivity of your indexes&lt;/h3&gt;

&lt;p align="justify"&gt;For an index to be useful, it needs to return as fewer rows as possible in a query predicate. If your query returns a large number of rows the &lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-3-queries-indexes-and-query-optimizer" target="_blank"&gt;query optimizer&lt;/a&gt; might not use the index at all, resulting in a costly query &lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-3-queries-indexes-and-query-optimizer" target="_blank"&gt;execution plan&lt;/a&gt; as explained in the &lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-3-queries-indexes-and-query-optimizer" target="_blank"&gt;previous part&lt;/a&gt; of the series. Therefore consider columns with high percentage of distinct values (high selectivity) for your index keys. You can determine the selectivity of a column if you divide the &lt;em&gt;COUNT&lt;/em&gt; of &lt;em&gt;DISTINCT&lt;/em&gt; values of a column with the &lt;em&gt;COUNT&lt;/em&gt; of values of the same column.&lt;/p&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 50%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;span style="color: #0000ff"&gt;SELECT&lt;/span&gt; &lt;span style="color: #0000ff"&gt;COUNT&lt;/span&gt;(app_id) &lt;span style="color: #0000ff"&gt;AS&lt;/span&gt; APPcount,&lt;br /&gt;&lt;span style="color: #0000ff"&gt;COUNT&lt;/span&gt;(&lt;span style="color: #0000ff"&gt;DISTINCT&lt;/span&gt; app_id) &lt;span style="color: #0000ff"&gt;AS&lt;/span&gt; D_APPcount,&lt;br /&gt;&lt;span style="color: #0000ff"&gt;COUNT&lt;/span&gt;(computer_id) &lt;span style="color: #0000ff"&gt;AS&lt;/span&gt; COMPUTERcount,&lt;br /&gt;&lt;span style="color: #0000ff"&gt;COUNT&lt;/span&gt;(&lt;span style="color: #0000ff"&gt;DISTINCT&lt;/span&gt; computer_id) &lt;span style="color: #0000ff"&gt;AS&lt;/span&gt; D_COMPUTERcount,&lt;br /&gt;&lt;span style="color: #0000ff"&gt;CAST&lt;/span&gt;(&lt;span style="color: #0000ff"&gt;COUNT&lt;/span&gt;(&lt;span style="color: #0000ff"&gt;DISTINCT&lt;/span&gt; app_id)&lt;span style="color: #0000ff"&gt;AS&lt;/span&gt; &lt;span style="color: #0000ff"&gt;DECIMAL&lt;/span&gt;)&lt;br /&gt;/ &lt;span style="color: #0000ff"&gt;CAST&lt;/span&gt;(&lt;span style="color: #0000ff"&gt;COUNT&lt;/span&gt;(app_id)&lt;span style="color: #0000ff"&gt;as&lt;/span&gt; &lt;span style="color: #0000ff"&gt;DECIMAL&lt;/span&gt;)&lt;br /&gt;&lt;span style="color: #0000ff"&gt;AS&lt;/span&gt; APPSelectivity,&lt;br /&gt;&lt;span style="color: #0000ff"&gt;CAST&lt;/span&gt;(&lt;span style="color: #0000ff"&gt;COUNT&lt;/span&gt;(&lt;span style="color: #0000ff"&gt;DISTINCT&lt;/span&gt; computer_id)&lt;span style="color: #0000ff"&gt;as&lt;/span&gt; &lt;span style="color: #0000ff"&gt;DECIMAL&lt;/span&gt;)&lt;br /&gt;/ &lt;span style="color: #0000ff"&gt;CAST&lt;/span&gt;(&lt;span style="color: #0000ff"&gt;COUNT&lt;/span&gt;(computer_id)&lt;span style="color: #0000ff"&gt;as&lt;/span&gt; &lt;span style="color: #0000ff"&gt;DECIMAL&lt;/span&gt;)&lt;br /&gt;&lt;span style="color: #0000ff"&gt;AS&lt;/span&gt; COMPSelectivity&lt;br /&gt;&lt;span style="color: #0000ff"&gt;FROM&lt;/span&gt; [application]&lt;/pre&gt;
  &lt;a href="http://www.itbully.com/sites/default/files/wlw/image_46.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.itbully.com/sites/default/files/wlw/image_thumb_46.png" width="617" height="36" /&gt;&lt;/a&gt; 

  &lt;br /&gt;&lt;/div&gt;

&lt;p align="justify"&gt;The higher the resulting number, the higher the selectivity of the column, thus a better candidate for an index key. In the above example the &lt;em&gt;app_id&lt;/em&gt; column is a better candidate than &lt;em&gt;computer_id&lt;/em&gt; since &lt;em&gt;APPSelectivity&lt;/em&gt; value is higher than &lt;em&gt;COMPSelectivity&lt;/em&gt; value.&lt;/p&gt;

&lt;h3 align="justify"&gt;What about wildcard filtering and OR operators in predicates?&lt;/h3&gt;

&lt;p align="justify"&gt;Wildcard &lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-3-queries-indexes-and-query-optimizer" target="_blank"&gt;predicates&lt;/a&gt; on string filters and &lt;em&gt;OR&lt;/em&gt; operators can be quite tricky in terms of index usage. An &lt;em&gt;OR&lt;/em&gt; operator in a &lt;em&gt;WHERE&lt;/em&gt; clause could render an index useless if one of the filters caused a larger result set, even if both &lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-3-queries-indexes-and-query-optimizer" target="_blank"&gt;predicates&lt;/a&gt; are on indexed columns. Consider the following example were application table has three columns: &lt;em&gt;app_id, computer_id&lt;/em&gt; and &lt;em&gt;name&lt;/em&gt;, a &lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-2-clustered-and-non-clustered" target="_blank"&gt;clustered index&lt;/a&gt; on &lt;em&gt;computer_id&lt;/em&gt; &lt;em&gt;CIX_COMPUTER_ID&lt;/em&gt;, a &lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-2-clustered-and-non-clustered" target="_blank"&gt;non-clustered index&lt;/a&gt; on &lt;em&gt;app_id IX_APP_ID&lt;/em&gt; and a &lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-2-clustered-and-non-clustered" target="_blank"&gt;non-clustered index&lt;/a&gt; on &lt;em&gt;name IX_NAME&lt;/em&gt;.&lt;/p&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 50%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;span style="color: #0000ff"&gt;SELECT&lt;/span&gt; [app_id],[name] &lt;span style="color: #0000ff"&gt;FROM&lt;/span&gt; [application]&lt;br /&gt;&lt;span style="color: #0000ff"&gt;WHERE&lt;/span&gt; [app_id] = 19&lt;/pre&gt;
  &lt;a href="http://www.itbully.com/sites/default/files/wlw/image_47.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.itbully.com/sites/default/files/wlw/image_thumb_47.png" width="427" height="153" /&gt;&lt;/a&gt; 

  &lt;br /&gt;&lt;/div&gt;

&lt;p align="justify"&gt;&amp;#160;&lt;/p&gt;

&lt;div&gt;
  &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 50%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;span style="color: #0000ff"&gt;SELECT&lt;/span&gt; [name],[app_id] &lt;span style="color: #0000ff"&gt;FROM&lt;/span&gt; [application]&lt;br /&gt;&lt;span style="color: #0000ff"&gt;WHERE&lt;/span&gt; [name] &lt;span style="color: #0000ff"&gt;LIKE&lt;/span&gt; (&lt;span style="color: #006080"&gt;'perl%'&lt;/span&gt;)&lt;/pre&gt;
&lt;/div&gt;

&lt;div&gt;&lt;a href="http://www.itbully.com/sites/default/files/wlw/image_48.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.itbully.com/sites/default/files/wlw/image_thumb_48.png" width="419" height="145" /&gt;&lt;/a&gt;&lt;/div&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 50%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;span style="color: #0000ff"&gt;SELECT&lt;/span&gt; [app_id],[name] &lt;span style="color: #0000ff"&gt;FROM&lt;/span&gt; [application]&lt;br /&gt;&lt;span style="color: #0000ff"&gt;WHERE&lt;/span&gt; [app_id] = 19 &lt;span style="color: #0000ff"&gt;OR&lt;/span&gt; [name] &lt;span style="color: #0000ff"&gt;LIKE&lt;/span&gt; (&lt;span style="color: #006080"&gt;'perl%'&lt;/span&gt;) &lt;/pre&gt;

  &lt;br /&gt;&lt;/div&gt;

&lt;div align="justify"&gt;&lt;a href="http://www.itbully.com/sites/default/files/wlw/image_49.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.itbully.com/sites/default/files/wlw/image_thumb_49.png" width="329" height="85" /&gt;&lt;/a&gt; 

  &lt;br /&gt;Although both &lt;em&gt;WHERE&lt;/em&gt; clauses individually caused an index seek operation, when combined together with an &lt;em&gt;OR&lt;/em&gt; operator, they caused a clustered index scan, therefore rendering both non-clustered indexes useless. &lt;/div&gt;

&lt;div&gt;&amp;#160;&lt;/div&gt;

&lt;div align="justify"&gt;&lt;em&gt;LIKE&lt;/em&gt; operators with wildcards on string indexes can also become tricky. If you set a wildcard character in the beginning of a string, for example &lt;em&gt;LIKE(‘%perl’), &lt;/em&gt;&lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-3-queries-indexes-and-query-optimizer" target="_blank"&gt;query optimizer&lt;/a&gt; will probably perform a &lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-2-clustered-and-non-clustered" target="_blank"&gt;scan&lt;/a&gt; and not an &lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-2-clustered-and-non-clustered" target="_blank"&gt;index seek&lt;/a&gt;, since it does not know from where to start seeking in the sorted columns(anything can match before the &lt;em&gt;perl &lt;/em&gt;string). A common example of such wildcard uses are email addresses. In such cases you may need to filter all @gmail.com addresses thus use a &lt;em&gt;LIKE (‘%@gmail.com’)&lt;/em&gt; filter. To successfully utilize an index in such cases you would have to create a &lt;em&gt;&lt;a href="http://en.wikipedia.org/wiki/Reverse_index" target="_blank"&gt;REVERSE INDEX&lt;/a&gt;&lt;/em&gt; on the affected column, a feature not currently supported by MS SQL SERVER (right now is at 2008 R2 version). Nevertheless, filters like &lt;em&gt;string%&lt;/em&gt; or &lt;em&gt;string%string%&lt;/em&gt; may utilize index more appropriately, since &lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-3-queries-indexes-and-query-optimizer" target="_blank"&gt;query optimizer&lt;/a&gt; knows from where to start seeking in the index keys.&lt;/div&gt;

&lt;h3 align="justify"&gt;Check if you can avoid bookmark lookup cost with covering indexes&lt;/h3&gt;

&lt;p align="justify"&gt;As explained in &lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-2-clustered-and-non-clustered" target="_blank"&gt;part 2&lt;/a&gt; of the series, a &lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-2-clustered-and-non-clustered" target="_blank"&gt;non-clustered index&lt;/a&gt; has an overhead associated when retrieving results that include columns not part of the index, because of the lookup that is required to the table &lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-1-sql-storage-and-indexing" target="_blank"&gt;RID&lt;/a&gt; or to the &lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-2-clustered-and-non-clustered" target="_blank"&gt;clustered key value&lt;/a&gt;. There is a special situation though, where the &lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-2-clustered-and-non-clustered" target="_blank"&gt;bookmark lookup&lt;/a&gt; operation won’t be utilized. If you manage to include all columns (as key or as included columns), that are returned by a query, to your non-clustered index, the query optimizer will return the results from the index itself without any further lookup. This technique is called “covering index”. &lt;/p&gt;

&lt;p align="justify"&gt;A covering index can also be produced by the join of two &lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-2-clustered-and-non-clustered" target="_blank"&gt;non-clustered indexes&lt;/a&gt;. For example, if you setup a &lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-2-clustered-and-non-clustered" target="_blank"&gt;non-clustered index&lt;/a&gt; on column A and another &lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-2-clustered-and-non-clustered" target="_blank"&gt;non-clustered index&lt;/a&gt; on column B and execute a select statement returning these two rows, the &lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-3-queries-indexes-and-query-optimizer" target="_blank"&gt;query optimizer&lt;/a&gt; is smart enough to combine these two indexes and return the results like in a “covering index”.&lt;/p&gt;

&lt;h3 align="justify"&gt;Examine opportunities to create filtered indexes&lt;/h3&gt;

&lt;p align="justify"&gt;There is a special type of &lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-2-clustered-and-non-clustered" target="_blank"&gt;non-clustered index&lt;/a&gt;, the filtered index. To create a filtered index, you have to specify, along with your columns, a &lt;em&gt;WHERE&lt;/em&gt; clause with the filtering criteria. Filtered indexes are quite useful because they can increase the selectivity of a key column that may had not good selectivity otherwise.&amp;#160; A classic example is a column with many &lt;em&gt;NULL&lt;/em&gt; values. Creating an index by filtering out all the &lt;em&gt;NULL&lt;/em&gt; values, could increase the efficiency of the index. Another example could be a column with distinct ranges of values; In such case you could create multiple indexes with filters on these categories.&lt;/p&gt;

&lt;div&gt;
  &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 50%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;span style="color: #0000ff"&gt;CREATE&lt;/span&gt; &lt;span style="color: #0000ff"&gt;NONCLUSTERED&lt;/span&gt; &lt;span style="color: #0000ff"&gt;INDEX&lt;/span&gt; IX_DESCRIPTION_FILTERED &lt;span style="color: #0000ff"&gt;ON&lt;/span&gt; [application]&lt;br /&gt;(description &lt;span style="color: #0000ff"&gt;ASC&lt;/span&gt;) &lt;span style="color: #0000ff"&gt;WHERE&lt;/span&gt; description &lt;span style="color: #0000ff"&gt;IS&lt;/span&gt; &lt;span style="color: #0000ff"&gt;NOT&lt;/span&gt; NULL&lt;/pre&gt;
&lt;/div&gt;

&lt;div&gt;
  &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 50%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;p&gt;&lt;span style="color: #0000ff"&gt;&lt;/span&gt;&amp;#160;&lt;/p&gt;&lt;p&gt;&lt;span style="color: #0000ff"&gt;CREATE&lt;/span&gt; &lt;span style="color: #0000ff"&gt;NONCLUSTERED&lt;/span&gt; &lt;span style="color: #0000ff"&gt;INDEX&lt;/span&gt; IX_COMPUTER_ID_FILTERED &lt;span style="color: #0000ff"&gt;ON&lt;/span&gt; [application]&lt;br /&gt;(computer_id &lt;span style="color: #0000ff"&gt;ASC&lt;/span&gt;, category_id &lt;span style="color: #0000ff"&gt;ASC&lt;/span&gt;) &lt;span style="color: #0000ff"&gt;INCLUDE&lt;/span&gt; (description)&lt;br /&gt;&lt;span style="color: #0000ff"&gt;WHERE&lt;/span&gt; [category_id] &amp;gt;= 1 &lt;span style="color: #0000ff"&gt;AND&lt;/span&gt; [category_id] &amp;lt;= 15&lt;/p&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;div&gt;Since filtered indexes are operating in a subset of data, they have some significant advantages over full-table indexes:&lt;/div&gt;

&lt;div&gt;
  &lt;ul&gt;
    &lt;li&gt;Improved query performance because of their smaller size &lt;/li&gt;

    &lt;li&gt;May cost less on &lt;em&gt;INSERT, DELETE&lt;/em&gt; and &lt;em&gt;UPDATE&lt;/em&gt; statements. If a DML statement alters data that does not&amp;#160; affect the range of the filtered index, then that index needs not to be updated. &lt;/li&gt;

    &lt;li&gt;Because of their smaller size they occupy less storage space 
      &lt;br /&gt;&lt;/li&gt;
  &lt;/ul&gt;
&lt;/div&gt;

&lt;h3 align="justify"&gt;Decide on the index type&lt;/h3&gt;

&lt;p align="justify"&gt;You have to decide on the type of the indexes you want to create and there are some best practices you can follow. As explained in &lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-2-clustered-and-non-clustered" target="_blank"&gt;part 2&lt;/a&gt; of the series, a table can have only one &lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-2-clustered-and-non-clustered" target="_blank"&gt;clustered index&lt;/a&gt; and multiple &lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-2-clustered-and-non-clustered" target="_blank"&gt;non-clustered&lt;/a&gt;. A &lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-2-clustered-and-non-clustered" target="_blank"&gt;clustered index&lt;/a&gt; is best suited when you need to return large data result sets or presorted results, since table’s rows are physically sorted within the &lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-2-clustered-and-non-clustered" target="_blank"&gt;clustered index key&lt;/a&gt; order. Frequent changes to the index key columns can be quite problematic for &lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-2-clustered-and-non-clustered" target="_blank"&gt;clustered indexes&lt;/a&gt;, since DB engine needs to keep the data values of a row in physical order. This can produce &lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-1-sql-storage-and-indexing" target="_blank"&gt;page splits&lt;/a&gt; and significant IO overhead, especially in high-volume transaction processing systems, causing a serious performance hit. Note that &lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-2-clustered-and-non-clustered" target="_blank"&gt;clustered indexes&lt;/a&gt; are &lt;strong&gt;not&lt;/strong&gt; the best candidates for wide index keys, since they affect the size of all &lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-2-clustered-and-non-clustered" target="_blank"&gt;non-clustered indexes&lt;/a&gt; in the table, because &lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-2-clustered-and-non-clustered" target="_blank"&gt;non-clustered indexes&lt;/a&gt; contain the &lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-2-clustered-and-non-clustered" target="_blank"&gt;clustered index key&lt;/a&gt; value as their &lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-2-clustered-and-non-clustered" target="_blank"&gt;row locator&lt;/a&gt;. &lt;/p&gt;

&lt;p align="justify"&gt;&lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-2-clustered-and-non-clustered" target="_blank"&gt;Non-clustered indexes&lt;/a&gt;, from the other side, can be used on columns that undergo frequent updates. Wider keys can also be used, although not recommended, since their keys do not affect other indexes in the table. They are best suited for queries that do not return large data sets and especially in queries that frequently filter data that return exact matches (like &lt;em&gt;WHERE&lt;/em&gt; clauses). Covering and filtered indexes are excellent candidates for query performance improvements and should be thoroughly examined. &lt;/p&gt;

&lt;h3 align="justify"&gt;Consider Index fill factor&lt;/h3&gt;

&lt;p align="justify"&gt;An option you need to consider when creating or rebuilding indexes is the fill factor. The fill factor option sets the percentage of free space of leaf &lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-1-sql-storage-and-indexing" target="_blank"&gt;index pages&lt;/a&gt; in the affected index. For example, a fill factor of 70 means that 30% of each &lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-1-sql-storage-and-indexing" target="_blank"&gt;leaf level page&lt;/a&gt; will be left empty. Fill factor is a method to minimize &lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-1-sql-storage-and-indexing" target="_blank"&gt;page splits&lt;/a&gt; caused by intermediate row inserts and row updates. As explained in &lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-1-sql-storage-and-indexing" target="_blank"&gt;part 1&lt;/a&gt; of the series, in a full-filled &lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-1-sql-storage-and-indexing" target="_blank"&gt;index page&lt;/a&gt;, an intermediate update would cause a &lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-1-sql-storage-and-indexing" target="_blank"&gt;page split&lt;/a&gt; in order to make room for the updated rows as DB engine has to maintain the rows order. If indexes are prepopulated with some free space, these &lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-1-sql-storage-and-indexing" target="_blank"&gt;page splits&lt;/a&gt; can be reduced, thus improving performance. &lt;/p&gt;

&lt;p align="justify"&gt;You need to take into account though, that since fill factor reserves some free space to the end of the leaf level &lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-1-sql-storage-and-indexing" target="_blank"&gt;index pages&lt;/a&gt;, more pages may need to be allocated to store index columns, thus decreasing read performance. You need to examine carefully the frequency of intermediate rows update in order to figure out an appropriate fill factor. On an IDENTITY column were the key for new rows is always increasing, therefore the index rows are always added to the end of the index, &lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-1-sql-storage-and-indexing" target="_blank"&gt;page splits&lt;/a&gt; may still occur when existing rows are updated with data that lengthens the existing rows. In such cases it is wise to use a fill factor less than 100 to minimize &lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-1-sql-storage-and-indexing" target="_blank"&gt;page splits&lt;/a&gt; effect.&lt;/p&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 50%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;span style="color: #0000ff"&gt;CREATE&lt;/span&gt; &lt;span style="color: #0000ff"&gt;NONCLUSTERED&lt;/span&gt; &lt;span style="color: #0000ff"&gt;INDEX&lt;/span&gt; IX_COMPUTER_ID&lt;br /&gt;&lt;span style="color: #0000ff"&gt;ON&lt;/span&gt; [application](computer_id)&lt;br /&gt;&lt;span style="color: #0000ff"&gt;WITH&lt;/span&gt; (&lt;span style="color: #0000ff"&gt;FILLFACTOR&lt;/span&gt; = 80, PAD_INDEX = &lt;span style="color: #0000ff"&gt;ON&lt;/span&gt;)&lt;/pre&gt;

  &lt;br /&gt;&lt;/div&gt;

&lt;h3&gt;&lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-1-sql-storage-and-indexing"&gt;Part 1: SQL Storage and Indexing&lt;/a&gt;&lt;/h3&gt;

&lt;h3&gt;&lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-2-clustered-and-non-clustered"&gt;Part 2: Clustered and Non-Clustered Indexes&lt;/a&gt;&lt;/h3&gt;

&lt;h3&gt;&lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-3-queries-indexes-and-query-optimizer"&gt;Part 3: Queries, indexes and the query optimizer&lt;/a&gt;&lt;/h3&gt;&lt;img src="http://feeds.feedburner.com/~r/Itbully/~4/si-T1GkZPUI" height="1" width="1"/&gt;</description>
 <comments>http://www.itbully.com/articles/sql-indexing-and-performance-part-4-design-considerations#comments</comments>
 <category domain="http://www.itbully.com/category/tags/clustered-index">clustered index</category>
 <category domain="http://www.itbully.com/category/tags/covering-index">covering index</category>
 <category domain="http://www.itbully.com/category/tags/fill-factor">fill factor</category>
 <category domain="http://www.itbully.com/category/tags/filtered-index">filtered index</category>
 <category domain="http://www.itbully.com/category/tags/indexing">indexing</category>
 <category domain="http://www.itbully.com/category/tags/non-clustered-index">non clustered index</category>
 <category domain="http://www.itbully.com/category/tags/non-clustered-index-0">non-clustered index</category>
 <category domain="http://www.itbully.com/category/tags/sql">SQL</category>
 <category domain="http://www.itbully.com/category/tags/sql-2005">SQL 2005</category>
 <category domain="http://www.itbully.com/category/tags/sql-2008">SQL 2008</category>
 <category domain="http://www.itbully.com/category/tags/sql-database">sql database</category>
 <category domain="http://www.itbully.com/category/tags/sql-index">SQL index</category>
 <category domain="http://www.itbully.com/category/tags/sql-query-optimizer">sql query optimizer</category>
 <category domain="http://www.itbully.com/category/tags/sql-server-2010">SQL Server 2010</category>
 <category domain="http://www.itbully.com/category/tags/sql-server-index">sql server index</category>
 <category domain="http://www.itbully.com/category/tags/sql-server-page">sql server page</category>
 <category domain="http://www.itbully.com/category/tags/sql-statistics">sql statistics</category>
 <pubDate>Fri, 10 Dec 2010 08:38:28 +0000</pubDate>
 <dc:creator>Lefteris Karafilis</dc:creator>
 <guid isPermaLink="false">69 at http://www.itbully.com</guid>
<feedburner:origLink>http://www.itbully.com/articles/sql-indexing-and-performance-part-4-design-considerations</feedburner:origLink></item>
<item>
 <title>SQL Indexing and Performance Part 3: Queries, indexes and the query optimizer</title>
 <link>http://feedproxy.google.com/~r/Itbully/~3/hM9_WACYyHs/sql-indexing-and-performance-part-3-queries-indexes-and-query-optimizer</link>
 <description>&lt;h3&gt;Which columns should you choose for indexing?&lt;/h3&gt;  &lt;p align="justify"&gt;To decide on the columns of an index you have to consider the most frequent queries running against your tables. You have to examine the &lt;em&gt;WHERE&lt;/em&gt; and &lt;em&gt;JOIN&lt;/em&gt; clauses (&lt;em&gt;ORDER BY&lt;/em&gt; and&lt;em&gt; GROUP BY&lt;/em&gt; also benefit from indexes), since SQL query optimizer will try to find the best way to return the results by using a complex mechanism to evaluate available indexes and statistics. An over simplified diagram of the query optimizer’s decision making process is displayed below.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.itbully.com/sites/default/files/wlw/image_43.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.itbully.com/sites/default/files/wlw/image_thumb_43.png" width="617" height="85" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p align="justify"&gt;Given that query optimizer decides on the fate of your query execution plan, it is important to maintain useful indexes and current statistics. &lt;u&gt;It is not necessary for the query optimizer to use your indexes&lt;/u&gt;, if it finds them costly, even if those indexes are on columns stated in &lt;em&gt;WHERE, JOIN, ORDER BY&lt;/em&gt; and &lt;em&gt;GROUP BY&lt;/em&gt; statements. Consider the following example; Table &lt;em&gt;APPLICATION&lt;/em&gt; has a total of 13,235 rows and&amp;#160; a &lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-2-clustered-and-non-clustered" target="_blank"&gt;clustered index&lt;/a&gt; on &lt;em&gt;app_id&lt;/em&gt; column and a &lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-2-clustered-and-non-clustered" target="_blank"&gt;non-cluster index&lt;/a&gt; on &lt;em&gt;computer_id&lt;/em&gt; column. &lt;/p&gt;  &lt;div&gt;   &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 50%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;span style="color: #0000ff"&gt;SELECT&lt;/span&gt; computer_id, app_id, name &lt;span style="color: #0000ff"&gt;FROM&lt;/span&gt; application&lt;/pre&gt;
&lt;/div&gt;

&lt;div&gt;&lt;a href="http://www.itbully.com/sites/default/files/wlw/image_30.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.itbully.com/sites/default/files/wlw/image_thumb_30.png" width="306" height="83" /&gt;&lt;/a&gt; 

  &lt;br /&gt;&lt;/div&gt;

&lt;p align="justify"&gt;The above statement would cause the query optimizer to use a clustered index scan to return the results, since there are no filtering criteria. Consider a &lt;em&gt;WHERE&lt;/em&gt; clause on the &lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-2-clustered-and-non-clustered" target="_blank"&gt;clustered&lt;/a&gt; index key &lt;em&gt;(app_id)&lt;/em&gt;&lt;/p&gt;

&lt;div&gt;
  &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 50%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;span style="color: #0000ff"&gt;SELECT&lt;/span&gt; computer_id,app_id,name &lt;span style="color: #0000ff"&gt;FROM&lt;/span&gt; application &lt;span style="color: #0000ff"&gt;WHERE&lt;/span&gt; app_id &amp;gt; 300&lt;/pre&gt;
&lt;/div&gt;

&lt;div&gt;&amp;#160;&lt;/div&gt;

&lt;p&gt;&lt;a href="http://www.itbully.com/sites/default/files/wlw/image_31.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.itbully.com/sites/default/files/wlw/image_thumb_31.png" width="311" height="83" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p align="justify"&gt;Since there is a &lt;em&gt;WHERE&lt;/em&gt; clause in the statement, based on the clustered index key, the query optimizer decides that a clustered index seek is better than a &lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-2-clustered-and-non-clustered" target="_blank"&gt;clustered index&lt;/a&gt; scan to return a result set of 1,729 rows out of 13,235. A &lt;em&gt;WHERE&lt;/em&gt; clause on the &lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-2-clustered-and-non-clustered" target="_blank"&gt;non-clustered index&lt;/a&gt; &lt;em&gt;computer_id&lt;/em&gt; would behave differently.&lt;/p&gt;

&lt;div&gt;
  &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 50%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;span style="color: #0000ff"&gt;SELECT&lt;/span&gt; computer_id,app_id,name &lt;span style="color: #0000ff"&gt;FROM&lt;/span&gt; application &lt;span style="color: #0000ff"&gt;WHERE&lt;/span&gt; computer_id = 5000025&lt;/pre&gt;
&lt;/div&gt;

&lt;div&gt;&amp;#160;&lt;/div&gt;

&lt;p&gt;&lt;a href="http://www.itbully.com/sites/default/files/wlw/image_32.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.itbully.com/sites/default/files/wlw/image_thumb_32.png" width="290" height="87" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p align="justify"&gt;Although a &lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-2-clustered-and-non-clustered" target="_blank"&gt;non-clustered index&lt;/a&gt; exists on the column &lt;em&gt;computer_id&lt;/em&gt; defined by the &lt;em&gt;WHERE&lt;/em&gt; clause, the query optimizer decided not to use it to return 428 rows out of 13,235 because its bookmark lookup behavior would cause jumps from page-to-page and would be costlier than the scanning of the entire &lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-2-clustered-and-non-clustered" target="_blank"&gt;clustered index&lt;/a&gt;. Consider the same query with a different value after the equation.&lt;/p&gt;

&lt;div&gt;
  &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 50%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;span style="color: #0000ff"&gt;SELECT&lt;/span&gt; computer_id,app_id,name &lt;span style="color: #0000ff"&gt;FROM&lt;/span&gt; application &lt;span style="color: #0000ff"&gt;WHERE&lt;/span&gt; computer_id = 6000000&lt;/pre&gt;
&lt;/div&gt;

&lt;div&gt;&lt;a href="http://www.itbully.com/sites/default/files/wlw/image_33.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.itbully.com/sites/default/files/wlw/image_thumb_33.png" width="421" height="158" /&gt;&lt;/a&gt;&lt;/div&gt;

&lt;div align="justify"&gt;Although it is the same query with almost the same &lt;em&gt;WHERE&lt;/em&gt; clause, the query optimizer determined that it would benefit from the use of the &lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-2-clustered-and-non-clustered" target="_blank"&gt;non-clustered index&lt;/a&gt; seek as opposed to the previous example because of the high selectivity (fewer return rows) of the &lt;em&gt;WHERE&lt;/em&gt; clause.&amp;#160; &lt;/div&gt;

&lt;h3&gt;Query optimizer and statistics&lt;/h3&gt;

&lt;p align="justify"&gt;While query optimizer asses the fate of the execution plans based on statistics, it is quite logical for SQL server to create statistics automatically on the key columns of an index when it is created. The index statistics creation is mandatory and not to be confused with the&amp;#160; AUTO_CREATE_STATISTICS option (ON by default) which instructs the query optimizer to automatically create statistics on single non-indexed columns defined on query predicates (&lt;em&gt;JOIN&lt;/em&gt; and &lt;em&gt;WHERE&lt;/em&gt; clauses). Nevertheless the update of those statistics can be configured to not be updated automatically by using an &lt;em&gt;ALTER DATABASE &lt;/em&gt;statement with the AUTO_UPDATE_STATISTICS option. If automatic statistics update are left to the default setting (ON), the query optimizer, in order to optimize CPU utilization, will update statistics based on the following conditions: a table without rows gets a row, a table has fewer than 500 rows and updates 500+ rows, a table has more than 500 rows and updates 500+20% of the number of total rows.&lt;/p&gt;

&lt;p align="justify"&gt;Statistics can be configured to automatically updated either synchronously (default) or asynchronously.&amp;#160; In synchronous updates, the query optimizer is always compiles and executes the queries with up-to-date statistics as opposed to asynchronous were only subsequent queries will take benefit of the up-to-date results that completed asynchronously. As a best practice leave statistics creations and updates ON and to SYNC mode. Consider asynchronous updates when your application experiences request time outs waiting for updated statistics or when your application frequently uses the same or similar queries and cached query plans. &lt;/p&gt;

&lt;p align="justify"&gt;Although it is not recommended, you can turn off the automatic statistics update and creation process. In such cases you can use the &lt;em&gt;CREATE STATISTICS&lt;/em&gt; and &lt;em&gt;UPDATE STATISTICS&lt;/em&gt; statements to maintain statistics as needed. &lt;/p&gt;

&lt;p align="justify"&gt;All information about statistics objects are contained in the sysindexes table and in a statistics binary large object (statblob).&amp;#160; Statistics information include the number of rows in the table or index, the number of pages occupied, number of rows modified after last statistics updates,&amp;#160; time of statistics collection, number of rows used to produce the histogram, average key length, single-column histogram with the number of steps, estimated number of rows matching the filter, etc.&lt;/p&gt;

&lt;p align="justify"&gt;A histogram is a set of up to 200 values of a column. The sample or the complete set of column values are sorted and divided into up to 199 intervals so that the most statistically significant information is captured. The information on the range of index key values between two consecutive samples is called a step and contains information about:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;RANGE_HI_KEY: the most significant value of a step &lt;/li&gt;

  &lt;li&gt;EQ_ROWS: the number of rows equal to RANGE_HI_KEY &lt;/li&gt;

  &lt;li&gt;RANGE_ROWS: the range of rows between the previous RANGE_HI_KEY and the current RANGE_HI_KEY &lt;/li&gt;

  &lt;li&gt;AVG_RANGE_ROWS: The average number of rows per distinct value within RANGE_ROWS &lt;/li&gt;

  &lt;li&gt;DISTINCT_RANGE_ROWS:&amp;#160; the number of distinct rows within RANGE_ROWS &lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Why query optimizer behaved differently in the above example?&lt;/h3&gt;

&lt;p&gt;Lets analyze the statistics of the &lt;em&gt;application&lt;/em&gt; table to understand the different behavior. To find out the available statistics within application table:&lt;/p&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 50%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;sp_helpstats N&lt;span style="color: #006080"&gt;'TEST.dbo.application'&lt;/span&gt;, &lt;span style="color: #006080"&gt;'ALL'&lt;/span&gt;&lt;/pre&gt;
  &lt;a href="http://www.itbully.com/sites/default/files/wlw/image_34.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.itbully.com/sites/default/files/wlw/image_thumb_34.png" width="229" height="53" /&gt;&lt;/a&gt; 

  &lt;br /&gt;&lt;/div&gt;

&lt;p align="justify"&gt;The results indicate that two objects have been created; one for my &lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-2-clustered-and-non-clustered" target="_blank"&gt;clustered index&lt;/a&gt; &lt;em&gt;CIX_APP_ID&lt;/em&gt; on column &lt;em&gt;app_id&lt;/em&gt; and another for my &lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-2-clustered-and-non-clustered" target="_blank"&gt;non-clustered index&lt;/a&gt; &lt;em&gt;IX_COMPUTER_ID&lt;/em&gt; on column &lt;em&gt;computer_id&lt;/em&gt;. To gather some more information about these indexes:&lt;/p&gt;

&lt;div&gt;
  &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 50%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;span style="color: #0000ff"&gt;SELECT&lt;/span&gt; name, indid, minlen, xmaxlen, dpages, reserved, used,&lt;br /&gt;rowmodctr,&lt;span style="color: #0000ff"&gt;rows&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #0000ff"&gt;FROM&lt;/span&gt; sysindexes &lt;span style="color: #0000ff"&gt;WHERE&lt;/span&gt; name=&lt;span style="color: #006080"&gt;'CIX_APP_ID'&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #0000ff"&gt;OR&lt;/span&gt; name =&lt;span style="color: #006080"&gt;'IX_COMPUTER_ID'&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;div&gt;&lt;a href="http://www.itbully.com/sites/default/files/wlw/image_35.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.itbully.com/sites/default/files/wlw/image_thumb_35.png" width="464" height="56" /&gt;&lt;/a&gt; 

  &lt;br /&gt;&lt;/div&gt;

&lt;p align="justify"&gt;The results are indicating that &lt;em&gt;CIX_APP_ID&lt;/em&gt; is a &lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-2-clustered-and-non-clustered" target="_blank"&gt;clustered index&lt;/a&gt; (&lt;em&gt;indid=1&lt;/em&gt;) while &lt;em&gt;IX_COMPUTER_ID&lt;/em&gt; is a non clustered &lt;em&gt;(indid&amp;gt;1).&lt;/em&gt; Also there are some useful statistics regarding the minimum and maximum length of a row &lt;em&gt;(minlen and xmaxlen),&lt;/em&gt; the number of index pages reserved &lt;em&gt;(reserved)&lt;/em&gt; and used&lt;em&gt; (used),&lt;/em&gt; the total number of rows &lt;em&gt;(rows)&lt;/em&gt; and the total number of rows that inserted, updated or deleted since the last statistics update &lt;em&gt;(rowmodctr).&lt;/em&gt; If you recall the conditions on which the query optimizer decides to auto-update statistics, you will realize that the &lt;em&gt;CIX_APP_ID&lt;/em&gt; index won’t update its statistics until &lt;em&gt;rowmodctr&lt;/em&gt; reach the value of 500+(13235*0,20) = 3147 , meaning that 3146 (3146 – current &lt;em&gt;rowmodctr&lt;/em&gt;)updates need to take place before auto-stats fire up on that index. &lt;/p&gt;

&lt;p align="justify"&gt;If you analyze the histogram of the &lt;em&gt;IX_COMPUTER_ID&lt;/em&gt; statistics object you will realize that the query optimizer checked the&lt;em&gt; EQ_ROWS&lt;/em&gt; values and determined that the filter criteria on the &lt;em&gt;computer_id&lt;/em&gt; index key with value 5000025 would return 428 rows&lt;em&gt; (EQ_ROWS=428)&lt;/em&gt; while on the 6000000 value would return only 1 row (&lt;em&gt;EQ_ROWS=1&lt;/em&gt;), thus it determined that it would not benefit from the &lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-2-clustered-and-non-clustered" target="_blank"&gt;non-clustered index&lt;/a&gt; on the first filtering criteria.&lt;/p&gt;

&lt;div&gt;
  &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 50%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;span style="color: #0000ff"&gt;DBCC&lt;/span&gt; SHOW_STATISTICS (N&lt;span style="color: #006080"&gt;'TEST.dbo.application'&lt;/span&gt;, IX_COMPUTER_ID) &lt;/pre&gt;
&lt;/div&gt;

&lt;div&gt;&amp;#160;&lt;/div&gt;

&lt;p&gt;&lt;a href="http://www.itbully.com/sites/default/files/wlw/image_36.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.itbully.com/sites/default/files/wlw/image_thumb_36.png" width="482" height="193" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;The impact of outdated statistics on query performance&lt;/h3&gt;

&lt;p align="justify"&gt;To even better understand the impact of statistics consider the following example. In the application table there is only one row with computer_id value of 6000000. Let’s disable automatic updates on application table and add 4499 rows with computer_id value of 600000.&lt;/p&gt;

&lt;div&gt;
  &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 50%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;span style="color: #0000ff"&gt;USE&lt;/span&gt; [master]&lt;br /&gt;&lt;span style="color: #0000ff"&gt;GO&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #0000ff"&gt;ALTER&lt;/span&gt; &lt;span style="color: #0000ff"&gt;DATABASE&lt;/span&gt; [TEST] &lt;span style="color: #0000ff"&gt;SET&lt;/span&gt; AUTO_UPDATE_STATISTICS &lt;span style="color: #0000ff"&gt;OFF&lt;/span&gt; &lt;span style="color: #0000ff"&gt;WITH&lt;/span&gt; NO_WAIT&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #0000ff"&gt;DECLARE&lt;/span&gt; @&lt;span style="color: #0000ff"&gt;ROWS&lt;/span&gt; &lt;span style="color: #0000ff"&gt;INT&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #0000ff"&gt;SET&lt;/span&gt; @&lt;span style="color: #0000ff"&gt;ROWS&lt;/span&gt;=1&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #0000ff"&gt;WHILE&lt;/span&gt; (@&lt;span style="color: #0000ff"&gt;ROWS&lt;/span&gt; &amp;lt; 4499)&lt;br /&gt;&lt;span style="color: #0000ff"&gt;BEGIN&lt;/span&gt;&lt;br /&gt;INSERT &lt;span style="color: #0000ff"&gt;INTO&lt;/span&gt; TEST.dbo.application (computer_id,app_id,name) &lt;br /&gt;&lt;span style="color: #0000ff"&gt;VALUES&lt;/span&gt; (6000000,100,&lt;span style="color: #006080"&gt;'MyApp'&lt;/span&gt;)&lt;br /&gt;&lt;span style="color: #0000ff"&gt;SET&lt;/span&gt; @&lt;span style="color: #0000ff"&gt;ROWS&lt;/span&gt; = @&lt;span style="color: #0000ff"&gt;ROWS&lt;/span&gt;+1&lt;br /&gt;&lt;span style="color: #0000ff"&gt;END&lt;/span&gt;&lt;br /&gt;GO&lt;/pre&gt;
&lt;/div&gt;

&lt;div&gt;&amp;#160;&lt;/div&gt;

&lt;div&gt;If you check the histogram of the statistics you will get that key 6000000 has &lt;em&gt;EQ_ROWS=1 &lt;/em&gt;which is not true since we added 4499 rows meaning that &lt;em&gt;EQ_ROWS=4500&lt;/em&gt;.&lt;a href="http://www.itbully.com/sites/default/files/wlw/image_37.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.itbully.com/sites/default/files/wlw/image_thumb_37.png" width="535" height="165" /&gt;&lt;/a&gt; 

  &lt;br /&gt;By executing a select statement to return all rows with computer_id equal to 6000000, you get the following results&lt;/div&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 50%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;span style="color: #0000ff"&gt;SET&lt;/span&gt; &lt;span style="color: #0000ff"&gt;STATISTICS&lt;/span&gt; IO &lt;span style="color: #0000ff"&gt;ON&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #0000ff"&gt;SELECT&lt;/span&gt; computer_id,app_id,name &lt;span style="color: #0000ff"&gt;FROM&lt;/span&gt; application &lt;span style="color: #0000ff"&gt;WHERE&lt;/span&gt; computer_id = 6000000&lt;br /&gt;&lt;/pre&gt;
  &lt;a href="http://www.itbully.com/sites/default/files/wlw/image_38.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.itbully.com/sites/default/files/wlw/image_thumb_38.png" width="402" height="144" /&gt;&lt;/a&gt; 

  &lt;br /&gt;&lt;/div&gt;

&lt;p&gt;&lt;a href="http://www.itbully.com/sites/default/files/wlw/image_39.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.itbully.com/sites/default/files/wlw/image_thumb_39.png" width="564" height="45" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Consider updating the outdated statistics to check out the different results.&lt;/p&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 50%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;span style="color: #0000ff"&gt;GO&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #0000ff"&gt;UPDATE&lt;/span&gt; &lt;span style="color: #0000ff"&gt;STATISTICS&lt;/span&gt; application IX_COMPUTER_ID&lt;br /&gt;&lt;span style="color: #0000ff"&gt;GO&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #0000ff"&gt;GO&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #0000ff"&gt;SET&lt;/span&gt; &lt;span style="color: #0000ff"&gt;STATISTICS&lt;/span&gt; IO &lt;span style="color: #0000ff"&gt;ON&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #0000ff"&gt;SELECT&lt;/span&gt; computer_id,app_id,name &lt;span style="color: #0000ff"&gt;FROM&lt;/span&gt; application &lt;span style="color: #0000ff"&gt;WHERE&lt;/span&gt; computer_id = 6000000&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #0000ff"&gt;GO&lt;/span&gt; &lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;&lt;a href="http://www.itbully.com/sites/default/files/wlw/image_40.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.itbully.com/sites/default/files/wlw/image_thumb_40.png" width="290" height="81" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://www.itbully.com/sites/default/files/wlw/image_41.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.itbully.com/sites/default/files/wlw/image_thumb_41.png" width="557" height="42" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p align="justify"&gt;It is quite clear that statistics affected the query performance. While outdated statistics&amp;#160; caused the query optimizer to use a nested loop and an IO operation of 9014 logical reads, updated statistics switched query optimizer to use a &lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-2-clustered-and-non-clustered" target="_blank"&gt;clustered index scan&lt;/a&gt; with an IO operation of 217 logical reads, thus 41,5 times better performance! That’s the importance of updated IO statistics.&lt;/p&gt;

&lt;p align="justify"&gt;If the statistics automatic update option were ON but in asynchronous mode, the results on the first execution would be a nested loop join and a &lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-2-clustered-and-non-clustered" target="_blank"&gt;clustered index&lt;/a&gt; scan on the second, with the same results as above. The diagram below explains that in the first execution the current statistics for &lt;em&gt;RANGE_HI_KEY&lt;/em&gt;=6000000 were &lt;em&gt;EQ_ROWS=1 &lt;/em&gt;&amp;#160; while on the second became &lt;em&gt;EQ_ROWS=4500&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://www.itbully.com/sites/default/files/wlw/image_42.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.itbully.com/sites/default/files/wlw/image_thumb_42.png" width="569" height="263" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;&lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-1-sql-storage-and-indexing" target="_blank"&gt;PART 1: SQL Storage and Indexing&lt;/a&gt;&lt;/h3&gt;

&lt;h3&gt;&lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-2-clustered-and-non-clustered" target="_blank"&gt;PART 2: Clustered and Non-Clustered&lt;/a&gt;&lt;/h3&gt;

&lt;h3&gt;&lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-4-design-considerations" target="_blank"&gt;PART 4: Design Considerations&lt;/a&gt;&lt;/h3&gt;&lt;img src="http://feeds.feedburner.com/~r/Itbully/~4/hM9_WACYyHs" height="1" width="1"/&gt;</description>
 <comments>http://www.itbully.com/articles/sql-indexing-and-performance-part-3-queries-indexes-and-query-optimizer#comments</comments>
 <category domain="http://www.itbully.com/category/tags/query-optimizer">query optimizer</category>
 <category domain="http://www.itbully.com/category/tags/sql">SQL</category>
 <category domain="http://www.itbully.com/category/tags/sql-2005">SQL 2005</category>
 <category domain="http://www.itbully.com/category/tags/sql-2008">SQL 2008</category>
 <category domain="http://www.itbully.com/category/tags/sql-database">sql database</category>
 <category domain="http://www.itbully.com/category/tags/sql-index">SQL index</category>
 <category domain="http://www.itbully.com/category/tags/sql-query-optimizer">sql query optimizer</category>
 <category domain="http://www.itbully.com/category/tags/sql-server-2010">SQL Server 2010</category>
 <category domain="http://www.itbully.com/category/tags/sql-server-index">sql server index</category>
 <category domain="http://www.itbully.com/category/tags/sql-server-page">sql server page</category>
 <category domain="http://www.itbully.com/category/tags/sql-statistics">sql statistics</category>
 <pubDate>Mon, 06 Dec 2010 09:34:26 +0000</pubDate>
 <dc:creator>Lefteris Karafilis</dc:creator>
 <guid isPermaLink="false">67 at http://www.itbully.com</guid>
<feedburner:origLink>http://www.itbully.com/articles/sql-indexing-and-performance-part-3-queries-indexes-and-query-optimizer</feedburner:origLink></item>
<item>
 <title>SQL Indexing and Performance Part 2: Clustered and Non-Clustered</title>
 <link>http://feedproxy.google.com/~r/Itbully/~3/lvqgDQy6tdc/sql-indexing-and-performance-part-2-clustered-and-non-clustered</link>
 <description>&lt;h3&gt;So, why do you need to index your tables?&lt;/h3&gt;  &lt;p align="justify"&gt;Because without an index SQL server has to scan entire tables to return requested data. It is like the index page in a book. You check for the keyword you want to read about in the index and you jump directly to the page were the content belongs, instead of scanning page by page for the material you want to read. &lt;/p&gt;  &lt;p align="justify"&gt;Similarly a table index allows you to locate data without the need to scan the entire table. You create indexes on one or more columns in a table to help SQL server find the data quickly in a query. Consider the following example:&lt;/p&gt;  &lt;div id="codeSnippetWrapper"&gt;   &lt;div id="codeSnippetWrapper"&gt;     &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 50%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;span style="color: #0000ff"&gt;SELECT&lt;/span&gt; [computer_id],[nic_device_id],[nic_vendor_id],[nic_desc]&lt;br /&gt;&lt;span style="color: #0000ff"&gt;FROM&lt;/span&gt; [eXpress].[dbo].[nics]&lt;/pre&gt;
  &lt;/div&gt;

  &lt;div&gt;&amp;#160;&lt;/div&gt;
&lt;/div&gt;

&lt;div&gt;&lt;a href="http://www.itbully.com/sites/default/files/wlw/image_24.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.itbully.com/sites/default/files/wlw/image_thumb_24.png" width="507" height="146" /&gt;&lt;/a&gt; 

  &lt;br /&gt;&lt;/div&gt;

&lt;p align="justify"&gt;If you were to retrieve&amp;#160; all computers with &lt;em&gt;computer_id &amp;gt; 5100&lt;/em&gt;, SQL would have to check the entire table to return the results without the presence of an index. An index on the &lt;em&gt;computer_id&lt;/em&gt; column would speed up this process by sorting the column values.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://www.itbully.com/sites/default/files/wlw/image_25.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.itbully.com/sites/default/files/wlw/image_thumb_25.png" width="502" height="138" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p align="justify"&gt;Now, if you wanted to return all data where &lt;em&gt;computer_id &amp;gt; 5100&lt;/em&gt;, SQL would know that it have to move down to the first value greater than 5100 since the column is sorted. This eliminates the need to scan the entire table, thus resulting great performance benefits.&lt;/p&gt;

&lt;h3&gt;Index Types&lt;/h3&gt;

&lt;p&gt;There are two main index types; Clustered index and Non-Clustered index.&lt;/p&gt;

&lt;p align="justify"&gt;A clustered index alters the way that the rows are stored. When you create a clustered index on a column (or a number of columns), SQL server sorts the table’s rows by that column(s). It is like a dictionary, where all words are sorted in alphabetical order in the entire book. Since it alters the physical storage of the table, only one clustered index can be created per table. In the above example the entire rows are sorted by &lt;em&gt;computer_id&lt;/em&gt; since a clustered index on computer_id column has been created.&lt;/p&gt;

&lt;div&gt;
  &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 50%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;span style="color: #0000ff"&gt;CREATE&lt;/span&gt; &lt;span style="color: #0000ff"&gt;CLUSTERED&lt;/span&gt; &lt;span style="color: #0000ff"&gt;INDEX&lt;/span&gt; [IX_CLUSTERED_COMPUTER_ID] &lt;br /&gt;&lt;span style="color: #0000ff"&gt;ON&lt;/span&gt; [dbo].[nics] ([computer_id] &lt;span style="color: #0000ff"&gt;ASC&lt;/span&gt;)&lt;br /&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p align="justify"&gt;A non-clustered index, on the other hand, does not alter the way the rows are stored in the table. It creates a completely different object within the table that contains the column(s) selected for indexing and a pointer back to the table’s rows containing the data. It is like an index in the last pages of a book, where keywords are sorted and contain the page number to the material of the book for faster reference. A non-clustered index on the computer_id in the previous example would look like the table below:&lt;/p&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 50%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;span style="color: #0000ff"&gt;CREATE&lt;/span&gt; &lt;span style="color: #0000ff"&gt;NONCLUSTERED&lt;/span&gt; &lt;span style="color: #0000ff"&gt;INDEX&lt;/span&gt; [IX_NONCLUSTERED_COMPUTER_ID] &lt;br /&gt;&lt;span style="color: #0000ff"&gt;ON&lt;/span&gt; [dbo].[nics] ([computer_id] &lt;span style="color: #0000ff"&gt;ASC&lt;/span&gt;)&lt;/pre&gt;
&lt;/div&gt;

&lt;div&gt;&amp;#160;&lt;/div&gt;

&lt;table border="1" cellspacing="0" cellpadding="2" width="181"&gt;&lt;tbody&gt;
    &lt;tr&gt;
      &lt;td valign="top" width="86"&gt;Computer_id&lt;/td&gt;

      &lt;td valign="top" width="93"&gt;Row Locator&lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td valign="top" width="86"&gt;5000025&lt;/td&gt;

      &lt;td valign="top" width="93"&gt;234&lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td valign="top" width="86"&gt;5000031&lt;/td&gt;

      &lt;td valign="top" width="93"&gt;345&lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td valign="top" width="86"&gt;5000045&lt;/td&gt;

      &lt;td valign="top" width="93"&gt;112&lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td valign="top" width="86"&gt;5000046&lt;/td&gt;

      &lt;td valign="top" width="93"&gt;348&lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td valign="top" width="86"&gt;5000055&lt;/td&gt;

      &lt;td valign="top" width="93"&gt;234&lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td valign="top" width="86"&gt;5000059&lt;/td&gt;

      &lt;td valign="top" width="93"&gt;984&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;&lt;/table&gt;

&lt;p align="justify"&gt;SQL server sorts the indexes efficiently by using a &lt;a href="http://en.wikipedia.org/wiki/B-tree" target="_blank"&gt;B-tree&lt;/a&gt;, which is a tree data structure that allows SQL Server to keep data sorted, to allow searches, sequential access, insertions and deletions in logarithmic &lt;a href="http://en.wikipedia.org/wiki/Amortized_analysis" target="_blank"&gt;amortized time&lt;/a&gt;. This methodology minimizes the number of pages accessed to locate the desired index key, therefore resulting an improved performance.&lt;/p&gt;

&lt;h3&gt;Relation between clustered and non-clustered indexes &lt;/h3&gt;

&lt;p align="justify"&gt;As explained above a non-clustered index contains a pointer back to the rowID (&lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-1-sql-storage-and-indexing" target="_blank"&gt;RID&lt;/a&gt;) of the table in order to relate the index column with the rest of the columns of a row. But this is not always the case. If a clustered index exist on the table, the non-clustered index instead of &lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-1-sql-storage-and-indexing" target="_blank"&gt;RID&lt;/a&gt; references is using the clustered index’s key as a row locator. In the above example if a clustered index is created on &lt;em&gt;nic_desc&lt;/em&gt; and a non-clustered on &lt;em&gt;computer_id,&lt;/em&gt; the non-clustered index would look like the table below.&lt;/p&gt;

&lt;table border="1" cellspacing="0" cellpadding="2" width="388"&gt;&lt;tbody&gt;
    &lt;tr&gt;
      &lt;td valign="top" width="86"&gt;Computer_id&lt;/td&gt;

      &lt;td valign="top" width="300"&gt;Row Locator&lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td valign="top" width="86"&gt;5000025&lt;/td&gt;

      &lt;td valign="top" width="300"&gt;VMware Accelerated AMD PCNet Adapter&lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td valign="top" width="86"&gt;5000031&lt;/td&gt;

      &lt;td valign="top" width="300"&gt;Intel(R) PRO/100 VE Network Connection&lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td valign="top" width="86"&gt;5000045&lt;/td&gt;

      &lt;td valign="top" width="300"&gt;Broadcom 440x 10/100 Integrated Controller&lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td valign="top" width="86"&gt;5000046&lt;/td&gt;

      &lt;td valign="top" width="300"&gt;Broadcom NetXtreme 57xx Gigabit Controller&lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td valign="top" width="86"&gt;5000055&lt;/td&gt;

      &lt;td valign="top" width="300"&gt;VMware Accelerated AMD PCNet Adapter&lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td valign="top" width="86"&gt;5000059&lt;/td&gt;

      &lt;td valign="top" width="300"&gt;Broadcom 440x 10/100 Integrated Controller&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;&lt;/table&gt;

&lt;h3&gt;Index Benefits and Side Effects&lt;/h3&gt;

&lt;p align="justify"&gt;A table without a clustered-index is called a &lt;em&gt;“heap table”.&lt;/em&gt; A heap table has no sorted data thus SQL server has to scan the entire table in order to locate the data in a process called a &lt;em&gt;“scan”.&lt;/em&gt; In the case of a clustered index the data are sorted on the key values (columns) of the index. SQL server is now able to locate the data by navigating down from the root node, to the branch and finally to the leaf nodes of the &lt;a href="http://en.wikipedia.org/wiki/B-tree" target="_blank"&gt;B-tree&lt;/a&gt; structure of the index, in a process called a &lt;em&gt;“seek”.&lt;/em&gt; The later approach is much faster when you want to filter or sort the data you want to retrieve. &lt;/p&gt;

&lt;p align="justify"&gt;A non-clustered index from the other side is a completely different object in a table, containing only a subset of columns and a row locator to the table’s rows or to the clustered index’s key. Because of its smaller size (subset of columns), a clustered index can fit more rows in an &lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-1-sql-storage-and-indexing" target="_blank"&gt;index page&lt;/a&gt; , therefore resulting an improved I/O performance. Furthermore a non-clustered index can be allocated to a different &lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-1-sql-storage-and-indexing" target="_blank"&gt;FileGroup&lt;/a&gt; which can utilize a different physical storage in order to improve performance even more.&lt;/p&gt;

&lt;p align="justify"&gt;The side effect of indexes is related to the cost of &lt;em&gt;INSERT&lt;/em&gt;, &lt;em&gt;UPDATE, MERGE&lt;/em&gt; and &lt;em&gt;DELETE&lt;/em&gt; statements. Such statements can take longer to execute in the presence of indexes since they alter the data on the table resulting the update of the indexes too. Imagine the situation of an &lt;em&gt;INSERT&lt;/em&gt; statement that has to add rows to a table with a clustered index. Table rows may need to be repositioned since clustered index needs to order the data pages themselves thus creating more overhead. So, it is crucial to take into account the overhead of &lt;em&gt;INSERT&lt;/em&gt;, &lt;em&gt;UPDATE&lt;/em&gt; and &lt;em&gt;DELETE&lt;/em&gt; statements before designing your indexing strategy. Although there is an overhead in the above statements, you have to take into account that many times an &lt;em&gt;UPDATE&lt;/em&gt; or &lt;em&gt;DELETE&lt;/em&gt; statement will have to execute in a subset of data, defined by a WHERE clause, were indexing may outweigh the additional cost of index updates since SQL server has to find the data before updating them.&lt;/p&gt;

&lt;p align="justify"&gt;As explained above a non-clustered index includes the clustered index’s key as its row locator in the case of a clustered index existence on the table; and this comes with a cost and a benefit. The cost has to do with non-clustered index &lt;em&gt;bookmark lookup&lt;/em&gt;. What if a query has to return more rows that the ones hosted in the index itself? In the case of a &lt;em&gt;HEAP&lt;/em&gt; table, SQL would check the &lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-1-sql-storage-and-indexing" target="_blank"&gt;RID&lt;/a&gt; of the non-clustered index to navigate directly to the row, were the rest of the columns belong in order to return the results. In the case of a clustered index, SQL would check the row locator of the non-clustered index to do an additional navigation to the &lt;a href="http://en.wikipedia.org/wiki/B-tree" target="_blank"&gt;B-tree&lt;/a&gt; structure of the clustered index to retrieve the desired row, since row locator does not contain the &lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-1-sql-storage-and-indexing" target="_blank"&gt;RID&lt;/a&gt; but the clustered-index key.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://www.itbully.com/sites/default/files/wlw/image_26.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.itbully.com/sites/default/files/wlw/image_thumb_26.png" width="593" height="178" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p align="justify"&gt;But there is also a benefit of the above relation, between clustered and non-clustered indexes, that has to do with clustered index updates. Imagine the following situation; Two new rows with index key values of A2 and A3 have to be added in the clustered index below.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://www.itbully.com/sites/default/files/wlw/image_27.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.itbully.com/sites/default/files/wlw/image_thumb_27.png" width="490" height="49" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p align="justify"&gt;Since this is a clustered index page, its physical structure has to be reallocated in order to fit A2 and A3 between A1 and A4 to maintain index order. Since there is no free space in the index page to accommodate changes,&amp;#160; a &lt;em&gt;page split&lt;/em&gt; will occur . Now, there is enough space to fit A2 and A3 between A1 and A4.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://www.itbully.com/sites/default/files/wlw/image_28.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.itbully.com/sites/default/files/wlw/image_thumb_28.png" width="474" height="231" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p align="justify"&gt;The target achieved and the order maintained within the index. But imagine what would happen if the non-clustered index were looking at the &lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-1-sql-storage-and-indexing" target="_blank"&gt;RID&lt;/a&gt; instead of the clustered index key. It would have to change its row locator table to reflect the changes which could be a huge performance hit in case of large clustered indexes. Since row locator table looks at the clustered index key, it does not have to change its values. This is quite a benefit if you imagine the large clustered indexes usually maintained on many tables.&lt;/p&gt;

&lt;h3&gt;Clustered indexes VS non-clustered indexes&lt;/h3&gt;

&lt;table border="1" cellspacing="0" cellpadding="2" width="656"&gt;&lt;tbody&gt;
    &lt;tr&gt;
      &lt;td valign="top" width="133"&gt;&amp;#160;&lt;/td&gt;

      &lt;td valign="top" width="264"&gt;CLUSTERED&lt;/td&gt;

      &lt;td valign="top" width="257"&gt;NON-CLUSTERED&lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td valign="top" width="133"&gt;PROS&lt;/td&gt;

      &lt;td valign="top" width="264"&gt;
        &lt;ul&gt;
          &lt;li&gt;Fast to return large range of data &lt;/li&gt;

          &lt;li&gt;Fast for presorted results &lt;/li&gt;
        &lt;/ul&gt;
      &lt;/td&gt;

      &lt;td valign="top" width="257"&gt;
        &lt;ul&gt;
          &lt;li&gt;Wide keys do not reflect on other indexes &lt;/li&gt;

          &lt;li&gt;Frequently updated key columns do not reflect on other indexes &lt;/li&gt;

          &lt;li&gt;Can be assigned on different &lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-1-sql-storage-and-indexing" target="_blank"&gt;FileGroup&lt;/a&gt; &lt;/li&gt;

          &lt;li&gt;Many non-clustered indexes per table &lt;/li&gt;

          &lt;li&gt;Smaller size than clustered indexes due to column subsets &lt;/li&gt;
        &lt;/ul&gt;
      &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;td valign="top" width="133"&gt;CONS&lt;/td&gt;

      &lt;td valign="top" width="264"&gt;
        &lt;ul&gt;
          &lt;li&gt;Frequently updated key columns reflect on non-clustered indexes &lt;/li&gt;

          &lt;li&gt;Wide keys increase the size of the non-clustered indexes &lt;/li&gt;

          &lt;li&gt;Only one clustered index per table &lt;/li&gt;
        &lt;/ul&gt;
      &lt;/td&gt;

      &lt;td valign="top" width="257"&gt;
        &lt;ul&gt;
          &lt;li&gt;Generally slower than clustered indexes due to bookmark lookup (except for covering indexes). &lt;/li&gt;

          &lt;li&gt;Not recommended for returning large data sets (except for covering indexes). &lt;/li&gt;
        &lt;/ul&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;&lt;/table&gt;



&lt;h3&gt;&lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-1-sql-storage-and-indexing" target="_blank"&gt;Part 1: SQL Storage and Indexing&lt;/a&gt; 

  &lt;br /&gt;&lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-3-queries-indexes-and-query-optimizer" target="_blank"&gt;Part 3: Queries, indexes and the query optimizer&lt;/a&gt;

  &lt;br /&gt;&lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-4-design-considerations" target="_blank"&gt;Part 4: Design Considerations&lt;/a&gt;&lt;/h3&gt;&lt;img src="http://feeds.feedburner.com/~r/Itbully/~4/lvqgDQy6tdc" height="1" width="1"/&gt;</description>
 <comments>http://www.itbully.com/articles/sql-indexing-and-performance-part-2-clustered-and-non-clustered#comments</comments>
 <category domain="http://www.itbully.com/category/tags/clustered-index">clustered index</category>
 <category domain="http://www.itbully.com/category/tags/non-clustered-index">non clustered index</category>
 <category domain="http://www.itbully.com/category/tags/non-clustered-index-0">non-clustered index</category>
 <category domain="http://www.itbully.com/category/tags/page">Page</category>
 <category domain="http://www.itbully.com/category/tags/page-split">Page Split</category>
 <category domain="http://www.itbully.com/category/tags/rid">RID</category>
 <category domain="http://www.itbully.com/category/tags/row-locator">row locator</category>
 <category domain="http://www.itbully.com/category/tags/sql">SQL</category>
 <category domain="http://www.itbully.com/category/tags/sql-2005">SQL 2005</category>
 <category domain="http://www.itbully.com/category/tags/sql-2008">SQL 2008</category>
 <category domain="http://www.itbully.com/category/tags/sql-database">sql database</category>
 <category domain="http://www.itbully.com/category/tags/sql-index">SQL index</category>
 <category domain="http://www.itbully.com/category/tags/sql-query-optimizer">sql query optimizer</category>
 <category domain="http://www.itbully.com/category/tags/sql-server-2010">SQL Server 2010</category>
 <category domain="http://www.itbully.com/category/tags/sql-server-index">sql server index</category>
 <category domain="http://www.itbully.com/category/tags/sql-server-page">sql server page</category>
 <category domain="http://www.itbully.com/category/tags/sql-statistics">sql statistics</category>
 <pubDate>Wed, 01 Dec 2010 09:22:05 +0000</pubDate>
 <dc:creator>Lefteris Karafilis</dc:creator>
 <guid isPermaLink="false">66 at http://www.itbully.com</guid>
<feedburner:origLink>http://www.itbully.com/articles/sql-indexing-and-performance-part-2-clustered-and-non-clustered</feedburner:origLink></item>
<item>
 <title>SQL Indexing and Performance Part 1: SQL Storage and Indexing</title>
 <link>http://feedproxy.google.com/~r/Itbully/~3/HzaTcQoNQMo/sql-indexing-and-performance-part-1-sql-storage-and-indexing</link>
 <description>&lt;p&gt;Before we begin our journey in SQL Indexing it is important to understand how SQL Server stores data. &lt;/p&gt;  &lt;h3&gt;Database FileGroups and Files&lt;/h3&gt;  &lt;p align="justify"&gt;A MS SQL database is always using an .mdf file as the primary data file, a number of .ldf files as transaction logs, and optionally a number of .ndf files as secondary data files. Data files (.mdf and .ndf) may be organized to FileGroups for management and allocation purposes. By default the first group that is automatically created is called “Primary File Group” and each .mdf and .ndf file that is allocated it belongs to that group. System tables and the primary data file of a database are always belonging to the “Primary File Group”. Secondary data files may be assigned to a user file group by using the FILEGROUP keyword in a CREATE or ALTER DATABASE statement.&lt;/p&gt;  &lt;h3&gt;Pages and extents&lt;/h3&gt;  &lt;p align="justify"&gt;The fundamental unit of storage in SQL server is the page. A page is always 8KB long and it is allocated at the primary and secondary data files. I/O operations are performed at the page level and for SQL server to efficiently manage the pages; it groups them to a total of 8 contiguous data pages in a unit called extent. Note, that log files are not divided into pages since they consist of a series of log records.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.itbully.com/sites/default/files/wlw/image_18.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.itbully.com/sites/default/files/wlw/image_thumb_18.png" width="430" height="262" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;h3&gt;Extent Types&lt;/h3&gt;  &lt;p align="justify"&gt;Extents are subdivided in mixed and uniform extents. A uniform extent contains pages from a single object while a mixed extent contains pages from various objects. Since an extent is always contain 8 pages, a mixed type extent can contain up to 8 different page object owners.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.itbully.com/sites/default/files/wlw/image_19.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.itbully.com/sites/default/files/wlw/image_thumb_19.png" width="626" height="193" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p align="justify"&gt;Pages from a new table or index are usually allocated to a mixed extent unless you create an index on an existing table that has enough rows to generate 8 pages; in that case it is going to be allocated in a uniform extent. As a table or index, which initially allocated to a mixed extent, grows to a point that it has 8 pages; it switches to use uniform extents for subsequent allocations.&lt;/p&gt;  &lt;h3&gt;Page Types&lt;/h3&gt;  &lt;p&gt;Like extents pages are subdivided into categories: &lt;i&gt;data pages, index pages, large object pages and other pages.&lt;/i&gt;&lt;/p&gt;  &lt;p align="justify"&gt;Data pages store all data values except those typed as large types such &lt;i&gt;text, xml, varchar(max),&lt;/i&gt; etc which are stored in the large object pages. Since SQL server data rows cannot span multiple data pages, large types are stored in a different page, the large object page, and are referred by a small pointer in the original data page. Some data types like &lt;i&gt;varchar&lt;/i&gt; and &lt;i&gt;varbinary&lt;/i&gt;, although can grow large, may be stored in the original data or index page if the row does not exceed the 8KB page limit. SQL server can dynamically move forth and back such columns between data page and large object page according to the row size limit. &lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.itbully.com/sites/default/files/wlw/image_20.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.itbully.com/sites/default/files/wlw/image_thumb_20.png" width="638" height="85" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p align="justify"&gt;Index pages store index entries like the index keys and some additional information used by SQL server to locate data and manage index process while other pages are special pages that used by SQL server to store configuration information like index application map, bulk changes map, etc.&lt;/p&gt;  &lt;h3&gt;Data Page Structure&lt;/h3&gt;  &lt;p align="justify"&gt;A data page consists of the 96-byte page header, the data rows and the data row offsets. Page header existence is important because it stores necessary information about the page including the page number, page type, the amount of page’s free space, pointers to the previous and next pages (in case pages are linked together) and the allocation unit ID of the page object owner.&lt;/p&gt;  &lt;p align="justify"&gt;Row offsets table contains 2-byte information about each row in the table, meaning the row number and the row offset byte address in the page. Since our first element in a page is the 96-byte header, the first row in the page is at byte offset 96. If a page has 3 rows, 30 byte long each (including overhead), then the second row will be at offset 96+30=126 and the third at 126+30=156.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.itbully.com/sites/default/files/wlw/image_21.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.itbully.com/sites/default/files/wlw/image_thumb_21.png" width="355" height="389" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;h3&gt;&lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-2-clustered-and-non-clustered" target="_blank"&gt;Non-clustered&lt;/a&gt; indexes and data page relationship&lt;/h3&gt;  &lt;p align="justify"&gt;This information is particularly important in the case of non-clustered indexes because such indexes may store a pointer to the data rows in their leaf-level index pages. This pointer is called row ID (RID) and includes information about the file ID, the page ID and the row ID. Each time a &lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-2-clustered-and-non-clustered" target="_blank"&gt;non-clustered&lt;/a&gt; index refers to a row by RID, it is going to ask for a row number, at a specific page (ID) in a specific file (ID). SQL server then is going to refer to the row offset table to retrieve the desired row by using the byte offset of the desired row. Thanks to the offset table, a row can change position in a page without the need to change the RID. For example, if ROW0 were deleted, SQL server may move ROW2 to ROW0 to keep the contiguous of free space in case of a new row insert. The ID of ROW2 would remain the same although the byte offset would change from 156 to 96 to accommodate the row movement to the different slot in the data page.&lt;/p&gt;  &lt;h3&gt;Indexes and index page performance&lt;/h3&gt;  &lt;p align="justify"&gt;As previously mentioned indexes are stored in index pages separately from data pages, which means that they can allocated to different FileGroups and even stored to different physical HDD from the original data pages to improve performance. &lt;/p&gt;  &lt;p align="justify"&gt;Since I/O operations are performed at the page level, it is important for an index to allocate as many rows as possible per index page. To achieve this you need to consider the index column type and the number of columns in a composite index. Thus it is best to use narrow index keys like INT instead of larger ones and to split large composite keys to smaller chunks whenever possible to accommodate more rows in an index page. &lt;/p&gt;  &lt;p align="justify"&gt;Index &lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-2-clustered-and-non-clustered" target="_blank"&gt;page splitting&lt;/a&gt; can cause index page fragmentation resulting reduced performance. Thus it is important to take into account index defragmentation. Data &lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-2-clustered-and-non-clustered" target="_blank"&gt;page splitting&lt;/a&gt; can also affect index performance particularly in non-clustered indexes because of the bookmarking at the leaf level of the index. Consider the following example; you want to retrieve column A, B, C and D from Table T1 and you have a non-clustered index on column B. While fetching the data, SQL is looking at your index and decides to use that index to filter returning data. For each matching row in the index, SQL has to jump back to the data page to retrieve column A, C and D. If there is a page split on the data pages, SQL has to do one more jump to the next page to successfully retrieve all rows.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.itbully.com/sites/default/files/wlw/image_23.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.itbully.com/sites/default/files/wlw/image_thumb_23.png" width="599" height="177" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;h3&gt;&lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-2-clustered-and-non-clustered" target="_blank"&gt;Part 2: Clustered and Non-Clustered Indexes&lt;/a&gt;     &lt;br /&gt;&lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-3-queries-indexes-and-query-optimizer" target="_blank"&gt;Part 3: Queries, indexes and the query optimizer&lt;/a&gt;    &lt;br /&gt;&lt;a href="http://www.itbully.com/articles/sql-indexing-and-performance-part-4-design-considerations" target="_blank"&gt;Part 4: Design Considerations&lt;/a&gt;&lt;/h3&gt;&lt;img src="http://feeds.feedburner.com/~r/Itbully/~4/HzaTcQoNQMo" height="1" width="1"/&gt;</description>
 <comments>http://www.itbully.com/articles/sql-indexing-and-performance-part-1-sql-storage-and-indexing#comments</comments>
 <category domain="http://www.itbully.com/category/tags/clustered-index">clustered index</category>
 <category domain="http://www.itbully.com/category/tags/indexing">indexing</category>
 <category domain="http://www.itbully.com/category/tags/non-clustered-index">non clustered index</category>
 <category domain="http://www.itbully.com/category/tags/non-clustered-index-0">non-clustered index</category>
 <category domain="http://www.itbully.com/category/tags/page">Page</category>
 <category domain="http://www.itbully.com/category/tags/page-split">Page Split</category>
 <category domain="http://www.itbully.com/category/tags/rid">RID</category>
 <category domain="http://www.itbully.com/category/tags/row-locator">row locator</category>
 <category domain="http://www.itbully.com/category/tags/sql">SQL</category>
 <category domain="http://www.itbully.com/category/tags/sql-2005">SQL 2005</category>
 <category domain="http://www.itbully.com/category/tags/sql-2008">SQL 2008</category>
 <category domain="http://www.itbully.com/category/tags/sql-database">sql database</category>
 <category domain="http://www.itbully.com/category/tags/sql-index">SQL index</category>
 <category domain="http://www.itbully.com/category/tags/sql-query-optimizer">sql query optimizer</category>
 <category domain="http://www.itbully.com/category/tags/sql-server-2010">SQL Server 2010</category>
 <category domain="http://www.itbully.com/category/tags/sql-server-index">sql server index</category>
 <category domain="http://www.itbully.com/category/tags/sql-server-page">sql server page</category>
 <category domain="http://www.itbully.com/category/tags/sql-statistics">sql statistics</category>
 <pubDate>Mon, 29 Nov 2010 11:35:00 +0000</pubDate>
 <dc:creator>Lefteris Karafilis</dc:creator>
 <guid isPermaLink="false">65 at http://www.itbully.com</guid>
<feedburner:origLink>http://www.itbully.com/articles/sql-indexing-and-performance-part-1-sql-storage-and-indexing</feedburner:origLink></item>
<item>
 <title>Install WebMatrix helpers to your ASP.NET MVC 3 project with NuGet</title>
 <link>http://feedproxy.google.com/~r/Itbully/~3/iy5ORArNlRY/install-webmatrix-helpers-your-aspnet-mvc-3-project-nuget</link>
 <description>&lt;p&gt;You may have noticed that there are some cool helpers in WebMatrix that you may want to use in your current ASP.NET MVC 3 project. The good thing is that you can use them. The only thing you have to do is just download them with NuGet.&lt;/p&gt;
&lt;!--break--&gt;&lt;!--break--&gt;&lt;p&gt;As you already know, if you read the &lt;a title="NuGet Package Management for .NET" href="http://www.itbully.com/articles/nuget-package-management-net" target="_blank"&gt;article about NuGet&lt;/a&gt;, is that you can have multiple feed sources for NuGet packages. So you only have to found a NuGet feed that includes all these helpers. This is not so difficult because Microsoft have created this feed for us. You can find the feed in this address (&lt;a href="http://go.microsoft.com/fwlink/?LinkID=205388" target="_blank"&gt;http://go.microsoft.com/fwlink/?LinkID=205388&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;In order to add the feed in your Visual Studio 2010 Package Sources you have to go to &lt;strong&gt;Tools &amp;gt; Options &amp;gt; Package Manager &amp;gt; General&lt;/strong&gt; &lt;/p&gt;
&lt;p&gt;
&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto; padding-top: 0px" title="NuGetFeed" border="0" alt="NuGetFeed" src="http://www.itbully.com/sites/default/files/wlw/NuGetFeed.png" width="604" height="353" /&gt; &lt;/p&gt;
&lt;p&gt;There you can add a new Item in the list. Enter a name in the “Name” textbox, in the “Source textbox” enter the feed address (&lt;a href="http://go.microsoft.com/fwlink/?LinkID=205388" target="_blank"&gt;http://go.microsoft.com/fwlink/?LinkID=205388&lt;/a&gt;) and click “Add” button. You will see that a new line has been added in the “Available package sources” listbox.&lt;/p&gt;
&lt;p&gt;After that it is very easy to add the Helpers in your project. Go to &lt;strong&gt;Package Manager Console&lt;/strong&gt;, select your new feed from “Package source” combobox and write &lt;strong&gt;List-Package &lt;/strong&gt;to console window. You will see all available packages so you can very easily add a Helper to your project just by writing &lt;strong&gt;Install-Package “Package-Name”&lt;/strong&gt; (ex &lt;strong&gt;Install-Package Twitter.Helper &lt;/strong&gt;) &lt;span style="color: #ffffff"&gt;&amp;lt;!--abc760bb4c5a4fc6881d892923e732d4--&amp;gt;&lt;/span&gt; &lt;/p&gt;
&lt;p&gt;
&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto; padding-top: 0px" title="ListPackage" border="0" alt="ListPackage" src="http://www.itbully.com/sites/default/files/wlw/ListPackage.png" width="604" height="203" /&gt; &lt;/p&gt;
&lt;p&gt;
&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto; padding-top: 0px" title="InstallPackage" border="0" alt="InstallPackage" src="http://www.itbully.com/sites/default/files/wlw/InstallPackage.png" width="604" height="126" /&gt; &lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/Itbully/~4/iy5ORArNlRY" height="1" width="1"/&gt;</description>
 <comments>http://www.itbully.com/articles/install-webmatrix-helpers-your-aspnet-mvc-3-project-nuget#comments</comments>
 <category domain="http://www.itbully.com/category/tags/net">.NET</category>
 <category domain="http://www.itbully.com/category/tags/aspnet-mvc-3">ASP.NET MVC 3</category>
 <category domain="http://www.itbully.com/category/tags/nuget">NuGet</category>
 <category domain="http://www.itbully.com/category/tags/nuget-feed">nuget feed</category>
 <category domain="http://www.itbully.com/category/tags/package-management">Package Management</category>
 <category domain="http://www.itbully.com/category/tags/webmatrix">WebMatrix</category>
 <category domain="http://www.itbully.com/category/tags/webmatrix-feed">webmatrix feed</category>
 <pubDate>Fri, 19 Nov 2010 15:52:00 +0000</pubDate>
 <dc:creator>George Chatzimanolis</dc:creator>
 <guid isPermaLink="false">62 at http://www.itbully.com</guid>
<feedburner:origLink>http://www.itbully.com/articles/install-webmatrix-helpers-your-aspnet-mvc-3-project-nuget</feedburner:origLink></item>
<item>
 <title>NuGet Package Management for .NET</title>
 <link>http://feedproxy.google.com/~r/Itbully/~3/uxiMWVcx86E/nuget-package-management-net</link>
 <description>&lt;div class="description"&gt;
&lt;p&gt;Most of us use third-party libraries when developing a web project, so you can easily understand how difficult is sometimes to find the latest version of the library you need, keep it updated or even uninstall it easily without having to spend two hours in order to remove dependencies and delete unnecessary code. If these are your needs then you should check NuGet.&lt;/p&gt;
&lt;!--break--&gt;&lt;!--break--&gt;&lt;h3&gt;NuGet&lt;/h3&gt;
&lt;p&gt;NuGet is a free open source package manager, created as a Visual Studio 2010 extension, which enables you to install, uninstall and upgrade open source packages into your application very easily. So for example if you want to add Ninject or ELMAH in your project, you only have to use NuGet and add the package to your project without even leaving Visual Studio 2010.&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;NuGet (formerly known as NuPack) is a free, open source developer focused package management system for the .NET platform.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;You can download the .vsix extension at &lt;a title="NuGet" href="http://nuget.codeplex.com" rel="nofollow" target="_blank"&gt;http://nuget.codeplex.com&lt;/a&gt; or you can install ASP.NET MVC 3 RC which installs NuGet as part of the setup.&lt;/p&gt;
&lt;p&gt;
&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto; padding-top: 0px" title="nuget-download" border="0" alt="nuget-download" src="http://www.itbully.com/sites/default/files/wlw/nuget-download.png" width="418" height="283" /&gt;
&lt;/p&gt;
&lt;p&gt;After installing it you can start adding packages to your project in two ways. The first way is from Visual Studio Solution Explorer while the second way is from Package Manager Console.&lt;/p&gt;
&lt;h3&gt;NuGet Package Manager UI&lt;/h3&gt;
&lt;p&gt;This is the "easiest" way to add packages. So if you want to use Visual Studio GUI you have to right click &lt;strong&gt;References&lt;/strong&gt; folder in the &lt;strong&gt;Solution Explorer&lt;/strong&gt; and select the &lt;strong&gt;Add Library Package Reference…&lt;/strong&gt; option.&lt;/p&gt;
&lt;p&gt;
&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto; padding-top: 0px" title="AddLibraryPackageReference" border="0" alt="AddLibraryPackageReference" src="http://www.itbully.com/sites/default/files/wlw/AddLibraryPackageReference.png" width="461" height="286" /&gt;
&lt;/p&gt;
&lt;p&gt;This will bring you a dialog where you can find and install the package you want. In this dialog you can see all available online packages or you can you use the Filter option (on the top right textbox) to filter the list and find the package you want to use. After finding the desired package you can click the install button and it will be installed to your project.&lt;/p&gt;
&lt;p&gt;
&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto; padding-top: 0px" title="AddLibraryPackageReference2" border="0" alt="AddLibraryPackageReference2" src="http://www.itbully.com/sites/default/files/wlw/AddLibraryPackageReference2.png" width="604" height="404" /&gt;
&lt;/p&gt;
&lt;p&gt;You can also remove a package from your project from the same window. All installed packages are displayed in the first tab and you can uninstall them by clicking the uninstall button which is located next to the package you would like to remove.&lt;/p&gt;
&lt;p&gt;
&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto; padding-top: 0px" title="Uninstall" border="0" alt="Uninstall" src="http://www.itbully.com/sites/default/files/wlw/Uninstall.png" width="656" height="165" /&gt;
&lt;/p&gt;
&lt;p&gt;Another great feature of NuGet is that you can create and use your own feed of packages. So for example you can have the default NuGet package feed that comes with the installation and another one with packages that your company uses. You can add your own package source by clicking on &lt;strong&gt;Tools &amp;gt; Options&lt;/strong&gt;. After installing NuGet you will see a new node in the options tree, Package Manager. Under the General settings you can see a list of package sources. These are the sources that NuGet will look through to find packages and present them in the Gallery or via the List-Packages cmdlet (we will explain this in the Package Manager Console section below).&lt;/p&gt;
&lt;p&gt;
&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto; padding-top: 0px" title="OptionsFeeds" border="0" alt="OptionsFeeds" src="http://www.itbully.com/sites/default/files/wlw/OptionsFeeds.png" width="572" height="334" /&gt;
&lt;/p&gt;
&lt;h3&gt;NuGet Package Manager Console&lt;/h3&gt;
&lt;p&gt;You can also view all available packages, install new packages or uninstall packages from a PowerShell command window that you can find in &lt;strong&gt;View &amp;gt; Other Windows&lt;/strong&gt;. &lt;/p&gt;
&lt;p&gt;
&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto; padding-top: 0px" title="PackageManagerConsole" border="0" alt="PackageManagerConsole" src="http://www.itbully.com/sites/default/files/wlw/PackageManagerConsole.png" width="660" height="246" /&gt;
&lt;/p&gt;
&lt;p&gt;You can manage your packages by using the following commands:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;List-Package&lt;/strong&gt; - Lists the set of packages available from the package source. By default, lists installed packages. &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Install-Package&lt;/strong&gt; - Installs a package and its dependencies into the project. For project packages, this installs the package and applies it to a specific project. This copies contents to the project, adds assembly references, updates web.config, etc. &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Uninstall-Package&lt;/strong&gt; - Used to uninstall a package. If other packages depend on this package, the command will fail unless the –Force option is specified. &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Update-Package&lt;/strong&gt; - Used to update a package and its dependencies. If the new version of the package has new dependencies, then they will get installed. If the updated version no longer depends on a package, then the dependency is uninstalled if no other packages depend on it. &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;New-Package&lt;/strong&gt; - Creates a new package when supplied with a package specification file &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Get-Project&lt;/strong&gt; - Returns a reference to the DTE (Development Tools Environment) for the active or specified project. &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Check out the Package Manager Console Command reference &lt;a href="http://nupack.codeplex.com/documentation?title=Package%20Manager%20Console%20Command%20Reference" rel="nofollow" target="_blank"&gt;here on the wiki&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;
&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto; padding-top: 0px" title="PackageManagerConsole2" border="0" alt="PackageManagerConsole2" src="http://www.itbully.com/sites/default/files/wlw/PackageManagerConsole2.png" width="649" height="261" /&gt;
&lt;/p&gt;
&lt;p&gt;One final tip is that you can use the Tab key to auto-complete commands and parameters.&lt;/p&gt;
&lt;h3&gt;Dependency Management&lt;/h3&gt;
&lt;p&gt;Another cool feature of NuGet is that it handles dependency management between libraries. So for example if you want to add nHibernate to your project you should not worry for all dependencies as they are automatically handled by NuGet.&lt;/p&gt;
&lt;p&gt;
&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto; padding-top: 0px" title="nhibernate" border="0" alt="nhibernate" src="http://www.itbully.com/sites/default/files/wlw/nhibernate.png" width="635" height="327" /&gt;
&lt;/p&gt;
&lt;h3&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;NuGet is a fantastic open source tool that came to solve many problems. If you start using it you will definitely thought of “How you lived without it”. &lt;/p&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Itbully/~4/uxiMWVcx86E" height="1" width="1"/&gt;</description>
 <comments>http://www.itbully.com/articles/nuget-package-management-net#comments</comments>
 <category domain="http://www.itbully.com/category/tags/net">.NET</category>
 <category domain="http://www.itbully.com/category/tags/aspnet">ASP.NET</category>
 <category domain="http://www.itbully.com/category/tags/nuget">NuGet</category>
 <category domain="http://www.itbully.com/category/tags/package-management">Package Management</category>
 <category domain="http://www.itbully.com/category/tags/visual-studio">Visual Studio</category>
 <pubDate>Wed, 17 Nov 2010 17:15:00 +0000</pubDate>
 <dc:creator>George Chatzimanolis</dc:creator>
 <guid isPermaLink="false">61 at http://www.itbully.com</guid>
<feedburner:origLink>http://www.itbully.com/articles/nuget-package-management-net</feedburner:origLink></item>
<item>
 <title>Mom turn off the cake-blender, my ADSL line is dropping!!!</title>
 <link>http://feedproxy.google.com/~r/Itbully/~3/B3_GpK5a9C4/mom-turn-cake-blender-my-adsl-line-dropping</link>
 <description>&lt;p&gt;If you are one of those ISP customers that having problems with your ADSL line, then you are in the right place.&amp;#160; You installed an ADSL connection recently and you don’t get the “speed” you expected. Sometimes the line is dropping and you are wondering… why God!?!?! &lt;/p&gt;  &lt;p&gt;Actually God has nothing to do with it. ISPs are offering &lt;em&gt;ADSL speed&lt;/em&gt; &lt;strong&gt;&lt;u&gt;up to &lt;/u&gt;&lt;/strong&gt;some &lt;em&gt;bandwidth&lt;/em&gt;; it could be 1MB,2MB,4MB,8MB – 24MB. Unfortunately the term &lt;strong&gt;&lt;u&gt;&lt;em&gt;up-to&lt;/em&gt;&lt;/u&gt;&lt;/strong&gt; is not chosen by luck. &lt;em&gt;ADSL speed&lt;/em&gt; depends on many factors I am planning to explain in the next few sections of this post.&lt;/p&gt;  &lt;h4&gt;Are you far far far away?&lt;/h4&gt;  &lt;p&gt;Have you ever heard about attenuation? Leaving out some of the technical jargon, line &lt;strong&gt;attenuation&lt;/strong&gt; figure describes the distance between you and the exchange of your ADSL provider. Is expressed&amp;#160; in dBs and you can check this number on your ADSL statistics of your home / corporate router (&lt;em&gt;show dsl interface atm(something)&lt;/em&gt; for Cisco). In short, the lower this number the better:&lt;/p&gt;  &lt;p&gt;20dB and below is outstanding    &lt;br /&gt;20dB – 30dB is excellent     &lt;br /&gt;30dB – 40dB is very good     &lt;br /&gt;40dB – 50db is OK     &lt;br /&gt;50dB&amp;#160; and above is bad &lt;/p&gt;  &lt;p&gt;The “speed” of your ADSL line is directly affected by attenuation. Unluckily, you can do nothing about low attenuation except moving to a new location closer to your ADSL exchange. &lt;/p&gt;  &lt;h4&gt;Is your line noisy?&lt;/h4&gt;  &lt;p&gt;Have you ever tried to speak to a friend of yours that is 100 m away in a noisy street? I bet he would struggling to hear you. If the street was empty his hearing capabilities would be drastically improved. Like a street, ADSL lines are susceptive to noise. This could be because of electromagnetic noise (cars,music,dogs barking) or ADSL exchange’s load (people talking in the street). &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Signal-to-noise ratio&lt;/strong&gt; &lt;strong&gt;(SNR)&lt;/strong&gt; is another figure you can find in your ADSL stats of your home / corporate router (&lt;em&gt;show dsl interface atm(something)&lt;/em&gt; for Cisco). This number also expressed in dBs and describes the relation between your speaking strength (signal) and street’s noise strength (noise). The higher this number the better since your voice outperforms the noise.&lt;/p&gt;  &lt;p&gt;10dB and below is bad    &lt;br /&gt;11db – 20dB is OK     &lt;br /&gt;20dB – 28dB is excellent     &lt;br /&gt;29dB&amp;#160; and above is outstanding &lt;/p&gt;  &lt;p&gt;Some routers instead (or additionally) of &lt;strong&gt;signal-to-noise ratio (SNR)&lt;/strong&gt;, display the &lt;strong&gt;signal-to-noise margin (SNR Margin)&lt;/strong&gt;&amp;#160;&lt;u&gt;which is the difference between the &lt;strong&gt;actual SNR&lt;/strong&gt; and the &lt;strong&gt;SNR required to sync at a specific “speed”:&lt;/strong&gt;&lt;/u&gt;&lt;/p&gt;  &lt;p&gt;actual SNR = 44dB    &lt;br /&gt;SNR to sync at 8Mb = 35dB     &lt;br /&gt;SNR MARGIN = 44-35 = 9dB&lt;/p&gt;  &lt;p&gt;The higher the number the better and numbers bellow 6dB may cause problems. It is easier to understand if your line is in an acceptable SNR level by using the margin figure, because you don’t need to know the SNR dB value you should have for the line to perform in a specific speed. You just know that above 6 dBs you are doing OK.&lt;/p&gt;  &lt;p&gt;As you probably thinking noise is a subject of change according to various sources. On busy hours noise is increasing as your provider’s DSLAM becomes crowded (people talking in the street). Florescent light sources, telephone devices installed on your phone line, your mom’s cake-blender, all these may increase the SNR. Luckily there are some things you can do to improve the SNR:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Buy a router that is good enough to manage low SNR margins &lt;/li&gt;    &lt;li&gt;Install some good quality ADSL filters to your router and to each phone device sitting on the same line &lt;/li&gt;    &lt;li&gt;Try to change ADSL provider since some providers are less crowded than others. You can check out with your neighbors to see how they perform with their ISP.&amp;#160; &lt;/li&gt;    &lt;li&gt;Change the faceplate of your line with a better one and check that the cable terminates properly in it. &lt;/li&gt;    &lt;li&gt;Change in-building cabling. Poor, low quality telephone cabling can introduce noise to your lines. You can check if you have a problem with home/company cabling if you place your router (temporarily) directly to your building line intrusion point (probably at the basement) and check the stats. &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;&lt;a href="http://www.itbully.com/sites/default/files/wlw/image_17.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.itbully.com/sites/default/files/wlw/image_thumb_17.png" width="371" height="412" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;h4&gt;The verdict&lt;/h4&gt;  &lt;p&gt;You need to consider both &lt;strong&gt;attenuation&lt;/strong&gt; and &lt;strong&gt;SNR&lt;/strong&gt; to determine the quality of your ADSL line. Your &lt;strong&gt;SNR margin&lt;/strong&gt; should be above 6dB and the attenuation must meet some standards according to your line speed:&lt;/p&gt;  &lt;table border="1" cellspacing="0" cellpadding="2" width="400"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="200"&gt;Speed&lt;/td&gt;        &lt;td valign="top" width="200"&gt;Attenuation&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="200"&gt;2Mb&lt;/td&gt;        &lt;td valign="top" width="200"&gt;below 69dB&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="200"&gt;4Mb&lt;/td&gt;        &lt;td valign="top" width="200"&gt;below 56dB&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="200"&gt;8Mb&lt;/td&gt;        &lt;td valign="top" width="200"&gt;below 41dB&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="200"&gt;16Mb&lt;/td&gt;        &lt;td valign="top" width="200"&gt;below 25dB&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="200"&gt;21Mb&lt;/td&gt;        &lt;td valign="top" width="200"&gt;below 20dB&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;    &lt;p&gt;Note that your router will probably display stats for upstream and downstream traffic. These stats may be different since upstream/downstream speeds are different. Also consider reducing the “purchased speed”&amp;#160; if you have an &lt;strong&gt;SNR margin&lt;/strong&gt; lower than 6dB which causes you disconnections. That may improve SNR margin thus line stability. &lt;/p&gt;  &lt;p&gt;Finally there are some error stats your router may display. The most important you may consider are &lt;strong&gt;LOSES&lt;/strong&gt;, &lt;strong&gt;CRC&lt;/strong&gt; and &lt;strong&gt;HEC&lt;/strong&gt; errors. &lt;strong&gt;CRC&lt;/strong&gt; is an error correction code used to detect and retransmit corrupted packets. &lt;strong&gt;HEC&lt;/strong&gt; is a form of &lt;strong&gt;CRC&lt;/strong&gt; on the header of an ATM cell. If these errors are high within a period of time it will slow or even disconnect your line. &lt;strong&gt;LOSES&lt;/strong&gt; refer to loss of signal which can indicate a problem with noise if the number is high.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/Itbully/~4/B3_GpK5a9C4" height="1" width="1"/&gt;</description>
 <comments>http://www.itbully.com/articles/mom-turn-cake-blender-my-adsl-line-dropping#comments</comments>
 <category domain="http://www.itbully.com/category/tags/adsl">ADSL</category>
 <category domain="http://www.itbully.com/category/tags/adsl-speed">ADSL speed</category>
 <category domain="http://www.itbully.com/category/tags/attenuation">attenuation</category>
 <category domain="http://www.itbully.com/category/tags/attenuation-meaning">attenuation meaning</category>
 <category domain="http://www.itbully.com/category/tags/snr-adsl">snr adsl</category>
 <category domain="http://www.itbully.com/category/tags/snr-attenuation">snr attenuation</category>
 <category domain="http://www.itbully.com/category/tags/snr-db">snr db</category>
 <category domain="http://www.itbully.com/category/tags/snr-margin">snr margin</category>
 <category domain="http://www.itbully.com/category/tags/snr-ratio">snr ratio</category>
 <pubDate>Fri, 12 Nov 2010 11:01:31 +0000</pubDate>
 <dc:creator>Lefteris Karafilis</dc:creator>
 <guid isPermaLink="false">59 at http://www.itbully.com</guid>
<feedburner:origLink>http://www.itbully.com/articles/mom-turn-cake-blender-my-adsl-line-dropping</feedburner:origLink></item>
<item>
 <title>Virtualization, Paravirtualization, whatever you say!?!?</title>
 <link>http://feedproxy.google.com/~r/Itbully/~3/hnvCNxkLBdU/virtualization-paravirtualization-whatever-you-say</link>
 <description>&lt;p align="justify"&gt;It’s time to move on! It’s time to understand what is virtualization and why you need it. I know, it’s complicated to feel comfortable with something you don’t know, with something so complicated. But here you are reading my blog post and that means that you are considering the technology, that you care about understanding the definitions, the benefits and the technology behind virtualization.&lt;/p&gt;  &lt;h4&gt;What is virtualization&lt;/h4&gt;  

&lt;p align="justify"&gt;When people talk about virtualization they usually mean hardware virtualization. Although it is not the only form of virtualization, it’s the most widespread. In hardware virtualization, either hosted or hypervisor (bare metal),&amp;nbsp; a number of individual O/S instances encapsulated as virtual machines to run on a single computer, dynamically partitioning and sharing available physical resources as CPU, storage and I/O devices. &lt;/p&gt;  

&lt;p align="justify"&gt;Most users are familiar with products like VMWare workstation, MS Virtual PC and windows XP emulation mode which are a form of platform virtualization with hosted architecture. In hosted architecture the virtualization layer is installed as an application on top of an operating system (like windows, unix, linux, etc). This configuration has great flexibility in terms of hardware compatibility because of the presence of the host operating system.&lt;/p&gt;  

&lt;p align="justify"&gt;In a hypervisor architecture the virtualization layer is installed directly to the hardware platform thus it is more reliable, scalable and robust. Because of the absence of the host operating system, hypervisor architecture works on limited certified hardware. Products with hypervisor architecture include VMware ESX, VSphere, Microsoft Hyper-V, Sun xVM, wind river, etc. &lt;/p&gt;  

&lt;p align="justify"&gt;In both methods virtual machines are abstracted from the underlying hardware; in simple terms the guest O/S does not understand that&amp;nbsp; it runs in a virtual environment. This achieved by the virtualization layer which is responsible for the abstraction, sharing and partitioning of the CPU, memory and I/O devices. &lt;/p&gt;  &lt;h4&gt;Comparison of virtualization methods&lt;/h4&gt;  

&lt;p align="justify"&gt;Hardware virtualization was a great challenge to achieve because operating systems are designed to directly interact with bare-metal hardware. Virtualization vendors had to develop a strategy in which the O/S could be hosted in a virtual environment. And they came up with 3 different methods:&lt;/p&gt;  &lt;h4&gt;Binary Translation&lt;/h4&gt;  

&lt;p align="justify"&gt;In binary translation the virtualization layer sits at CPU privilege level 0 (most privileged). The Guest O/S system were supposed to run on level 0, but since virtual layer occupies that level, it moves guest O/S execution at privilege level 1 and leaves user applications at level 3 as it supposed to be.&amp;nbsp; The non-virtualizable kernel code of the guest O/S is translated by virtual layer into new sequences of instructions that have the intended effect on virtual hardware, while user level code is directly executed on the CPU for high performance. The benefit of this approach is that the O/S is fully abstracted from the underlying hardware thus it doesn’t require any modification.&lt;/p&gt;  &lt;h4&gt;Hardware Assisted&lt;/h4&gt;  

&lt;p align="justify"&gt;In hardware assisted virtualization the virtual layer sits in a new root mode privilege level under level 0. Guest O/S privileged and sensitive calls are set to auto trap to the hypervisor while user request are executed directly to the CPU for high performance. Hardware assisted virtualization requires a compatible CPU like intel VT-x and AMD’s AMD-V to work. This technique is not performing as expected because of the high overhead between guest O/S-to-hypervisor transition. On the other side hardware assisted virtualization is the future and we are expecting to see improved performance in next generation releases. At this moment this technique is utilized in specific cases by vendors like VMware such as for 64-bit guest support on Intel Processors. O/S is still fully abstracted from the underlying hardware thus it doesn’t require any modification.&lt;/p&gt;  &lt;h4&gt;Paravirtualization&lt;/h4&gt;  

&lt;p align="justify"&gt;In paravirtualization the Guest O/S kernel is modified to provide a special API that can be used by the virtual layer to translate non-virtualizable instructions with hypercalls. Virtualization layer interacts directly with guest O/S thus its lower virtualization overhead and better performance, though it can vary depending on the workload. Since paravirtualization requires kernel modification it is not suited for O/S like MS windows which kernel cannot be modified. Also in production environments deep kernel modification is a matter of question since it introduces significant support and maintability issues.&lt;/p&gt;  

&lt;p align="justify"&gt;Paravirtualization is used in many cases by vendors in conjunction with binary or hardware assisted technique to provide better performance. Example of this are VMtools which are a set of drivers and tools that allow virtual layer to interact with Guest O/S for better performance and manageability but not in the CPU level.&lt;/p&gt;    

&lt;p&gt;&lt;a href="http://www.itbully.com/sites/default/files/wlw/image_14.png"&gt;
&lt;img style="margin: 0px 50px 0px 0px; border: 0px none; padding-top: 0px; padding-right: 0px; padding-left: 0px; display: inline; background-image: none;" title="image" alt="image" src="http://www.itbully.com/sites/default/files/wlw/image_thumb_14.png" border="0" height="291" width="250" /&gt;&lt;/a&gt;&lt;a href="http://www.itbully.com/sites/default/files/wlw/image_15.png"&gt;
&lt;img style="margin: 0px 50px 0px 0px; border: 0px none; padding-top: 0px; padding-right: 0px; padding-left: 0px; display: inline; background-image: none;" title="image" alt="image" src="http://www.itbully.com/sites/default/files/wlw/image_thumb_15.png" border="0" height="291" width="250" /&gt;&lt;/a&gt;&lt;a href="http://www.itbully.com/sites/default/files/wlw/image_16.png"&gt;
&lt;img style="border: 0px none; padding-top: 0px; padding-right: 0px; padding-left: 0px; display: inline; background-image: none;" title="image" alt="image" src="http://www.itbully.com/sites/default/files/wlw/image_thumb_16.png" border="0" height="291" width="250" /&gt;&lt;/a&gt;
&lt;/p&gt;                                  

&lt;table border="1" cellpadding="2" cellspacing="0"&gt;
&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="199"&gt;&amp;nbsp;&lt;/td&gt;        &lt;td valign="top" width="199"&gt;Binary Translation&lt;/td&gt;        &lt;td valign="top" width="198"&gt;Hardware Assisted&lt;/td&gt;        &lt;td valign="top" width="201"&gt;Paravirtualization&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="199"&gt;Guest O/S modification&lt;/td&gt;        &lt;td valign="top" width="199"&gt;Unmodified&lt;/td&gt;        &lt;td valign="top" width="198"&gt;Unmodified&lt;/td&gt;        &lt;td valign="top" width="202"&gt;Modified&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="199"&gt;Compatibility&lt;/td&gt;        &lt;td valign="top" &gt;Excellent&lt;/td&gt;        &lt;td valign="top"&gt;Excellent&lt;/td&gt;        &lt;td valign="top"&gt;Poor&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top"&gt;Performance&lt;/td&gt;        &lt;td valign="top"&gt;Good&lt;/td&gt;        &lt;td valign="top"&gt;Fair (will be improved in next generations)&lt;/td&gt;        &lt;td valign="top"&gt;Good&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top"&gt;Vendors&lt;/td&gt;        &lt;td valign="top"&gt;Vmware , Microsoft, Parallels&lt;/td&gt;        &lt;td valign="top"&gt;Vmware, Microsoft, Parallels, Xen&lt;/td&gt;        &lt;td valign="top"&gt;Vmware, Xen&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;
&lt;/table&gt;    &lt;h4&gt;Benefits of virtualization&lt;/h4&gt;  

&lt;p&gt;Ok with all this technical jargon. Why should someone consider going to virtualization? Here are some benefits:&lt;/p&gt;  &lt;ol&gt;
 &lt;li&gt;You can run one or more applications that are not supported by the Host O/S&lt;/li&gt;
 &lt;li&gt;Better security and isolation, since malfunctions or malware infection of a guest O/S does not affect the others&lt;/li&gt;
 &lt;li&gt;Peace of cake creation of test environments&lt;/li&gt;
 &lt;li&gt;Easy cloning of virtual machines on the same physical hardware or across servers&lt;/li&gt;
 &lt;li&gt;Snapshot technique which enables you to revert back to a specific point in time. Especially useful in case of configuration changes and service pack and patches malfunctions.&lt;/li&gt;
 &lt;li&gt;Excellent recovery scenarios if you backup in VM level. Since VMs are abstracted from hardware you can easily move/restore them to new physicals servers without complications&lt;/li&gt;
 &lt;li&gt;Better utilize hardware resources. VM management software allows you to configure hardware to virtual resource partitioning and utilization. For example you can set specific CPU thresholds, memory allocation, disk space allocation, I/O structures, etc. Also you can let the virtual machine monitor to decide the resources allocation according to utilization.&lt;/li&gt;
 &lt;li&gt;Reduce physical space consumption and reduce hardware costs. You have fewer servers to buy.&lt;/li&gt;
 &lt;li&gt;Benefit from the licensing models many O/S vendors as Microsoft are providing. For example, if you buy Windows 2008 ENT edition you get licenses for 4 virtual machines.&lt;/li&gt;
&lt;/ol&gt;  &lt;h4&gt;Final Thoughts&lt;/h4&gt;  

&lt;p align="justify"&gt;There are many virtualization products out there (you can find a comparison list &lt;a href="http://en.wikipedia.org/wiki/Comparison_of_platform_virtual_machines" target="_blank"&gt;here&lt;/a&gt;) and hardware virtualization is not the only form of virtualization. You can virtualize applications (application virtualization), operating systems (O/S virtualization without guest VMs), storage, etc. &lt;/p&gt;  

&lt;p align="justify"&gt;You can use a wide variety of tools to monitor and manage your virtual machines. Some of these are generic while others are vendor specific, like Vcenter for managing VMware products and Microsoft Operations Manager to manage Microsoft products. There are tools like Microsoft’s &lt;a href="http://download.sysinternals.com/Files/Disk2vhd.zip" target="_blank"&gt;Disk2VHD&lt;/a&gt; and Vmware’s &lt;a href="https://www.vmware.com/tryvmware/?p=converter" target="_blank"&gt;Vcenter Converter&lt;/a&gt; to let you easily convert and migrate physical servers to virtual machines and believe me, it is relatively easy to do so in most cases. Major backup software vendors like Symantec Backup Exec and Ca’s Brightstor have enabled their products to be compatible with virtualization platforms (mostly with VMware and Microsoft) to let you backup guest O/S at both data level or VM level.&amp;nbsp; &lt;/p&gt;  

&lt;p align="justify"&gt;There is already a great installation base at SMB and Enterprise level and technology maturity is considerable. Virtualization is definitely the future and there are many benefits to consider. &lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/Itbully/~4/hnvCNxkLBdU" height="1" width="1"/&gt;</description>
 <category domain="http://www.itbully.com/category/tags/hardware-assisted-virtualization">hardware assisted virtualization</category>
 <category domain="http://www.itbully.com/category/tags/hardware-virtualization">hardware virtualization</category>
 <category domain="http://www.itbully.com/category/tags/hyper-v">hyper-v</category>
 <category domain="http://www.itbully.com/category/tags/hypervisor">hypervisor</category>
 <category domain="http://www.itbully.com/category/tags/intel-virtualization">intel virtualization</category>
 <category domain="http://www.itbully.com/category/tags/microsoft-virtualization">microsoft virtualization</category>
 <category domain="http://www.itbully.com/category/tags/paravirtualization">paravirtualization</category>
 <category domain="http://www.itbully.com/category/tags/virtualization">Virtualization</category>
 <category domain="http://www.itbully.com/category/tags/virtualization-technology">virtualization technology</category>
 <category domain="http://www.itbully.com/category/tags/vmware">vmware</category>
 <category domain="http://www.itbully.com/category/tags/vmware-hardware-virtualization">vmware hardware virtualization</category>
 <category domain="http://www.itbully.com/category/tags/vmware-workstation">vmware workstation</category>
 <category domain="http://www.itbully.com/category/tags/vsphere">vsphere</category>
 <pubDate>Wed, 10 Nov 2010 10:07:59 +0000</pubDate>
 <dc:creator>Lefteris Karafilis</dc:creator>
 <guid isPermaLink="false">58 at http://www.itbully.com</guid>
<feedburner:origLink>http://www.itbully.com/articles/virtualization-paravirtualization-whatever-you-say</feedburner:origLink></item>
<item>
 <title>Sync Your Files With Windows Live Mesh 2011</title>
 <link>http://feedproxy.google.com/~r/Itbully/~3/P281Q3GKEkQ/sync-your-files-windows-live-mesh-2011</link>
 <description>&lt;p&gt;Simple walkthrough for using windows live mesh 2011 to sync files between computers and skydrive service&lt;/p&gt;&lt;div class="field field-type-emvideo field-field-emvideo"&gt;
    &lt;div class="field-items"&gt;
            &lt;div class="field-item odd"&gt;
                    &lt;a href="http://blip.tv/file/4347818"&gt;Δείτε το Video&lt;/a&gt;        &lt;/div&gt;
        &lt;/div&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Itbully/~4/P281Q3GKEkQ" height="1" width="1"/&gt;</description>
 <comments>http://www.itbully.com/videos/sync-your-files-windows-live-mesh-2011#comments</comments>
 <category domain="http://www.itbully.com/category/tags/live-essentials">live essentials</category>
 <category domain="http://www.itbully.com/category/tags/live-mesh">Live Mesh</category>
 <category domain="http://www.itbully.com/category/tags/live-sync">live sync</category>
 <category domain="http://www.itbully.com/category/tags/live-sync-mesh">live sync mesh</category>
 <category domain="http://www.itbully.com/category/tags/live-sync-skydrive">live sync skydrive</category>
 <category domain="http://www.itbully.com/category/tags/microsoft-live">microsoft live</category>
 <category domain="http://www.itbully.com/category/tags/microsoft-sync">microsoft sync</category>
 <category domain="http://www.itbully.com/category/tags/skydrive-sync">skydrive sync</category>
 <category domain="http://www.itbully.com/category/tags/windows-7-sync">windows 7 sync</category>
 <category domain="http://www.itbully.com/category/tags/windows-mesh">windows mesh</category>
 <category domain="http://www.itbully.com/category/tags/windows-mesh-live">windows mesh live</category>
 <media:content url="http://blip.tv/file/get/Itbully-SyncYourFilesWithWindowsLiveMesh2011861.mp4"> <media:thumbnail url="http://a.images.blip.tv/Itbully-SyncYourFilesWithWindowsLiveMesh2011861-424.jpg" />
</media:content>
 <pubDate>Sun, 07 Nov 2010 00:10:00 +0000</pubDate>
 <dc:creator>Lefteris Karafilis</dc:creator>
 <guid isPermaLink="false">54 at http://www.itbully.com</guid>
<feedburner:origLink>http://www.itbully.com/videos/sync-your-files-windows-live-mesh-2011</feedburner:origLink></item>
<item>
 <title>Booting Windows PE from a USB Drive Walkthrough</title>
 <link>http://feedproxy.google.com/~r/Itbully/~3/5_eb8NMhq3c/booting-windows-pe-usb-drive-walkthrough</link>
 <description>&lt;p&gt;Windows preinstallation environment (windows PE) is a bootable tool that provides a minimal set of operating system features for installation, troubleshooting, and recovery. In this post I am going to explain how you can setup a windows PE environment to boot from a USB drive in 5 simple steps:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Download and install windows AIK from Microsoft &lt;/li&gt;    &lt;li&gt;Prepare WinPE image &lt;/li&gt;    &lt;li&gt;Add drivers to your WinPE image &lt;/li&gt;    &lt;li&gt;Setup USB drive to be able to boot &lt;/li&gt;    &lt;li&gt;Copy the files to USB drive &lt;/li&gt; &lt;/ol&gt;  &lt;h4&gt;Download and install windows AIK from Microsoft&lt;/h4&gt;  

&lt;p&gt;Windows AIK is a set of tools and documentation that support the configuration and deployment of Windows® operating systems. You can download WAIK from &lt;em$2&gt;Microsoft download center &lt;/em$2&gt;&lt;a href="http://www.microsoft.com/download"&gt;http://www.microsoft.com/download&lt;/a&gt; (search term WAIK) and install it to your computer for free.&lt;/p&gt;  

&lt;p&gt;After WAIK installation a set of folders will be created by default under \program files\Windows AIK that contain the appropriate files and tools to create and manage WinPE images, unattended installation files, a volume activation management tool, SDKs and some sample files.&lt;/p&gt;  &lt;h4&gt;Prepare WinPE image&lt;/h4&gt;  

&lt;p&gt;After installing WAIK you are ready to prepare your WinPE image. In order to do so you have to go to &lt;b$2&gt;\program files\Windows AIK\Tools\PETools&lt;/b$2&gt; (default location) and copy your candidate WinPE image files to a temporary location. To do that you issue the command &lt;b$2&gt;copype.cmd &amp;lt;x86|amd64|ia64&amp;gt; &amp;lt;temporary location&amp;gt;&lt;/b$2&gt; for example &lt;b$2&gt;
&lt;b$2&gt;&lt;b$2&gt;
&lt;strong$2&gt;copype.cmd x86 c:\temp\WinPEx86&lt;/strong$2&gt;&lt;/b$2&gt; &lt;/b$2&gt;&lt;/b$2&gt;(x86 is the 32bit architecture).&lt;/p&gt;  

&lt;p&gt;As a final step you need to copy and rename the base image file c:\temp\WinPEx86\winpe.wim (based on the above example) to the ISO\Sources subdirectory of this temporary folder as boot.wim. To do this, issue the command &lt;b$2&gt;&lt;b$2&gt;
&lt;b$2&gt;
&lt;strong$2&gt;copy c:\temp\WinPEx86\winpe.wim c:\temp\WinPEx86\ISO\sources\boot.wim. &lt;/strong$2&gt;&lt;/b$2&gt;&lt;/b$2&gt;
&lt;/b$2&gt;
&lt;/p&gt;
&lt;h4&gt;Add drivers to your WinPE image (optional)&lt;/h4&gt;  

&lt;p&gt;In case you need to preload any drivers to your WinPE image or add optional components you have to follow some additional steps outlined below. In case you don’t you skip to the next section.&lt;/p&gt;  

&lt;p&gt;First step is to create a directory, for example c:\temp\WinPEx86\Drivers, and download your drivers in this location. Note that the drivers must be fully extracted with their .inf files exposed in order to be added to the WinPE image.&lt;/p&gt;  

&lt;p&gt;Second step is to mount the base WinPE image copied previously. To do that execute &lt;b$2&gt;
&lt;b$2&gt;
&lt;strong$2&gt;&lt;b$2&gt;"c:\Program Files\Windows AIK\Tools\Servicing\Dism.exe" /mount-Wim /WimFile:c:\temp\WinPEx86\ISO\Sources\boot.wim /index:1 /MountDir:c:\temp\WinPEx86\Mount.&lt;/b$2&gt;
&lt;/strong$2&gt;&lt;/b$2&gt;&lt;/b$2&gt;
&lt;/p&gt;  

&lt;p&gt;Third step is to add the downloaded drivers to the Image by executing &lt;b$2&gt;
&lt;b$2&gt;
&lt;b$2&gt;
&lt;strong$2&gt;"c:\Program Files\Windows AIK\Tools\Servicing\Dism.exe" /image:c:\temp\WinPEx86\Mount /Add-Driver /Driver:c:\temp\WinPEx86\drivers /recurse /ForceUnsigned.&lt;/strong$2&gt;&lt;/b$2&gt;&lt;/b$2&gt;&lt;/b$2&gt; By including the /recurse switch you tell to the command to recurse the drivers’ subfolders for valid .inf drivers and by including the /ForceUnsigned you tell the command to ignore driver signing requirements.&lt;/p&gt;  

&lt;p&gt;Fourth step is to unmount and commit the WinPE image by executing &lt;b$2&gt;
&lt;strong$2&gt;
&lt;b$2&gt;&lt;b$2&gt;"c:\Program Files\Windows AIK\Tools\Servicing\Dism.exe" /unmount-wim /MountDir:c:\temp\WinPEx86\Mount /commit.&lt;/b$2&gt;
&lt;/b$2&gt;
&lt;/strong$2&gt;&lt;/b$2&gt;
&lt;/p&gt;  

&lt;p&gt;Note, that you can add additional files and folders to your custom WinPE image simply by copying your files to the c:\temp\WinPEx86\Mount. These files will be loaded to the RAM drive after WinPE boot (c:\). If you don’t want these files to be loaded to the RAM Drive (consumes RAM) and be available to the USB drive instead, just copy them to a structure under c:\temp\WinPEx86\ISO folder.&lt;/p&gt;  &lt;h4&gt;Setup USB drive to be able to boot&lt;/h4&gt;  

&lt;p&gt;In this step you need to use the diskpart utility (windows Vista and above O/S) to create a bootable partition to your usb drive as outlined below.&lt;/p&gt;  

&lt;p&gt;Use Diskpart to identify the disk ID of your usb drive:&lt;/p&gt;  

&lt;pre&gt;diskpart&lt;br /&gt;
list disk&lt;/pre&gt;

&lt;p&gt;
&lt;img style="border-width: 0px; padding-top: 0px; padding-right: 0px; padding-left: 0px; display: inline; background-image: none;" title="diskpart" border="0" alt="diskpart" src="http://www.itbully.com/sites/default/files/wlw/diskpart.png" width="448" height="103" /&gt; &lt;/p&gt;

&lt;p&gt;After you have identified your usb disk ID (based on size), you can wipe your partition information, create a new one and mark it as active. &lt;/p&gt;

&lt;pre&gt;select disk 1&lt;br /&gt;
clean&lt;br /&gt;
create partition primary&lt;br /&gt;
select partition 1&lt;br /&gt;
active&lt;br /&gt;
format quick fs=ntfs&lt;br /&gt;
assign&lt;br /&gt;
exit&lt;/pre&gt;

&lt;h4&gt;Copy the files to USB drive&lt;/h4&gt;

&lt;p&gt;Final step is to copy the files included under your ISO subfolder to your USB drive: &lt;b$2&gt;
&lt;b$2&gt;
&lt;strong$2&gt;xcopy c:\temp\WinPEx86\ISO\*.* f:\&lt;/strong$2&gt;&lt;/b$2&gt; &lt;/b$2&gt;(where f:\ is your USB drive).&lt;/p&gt;

&lt;p&gt;Note that you may need to alter your PC’s BIOS settings in order to be able to boot from USB drives and of course it needs to be USB boot capable.&lt;/p&gt;

&lt;h4&gt;Final Thoughts&lt;/h4&gt;

&lt;p&gt;In case you want to load drivers after WinPE boot you can use the drvload.exe command (drvload.exe inf_path).&lt;/p&gt;

&lt;p&gt;To manipulate winPE environment you need to use the wpeutil &amp;lt;command&amp;gt; &amp;lt;argument&amp;gt; command. Most usable commands of wpeutil: EnableFirewall, DisableFirewall, Reboot, ShutDown, Initializenetwork.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/Itbully/~4/5_eb8NMhq3c" height="1" width="1"/&gt;</description>
 <comments>http://www.itbully.com/articles/booting-windows-pe-usb-drive-walkthrough#comments</comments>
 <category domain="http://www.itbully.com/category/tags/winpe-2010">WinPE 2010</category>
 <category domain="http://www.itbully.com/category/tags/winpe-7">WinPE 7</category>
 <category domain="http://www.itbully.com/category/tags/winpe-usb">WinPE USB</category>
 <pubDate>Mon, 01 Nov 2010 11:15:41 +0000</pubDate>
 <dc:creator>Lefteris Karafilis</dc:creator>
 <guid isPermaLink="false">43 at http://www.itbully.com</guid>
<feedburner:origLink>http://www.itbully.com/articles/booting-windows-pe-usb-drive-walkthrough</feedburner:origLink></item>
<item>
 <title>What is this RemoteFX everybody is talking about?</title>
 <link>http://feedproxy.google.com/~r/Itbully/~3/JRmwB020Hso/what-remotefx-everybody-talking-about</link>
 <description>&lt;p align="justify"&gt;It is actually an add-on for RDP that enables the delivery of a full Windows user experience to a range of client devices including rich clients, thin clients, and ultrathin clients. It delivers a rich user experience for Virtual Desktop Infrastructure (VDI) by enabling host side rendering, GPU virtualization, Intelligent Screen Capture, Encoding, Decoding, and USB redirection.&lt;/p&gt;  

&lt;p align="justify"&gt;RemoteFX enables &lt;strong&gt;host side rendering&lt;/strong&gt; which allows graphics to be rendered on the host device instead of on the client which allows the applications to run at full speed by taking advantage of the GPU and CPU of host computer since all graphic types are rendered on the host computer, compressed as bitmap images and send to client computer.&lt;/p&gt;  

&lt;p align="justify"&gt;RemoteFX is also capable of &lt;strong&gt;GPU virtualization&lt;/strong&gt; by exposing a virtual graphic device to a virtual machine. Using a WDDM driver with the virtual desktop, allows multiple virtual desktops to share a single GPU on a Hyper-V server.&lt;/p&gt;  

&lt;p align="justify"&gt;In order to take care of bandwidth limitations RemoteFX uses &lt;strong&gt;Intelligent Screen Capture,&lt;/strong&gt; a technology which constantly detects network capability between client and host and adjusts frame-rate according to available bandwidth. &lt;strong&gt;Intelligent Screen Capture &lt;/strong&gt;is designed to send more frames to ensure a good user experience. &lt;/p&gt;  

&lt;p align="justify"&gt;RemoteFX &lt;strong&gt;encoder and decoder &lt;/strong&gt;allows encoding on the processor, on the GPU, or on dedicated hardware on the host computer and decoding on the client. &lt;/p&gt;  

&lt;p align="justify"&gt;Finally the &lt;strong&gt;USB redirection&lt;/strong&gt; support allows many devices to be redirected to a Remote Desktop Virtualization Host server at the USB level. No device drivers are required on the client computer and universal interface is provided that works with any USB device on any platform where RemoteFX USB Redirection is supported. This solution redirects many types of devices, including audio devices, storage devices, human interface devices, all-in-one printers, and scanners.&lt;/p&gt;  &lt;h4&gt;How to configure RemoteFX?&lt;/h4&gt;  

&lt;p&gt;&lt;a href="http://www.microsoft.com/downloads/en/details.aspx?FamilyID=c031b617-1c9b-4ccf-bc13-df6199003e9e&amp;amp;utm_source=feedburner&amp;amp;utm_medium=feed&amp;amp;utm_campaign=Feed%3A+MicrosoftDownloadCenter+%28Microsoft+Download+Center%29#tm" target="_blank"&gt;Deploying RemoteFX for Virtual Desktop Pools Step-by-Step Guide&lt;/a&gt;
&lt;/p&gt;  

&lt;p&gt;&lt;a href="http://www.microsoft.com/downloads/en/details.aspx?FamilyID=36dfd539-fa39-47de-af89-24f07bd67a7d&amp;amp;utm_source=feedburner&amp;amp;utm_medium=feed&amp;amp;utm_campaign=Feed%3A+MicrosoftDownloadCenter+%28Microsoft+Download+Center%29#tm" target="_blank"&gt;Deploying Microsoft RemoteFX for Personal Virtual Desktops Step-by-Step Guide&lt;/a&gt; &lt;/p&gt;  

&lt;p&gt;&lt;a href="http://www.microsoft.com/downloads/en/details.aspx?FamilyID=d90e841f-d84c-4746-b0f3-3c16e71d1ed1&amp;amp;utm_source=feedburner&amp;amp;utm_medium=feed&amp;amp;utm_campaign=Feed%3A+MicrosoftDownloadCenter+%28Microsoft+Download+Center%29#tm" target="_blank"&gt;Deploying Microsoft RemoteFX on a Remote Desktop Session Host Server Step-by-Step Guide&lt;/a&gt;
&lt;/p&gt;  &lt;h5&gt;Source: Microsoft.com&lt;/h5&gt;&lt;img src="http://feeds.feedburner.com/~r/Itbully/~4/JRmwB020Hso" height="1" width="1"/&gt;</description>
 <comments>http://www.itbully.com/articles/what-remotefx-everybody-talking-about#comments</comments>
 <category domain="http://www.itbully.com/category/tags/remotefx">RemoteFX</category>
 <category domain="http://www.itbully.com/category/tags/windows-2008-r2-sp1">Windows 2008 R2 SP1</category>
 <category domain="http://www.itbully.com/category/tags/windows-7-sp1">Windows 7 SP1</category>
 <pubDate>Sat, 30 Oct 2010 11:23:00 +0000</pubDate>
 <dc:creator>Lefteris Karafilis</dc:creator>
 <guid isPermaLink="false">45 at http://www.itbully.com</guid>
<feedburner:origLink>http://www.itbully.com/articles/what-remotefx-everybody-talking-about</feedburner:origLink></item>
<item>
 <title>Internal or Outsourced IT Services?</title>
 <link>http://feedproxy.google.com/~r/Itbully/~3/Z_ds5vU8jao/internal-or-outsourced-it-services</link>
 <description>&lt;p&gt;“Every business must grow, evolve and remain competitive; integral part of this is technology”&lt;/p&gt;  

&lt;p align="justify"&gt;For any company the right choice of an IT department, undoubtedly leads to the path of success. But what are the criteria for selecting the right team? What technology spectrum should they cover? How do I know the right choice?    &lt;br /&gt;
&lt;/p&gt;  

&lt;p align="justify"&gt;It is understood that an internal IT department, is well aware of the requirements, needs and established technology of the company they supporting; but the spectrum and tremendous speed of technology evolution requires an extraordinary effort to stay up to date.    &lt;br /&gt;
&lt;/p&gt;  

&lt;p align="justify"&gt;There are so many areas to cover and growth rates to keep up to, that simply makes impossible to handle. Hence one of the best ways to cover a broader spectrum is through outsourcing.&lt;/p&gt;  &lt;h3 align="justify"&gt;What options do I have?&lt;/h3&gt;  

&lt;p align="justify"&gt;   &lt;br /&gt;
It is not necessary to dismiss an internal IT department in order to meet your needs with the use of external collaborators exclusively. You can evaluate your business requirements along with your support team, in order to conclude to the areas you will delegate to external partners. You can, for example, choose to keep internally the daily technical support, user training and administration; and adopt outsourcing services for consulting, project implementation, network security and support of your ERP system.&lt;/p&gt;  

&lt;p align="justify"&gt;   &lt;br /&gt;
This way you can combine the benefits of both your internal team and the expertise of your external partners. If you think you don’t want to maintain an internal IT department, there are service providers that can manage your everyday technical issues,new projects, consulting services, communication, etc.&lt;/p&gt;  &lt;h3&gt;Comparison&lt;/h3&gt;  

&lt;table border="1" cellpadding="2" cellspacing="0" width="719"&gt;
&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="100"&gt;&amp;nbsp;&lt;/td&gt;        &lt;td valign="top" width="182"&gt;Internal IT&lt;/td&gt;        &lt;td valign="top" width="229"&gt;Outsourcing&lt;/td&gt;        &lt;td valign="top" width="206"&gt;Combination&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="100"&gt;Pros&lt;/td&gt;        &lt;td valign="top" width="182"&gt;         

&lt;p&gt;-Knowledge of business            &lt;br /&gt;
-Response time&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="229"&gt;         

&lt;p&gt;-Range of Expertise            &lt;br /&gt;
-Flexible Resources             &lt;br /&gt;
-Management tools             &lt;br /&gt;
-Cost             &lt;br /&gt;
-Expertise in project implementation             &lt;br /&gt;
-SLA             &lt;br /&gt;
-Applied solutions in different environments&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="206"&gt;         

&lt;p&gt;-Knowledge of business            &lt;br /&gt;
-Response time             &lt;br /&gt;
-Range of Expertise             &lt;br /&gt;
-Flexible Resources             &lt;br /&gt;
-Management tools             &lt;br /&gt;
-Expertise in project implementation             &lt;br /&gt;
-SLA             &lt;br /&gt;
-Applied solutions in different environments&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="100"&gt;Cons&lt;/td&gt;        &lt;td valign="top" width="182"&gt;         

&lt;p&gt;-Cost of personnel maintenance            &lt;br /&gt;
-Range of Expertise             &lt;br /&gt;
-Expertise in project implementation             &lt;br /&gt;
-Applied solutions in different environments             &lt;br /&gt;
-Flexible Resources&lt;/p&gt;       &lt;/td&gt;        &lt;td valign="top" width="229"&gt;-Response Time          &lt;br /&gt;
-Service cost evaluation&lt;/td&gt;        &lt;td valign="top" &gt;-Service cost evaluation&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;
&lt;/table&gt;  &lt;h3&gt;&amp;nbsp;&lt;/h3&gt;  &lt;h3&gt;What should I consider when choosing a partner?&lt;/h3&gt;  

&lt;p&gt;During the assessment and selection of an outsourcing team you will benefit if you take into account:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;     

&lt;div align="justify"&gt;
&lt;strong&gt;Related projects executed in the past:&lt;/strong&gt; It is not necessary for a service provider which has successfully executed a project regarding the implementation of an ERP system, to perform the same success with a project concerning the security of a network&lt;/div&gt;   &lt;/li&gt;    &lt;li&gt;     

&lt;div align="justify"&gt;
&lt;strong&gt;The availability of experienced staff:&lt;/strong&gt; It is reasonable for a company to try to cut costs. Many service providers, maintain large groups of inexperienced staff led by a single senior engineer, project manager or consultant. The problem comes when that inexperienced staff, which are not always able to assess, manage and execute a project properly, take the wrong decisions as a result of the unavailability of their manager, who may be over allocated because of the poor relationship between senior / junior staff.&lt;/div&gt;   &lt;/li&gt;    &lt;li&gt;     

&lt;div align="justify"&gt;
&lt;strong&gt;The cost VS performance: &lt;/strong&gt;It is obvious that a high-quality service of 700€ is advantageous compared to a low-quality service of 600€. I do not imply that expensive means better. You should take into account all factors related to quality (previous projects, experienced staff, etc.) and cost, compare your options and decide your final approach.&lt;/div&gt;   &lt;/li&gt;    &lt;li&gt;     

&lt;div align="justify"&gt;
&lt;strong&gt;Satisfaction guarantee:&lt;/strong&gt; Service satisfaction is somehow subjective and always end up to how happy is the customer. A service could be technically correct, but do not meet all of the business requirements. This may be a result of poor communication. But it is important that the result is not desirable and that’s where you should have a framework that defines it. In project cases, the metrics and the rules of acceptance of deliverables should always be defined in the "project definition". In cases of support contracts, along with the terms (SLA), it is good to ask for an evaluation (trial) period before sealing the deal.&lt;/div&gt;   &lt;/li&gt;    &lt;li&gt;     

&lt;div align="justify"&gt;
&lt;strong&gt;The range of technologies covered&lt;/strong&gt;: There are many companies that are product oriented. Sometimes this means that whatever your needs, they will try to implement their own product to your case, regardless of whether it fits or not. This may be a solution which does not cover all your requirements or is extremely advanced.&lt;/div&gt;   &lt;/li&gt;    &lt;li&gt;     

&lt;div align="justify"&gt;
&lt;strong&gt;Availability and response time:&lt;/strong&gt; Usually response time is ranging from 2 hours to 2 days depending on the SLA and the seriousness of a request. Timetables vary from 8 hours to 24. Support costs vary depending on response and availability.&lt;/div&gt;   &lt;/li&gt; &lt;/ul&gt;&lt;img src="http://feeds.feedburner.com/~r/Itbully/~4/Z_ds5vU8jao" height="1" width="1"/&gt;</description>
 <comments>http://www.itbully.com/articles/internal-or-outsourced-it-services#comments</comments>
 <category domain="http://www.itbully.com/category/tags/information-technology">Information Technology</category>
 <category domain="http://www.itbully.com/category/tags/it">IT</category>
 <category domain="http://www.itbully.com/category/tags/outsourcing">Outsourcing</category>
 <pubDate>Fri, 29 Oct 2010 11:32:00 +0000</pubDate>
 <dc:creator>Lefteris Karafilis</dc:creator>
 <guid isPermaLink="false">48 at http://www.itbully.com</guid>
<feedburner:origLink>http://www.itbully.com/articles/internal-or-outsourced-it-services</feedburner:origLink></item>
<item>
 <title>The MOSS Search Saga: Modifying The Search Result Page</title>
 <link>http://feedproxy.google.com/~r/Itbully/~3/FS-mTpfwrq0/moss-search-saga-modifying-search-result-page</link>
 <description>&lt;p align="justify"&gt;The customization of the search experience in MOSS is crucial in many situations. You may need to add additional metadata to your display results, to modify the search result page layout or to add additional metadata properties to your advanced search page. In the paragraphs below I am going to demonstrate a simple scenario of MOSS search experience customization.&lt;/p&gt;  

&lt;p align="justify"&gt;In the first part of this example I am going to create a tabular layout of my search results page for an e-protocol SharePoint list. I am going to demonstrate the way to add additional metadata to the search results page, to modify the layout using SharePoint Designer and in the second part to modify the advanced search page to include more options to query.&lt;/p&gt;  

&lt;p align="justify"&gt;Before I start customizing my search results page I need to populate some custom columns, I created to my e-protocol SharePoint list. Each time SharePoint crawls the farm to create indexed content, it adds any custom column (&lt;em&gt;metadata property&lt;/em&gt;) it finds in &lt;em&gt;Lists&lt;/em&gt;, Document &lt;em&gt;Libraries&lt;/em&gt; and &lt;em&gt;Sites&lt;/em&gt;, to its &lt;em&gt;metadata properties&lt;/em&gt; database. But for those properties to become manageable, MOSS administrator needs to create a “&lt;em&gt;managed property&lt;/em&gt;” record for each of the &lt;em&gt;metadata&lt;/em&gt; he needs to manage. Notice that each “&lt;em&gt;managed property&lt;/em&gt;” can map to one or more &lt;em&gt;metadata properties.&lt;/em&gt; For example, if I want to create a &lt;em&gt;managed property&lt;/em&gt; for the &lt;em&gt;ProtocolID&lt;/em&gt; metadata, I would create a single map for this property. This could become available to my search results page and advanced search queries. Now consider the following scenario: I want to create a single &lt;em&gt;managed property &lt;/em&gt;to query and display all kinds of calling number information across my contacts lists. I should create a single &lt;em&gt;managed property&lt;/em&gt; which maps to multiple &lt;em&gt;metadata properties&lt;/em&gt;: &lt;em&gt;mobile phone, home phone, company phone, etc.&lt;/em&gt; &lt;/p&gt;  

&lt;p align="justify"&gt;I am going to create seven (7) managed properties for my Protocol Application List. In order to create these &lt;em&gt;managed properties &lt;/em&gt;I need to navigate to the &lt;em&gt;Search Administration&lt;/em&gt; Page of my SSP:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;     

&lt;div align="justify"&gt;From there I navigate to the metadata properties in the side menu and I select &lt;em&gt;new managed property&lt;/em&gt;.&lt;/div&gt;   &lt;/li&gt;    &lt;li&gt;     

&lt;div align="justify"&gt;I type an appropriate name for my new managed property (ex ProtID)&lt;/div&gt;   &lt;/li&gt;    &lt;li&gt;     

&lt;div align="justify"&gt;I select the appropriate type of this property (ex Text)        &lt;br /&gt;
&lt;a href="http://www.itbully.com/sites/default/files/wlw/image.png"&gt;
&lt;img style="border-width: 0px; display: inline;" title="image" alt="image" src="http://www.itbully.com/sites/default/files/wlw/image_thumb.png" border="0" height="239" width="390" /&gt;&lt;/a&gt; &lt;/div&gt;   &lt;/li&gt;    &lt;li&gt;     

&lt;div align="justify"&gt;I add the appropriate mapping by selecting a crawled metadata property to map to this managed property (ex ows_PID)        &lt;br /&gt;
&lt;a href="http://www.itbully.com/sites/default/files/wlw/image_0.png"&gt;
&lt;img style="border-width: 0px; display: inline;" title="image" alt="image" src="http://www.itbully.com/sites/default/files/wlw/image_thumb_0.png" border="0" height="284" width="379" /&gt;&lt;/a&gt; &lt;/div&gt;   &lt;/li&gt;    &lt;li&gt;     

&lt;div align="justify"&gt;I Press the OK button&lt;/div&gt;   &lt;/li&gt; &lt;/ul&gt;  

&lt;p align="justify"&gt;At this point I repeat the same procedure for the next six (6) managed properties I want to create:    &lt;br /&gt;
&lt;a href="http://www.itbully.com/sites/default/files/wlw/image_1.png"&gt;
&lt;img style="border-width: 0px; display: inline;" title="image" alt="image" src="http://www.itbully.com/sites/default/files/wlw/image_thumb_1.png" border="0" height="173" width="532" /&gt;&lt;/a&gt; &lt;/p&gt;  

&lt;p align="justify"&gt;From that point, I want to modify my search results page. In my search results page I want to display, in a tabular format, the ProtPID, ProtSubject, ProtINOUT, ProtDocumentDate, ProtNTOriginDestination and ProtEXTOriginDestination properties I have created in the previous steps. SharePoint server/services return the search results in an XML format. The visual presentation of this XML format is done by XSLT and CSS. So, in order to manipulate the visual representation of those results I have to extract their raw XML form. &lt;/p&gt;  

&lt;p align="justify"&gt;To extract the raw XML form of my search results:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;     

&lt;div align="justify"&gt;I navigate to my search center web site&lt;/div&gt;   &lt;/li&gt;    &lt;li&gt;     

&lt;div align="justify"&gt;I submit a search term in the search box (ex Test)&lt;/div&gt;   &lt;/li&gt;    &lt;li&gt;     

&lt;div align="justify"&gt;In the search results page I navigate to the &lt;em&gt;site actions &lt;/em&gt;menu and I select the &lt;em&gt;edit page &lt;/em&gt;menu item         &lt;br /&gt;
&lt;a href="http://www.itbully.com/sites/default/files/wlw/image_2.png"&gt;
&lt;img style="border-width: 0px; display: inline;" title="image" alt="image" src="http://www.itbully.com/sites/default/files/wlw/image_thumb_2.png" border="0" height="158" width="244" /&gt;&lt;/a&gt; &lt;/div&gt;   &lt;/li&gt;    &lt;li&gt;     

&lt;div align="justify"&gt;I select the edit menu of the &lt;em&gt;Search Core Results&lt;/em&gt; WebPart and the &lt;em&gt;Modify Shared Web Part &lt;/em&gt;option         &lt;br /&gt;
&lt;a href="http://www.itbully.com/sites/default/files/wlw/image_3.png"&gt;
&lt;img style="border-width: 0px; display: inline;" title="image" alt="image" src="http://www.itbully.com/sites/default/files/wlw/image_thumb_3.png" border="0" height="180" width="215" /&gt;&lt;/a&gt; &lt;/div&gt;   &lt;/li&gt;    &lt;li&gt;     

&lt;div align="justify"&gt;In the &lt;em&gt;Search Core Results&lt;/em&gt; –&amp;gt; &lt;em&gt;Data View Properties –&amp;gt; I &lt;/em&gt;press&lt;em&gt; XSL Editor..          &lt;br /&gt;
&lt;a href="http://www.itbully.com/sites/default/files/wlw/image_4.png"&gt;
&lt;img style="border-width: 0px; display: inline;" title="image" alt="image" src="http://www.itbully.com/sites/default/files/wlw/image_thumb_4.png" border="0" height="244" width="193" /&gt;&lt;/a&gt; &lt;/em&gt;&amp;nbsp;&lt;/div&gt;   &lt;/li&gt;    &lt;li&gt;     

&lt;div align="justify"&gt;I replace all code with the following:&lt;/div&gt;      

&lt;table border="1" cellpadding="2" cellspacing="0" width="400"&gt;
&lt;tbody&gt;         &lt;tr&gt;           &lt;td valign="top" width="398"&gt;&amp;lt;xsl:stylesheet version="1.0" xmlns:xsl="&lt;a href="http://www.w3.org/1999/XSL/Transform%22"&gt;http://www.w3.org/1999/XSL/Transform"&lt;/a&gt; &amp;gt;               &lt;br /&gt;
&amp;lt;xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" /&amp;gt;               &lt;br /&gt;
&amp;lt;xsl:template match="/"&amp;gt;               &lt;br /&gt;
&amp;lt;xmp&amp;gt;&amp;lt;xsl:copy-of select="*"/&amp;gt;&amp;lt;/xmp&amp;gt;               &lt;br /&gt;
&amp;lt;/xsl:template&amp;gt;               &lt;br /&gt;
&amp;lt;/xsl:stylesheet&amp;gt;&lt;/td&gt;         &lt;/tr&gt;       &lt;/tbody&gt;
&lt;/table&gt;      

&lt;div align="justify"&gt;&amp;nbsp;&lt;/div&gt;   &lt;/li&gt;    &lt;li&gt;     

&lt;div align="justify"&gt;I press the apply Button&lt;/div&gt;   &lt;/li&gt; &lt;/ul&gt;  

&lt;p&gt;Notice the changes to the core results. A raw XML format of the results is displayed. But wait a minute… Where is the managed properties I created earlier? The answer is nowhere. I need to tell the WebPart to add those properties to the XML results:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;In the &lt;em&gt;Results Query Options&lt;/em&gt; of the &lt;em&gt;Search Core Results &lt;/em&gt;properties, press the … icon in the &lt;em&gt;Selected Columns &lt;/em&gt;option       &lt;br /&gt;
&lt;a href="http://www.itbully.com/sites/default/files/wlw/image_5.png"&gt;
&lt;img style="border-width: 0px; display: inline;" title="image" alt="image" src="http://www.itbully.com/sites/default/files/wlw/image_thumb_5.png" border="0" height="244" width="142" /&gt;&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;Notice the format of and the changes I made to the bottom of the XML:      &lt;br /&gt;
      

&lt;table border="1" cellpadding="2" cellspacing="0" width="400"&gt;
&lt;tbody&gt;         &lt;tr&gt;           &lt;td valign="top" width="400"&gt;&amp;lt;root xmlns:xsi="&lt;a href="http://www.w3.org/2001/XMLSchema-instance%22"&gt;http://www.w3.org/2001/XMLSchema-instance"&lt;/a&gt;&amp;gt;               &lt;br /&gt;
&amp;lt;Columns&amp;gt;               &lt;br /&gt;
&amp;lt;Column Name="WorkId"/&amp;gt;               &lt;br /&gt;
&amp;lt;Column Name="Rank"/&amp;gt;&amp;lt;Column Name="Title"/&amp;gt;               &lt;br /&gt;
&amp;lt;Column Name="Author"/&amp;gt;               &lt;br /&gt;
&amp;lt;Column Name="Size"/&amp;gt;               &lt;br /&gt;
&amp;lt;Column Name="Path"/&amp;gt;               &lt;br /&gt;
&amp;lt;Column Name="Description"/&amp;gt;               &lt;br /&gt;
&amp;lt;Column Name="Write"/&amp;gt;&amp;lt;Column Name="SiteName"/&amp;gt;               &lt;br /&gt;
&amp;lt;Column Name="CollapsingStatus"/&amp;gt;               &lt;br /&gt;
&amp;lt;Column Name="HitHighlightedSummary"/&amp;gt;               &lt;br /&gt;
&amp;lt;Column Name="HitHighlightedProperties"/&amp;gt;               &lt;br /&gt;
&amp;lt;Column Name="ContentClass"/&amp;gt;&amp;nbsp; &lt;br /&gt;
&amp;lt;Column Name="IsDocument"/&amp;gt;               &lt;br /&gt;
&amp;lt;Column Name="PictureThumbnailURL"/&amp;gt;               &lt;br /&gt;
&lt;span style="color: rgb(0, 128, 128);"&gt;
&lt;strong&gt;
&lt;em&gt;&amp;lt;Column Name="ProtOurPID"/&amp;gt;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;lt;Column Name="ProtSubject"/&amp;gt;                     &lt;br /&gt;
&amp;lt;Column Name="ProtINOUT"/&amp;gt;                     &lt;br /&gt;
&amp;lt;Column Name="ProtDocumentDate"/&amp;gt;                     &lt;br /&gt;
&amp;lt;Column Name="ProtINTOriginDestination"/&amp;gt;                     &lt;br /&gt;
&amp;lt;Column Name="ProtEXTOriginDestination"/&amp;gt;&lt;/em&gt;                   &lt;br /&gt;
&lt;/strong&gt;
&lt;/span&gt;&amp;lt;/Columns&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;lt;/root&amp;gt;&lt;/td&gt;         &lt;/tr&gt;       &lt;/tbody&gt;
&lt;/table&gt;   &lt;/li&gt;    &lt;li&gt;Before the closing Columns statement &amp;lt;/Columns&amp;gt; I added 6 of my managed properties in the form of: &lt;em&gt;&amp;lt;Column Name=”MyManagedProperty” /&amp;gt;&lt;/em&gt; &lt;/li&gt;    &lt;li&gt;I press the OK Button &lt;/li&gt; &lt;/ul&gt;  

&lt;p&gt;Now, I have my Raw XML results with my managed properties included. To manipulate their layout using Sharepoint Designer, I have to save those results as an XML file and import it as a data source:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;I copy the raw XML format of the search results (from &amp;lt;All_Results&amp;gt; to &amp;lt;/All_results&amp;gt;) into notepad and I save the file as &lt;em&gt;RawXMLResults.xml&lt;/em&gt; to c:\ &lt;/li&gt;    &lt;li&gt;I open my SharePoint site and I temporarily save the &lt;em&gt;RawXMLResults.xml&lt;/em&gt; to one of my document libraries &lt;/li&gt;    &lt;li&gt;In SharePoint Designer I create a new ASPX page      &lt;br /&gt;
&lt;a href="http://www.itbully.com/sites/default/files/wlw/image_6.png"&gt;
&lt;img style="border-width: 0px; display: inline;" title="image" alt="image" src="http://www.itbully.com/sites/default/files/wlw/image_thumb_6.png" border="0" height="244" width="239" /&gt;&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;In the &lt;em&gt;Data View&lt;/em&gt; menu I select the &lt;em&gt;Insert Data View &lt;/em&gt;Option…       &lt;br /&gt;
&lt;a href="http://www.itbully.com/sites/default/files/wlw/image_7.png"&gt;
&lt;img style="border-width: 0px; display: inline;" title="image" alt="image" src="http://www.itbully.com/sites/default/files/wlw/image_thumb_7.png" border="0" height="78" width="205" /&gt;&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;In the &lt;em&gt;Data Source Library (&lt;/em&gt;Right Pane in SharePoint Designer) I expand the &lt;em&gt;XML Files&lt;/em&gt;, and I select the &lt;em&gt;Add an XML File… &lt;/em&gt;hyperlink:       &lt;br /&gt;
&lt;a href="http://www.itbully.com/sites/default/files/wlw/image_8.png"&gt;
&lt;img style="border-width: 0px; display: inline;" title="image" alt="image" src="http://www.itbully.com/sites/default/files/wlw/image_thumb_8.png" border="0" height="244" width="115" /&gt;&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;In the new window I select the &lt;em&gt;Source&lt;/em&gt; tab and I browse for the &lt;em&gt;RawXMLResults.xml&lt;/em&gt; file I saved in a previous step to one of my document libraries &lt;/li&gt;    &lt;li&gt;After pressing OK the new XML file appears in the list of my XML Datasources &lt;/li&gt;    &lt;li&gt;By selecting the file, a drop down menu appears. I click the &lt;em&gt;Show Data &lt;/em&gt;Option       &lt;br /&gt;
&lt;a href="http://www.itbully.com/sites/default/files/wlw/image_9.png"&gt;
&lt;img style="border-width: 0px; display: inline;" title="image" alt="image" src="http://www.itbully.com/sites/default/files/wlw/image_thumb_9.png" border="0" height="244" width="215" /&gt;&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;Having selected the data source webpart in my ASPX Page      &lt;br /&gt;
&lt;a href="http://www.itbully.com/sites/default/files/wlw/image_10.png"&gt;
&lt;img style="border-width: 0px; display: inline;" title="image" alt="image" src="http://www.itbully.com/sites/default/files/wlw/image_thumb_10.png" border="0" height="55" width="373" /&gt;&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;I select the columns I want to add to my layout and from the &lt;em&gt;Insert Selected Fields as…&lt;/em&gt;&amp;nbsp; menu, I select the &lt;em&gt;Multiple Item View&lt;/em&gt;       &lt;br /&gt;
&lt;a href="http://www.itbully.com/sites/default/files/wlw/image_11.png"&gt;
&lt;img style="border-width: 0px; display: inline;" title="image" alt="image" src="http://www.itbully.com/sites/default/files/wlw/image_thumb_11.png" border="0" height="244" width="160" /&gt;&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;Note that the order I selected the columns, is the order that is displayed in my table &lt;/li&gt;    &lt;li&gt;After making the appropriate modifications to my layout, I need to copy the XSLT code&amp;nbsp; and paste it back to my &lt;em&gt;Search Core Results W&lt;/em&gt;ebPart. I copy the code from the &amp;lt;xsl:stylesheet … to the &amp;lt;/xsl:stylesheet&amp;gt; element.       &lt;br /&gt;
&lt;a href="http://www.itbully.com/sites/default/files/wlw/image_12.png"&gt;
&lt;img style="border-width: 0px; display: inline;" title="image" alt="image" src="http://www.itbully.com/sites/default/files/wlw/image_thumb_12.png" border="0" height="334" width="394" /&gt;&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;My final step is to paste the code to the &lt;em&gt;XSL Editor…&lt;/em&gt; in my &lt;em&gt;Search Core Results W&lt;/em&gt;ebPart properties to see the effect.       &lt;br /&gt;
&lt;a href="http://www.itbully.com/sites/default/files/wlw/image_4.png"&gt;
&lt;img style="border-width: 0px; display: inline;" title="image" alt="image" src="http://www.itbully.com/sites/default/files/wlw/image_thumb_4.png" border="0" height="244" width="193" /&gt;&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt;  

&lt;p&gt;Personally I prefer to manipulate XSLT by using external file references instead of pasting the code directly to the WebPart. If you want to achieve the same, do the following:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Create a document library to host your XSL files (ex Transformations) &lt;/li&gt;    &lt;li&gt;Instead of pasting the code from Sharepoint Designer directly to the WebPart, paste it to notepad and save the file as &lt;em&gt;something.xsl&lt;/em&gt; &lt;/li&gt;    &lt;li&gt;Upload &lt;em&gt;something.xsl&lt;/em&gt; to your document library &lt;/li&gt;    &lt;li&gt;In the &lt;em&gt;XSL Editor…&lt;/em&gt; of the &lt;em&gt;Search Core Results&lt;/em&gt; WebPart Reference to the file by using the sample code below:       &lt;br /&gt;
      

&lt;table border="1" cellpadding="2" cellspacing="0" width="400"&gt;
&lt;tbody&gt;         &lt;tr&gt;           &lt;td valign="top" width="400"&gt;             

&lt;p&gt;&amp;lt;?xml version="1.0" encoding="ISO-8859-1"?&amp;gt;                &lt;br /&gt;
&amp;lt;xsl:stylesheet version="1.0"                 &lt;br /&gt;
xmlns:xsl="&lt;a href="http://www.w3.org/1999/XSL/Transform%22"&gt;http://www.w3.org/1999/XSL/Transform"&lt;/a&gt;&amp;gt; &lt;/p&gt;              

&lt;p&gt;&amp;lt;xsl:import href="&lt;strong&gt;/Transformations/something.xsl&lt;/strong&gt;"/&amp;gt; &lt;/p&gt;              

&lt;p&gt;&amp;lt;xsl:template match="/"&amp;gt;                &lt;br /&gt;
&amp;nbsp; &amp;lt;xsl:apply-imports/&amp;gt;                 &lt;br /&gt;
&amp;lt;/xsl:template&amp;gt; &lt;/p&gt;              

&lt;p&gt;&amp;lt;/xsl:stylesheet&amp;gt; &lt;/p&gt;           &lt;/td&gt;         &lt;/tr&gt;       &lt;/tbody&gt;
&lt;/table&gt;   &lt;/li&gt; &lt;/ul&gt;  

&lt;p align="justify"&gt;A last thing. In order to be able to sort results by relevance / by date and to display the predefined text in case there are no results to return back, you have to copy the following code from the shipped results XSLT to your custom one:&lt;/p&gt;  

&lt;table border="1" cellpadding="2" cellspacing="0" width="617"&gt;
&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" &gt;         

&lt;p&gt;&amp;lt;xsl:param name="ResultsBy" /&amp;gt;            &lt;br /&gt;
&amp;lt;xsl:param name="ViewByUrl" /&amp;gt;             &lt;br /&gt;
&amp;lt;xsl:param name="ViewByValue" /&amp;gt;             &lt;br /&gt;
&amp;lt;xsl:param name="IsNoKeyword" /&amp;gt;             &lt;br /&gt;
&amp;lt;xsl:param name="IsFixedQuery" /&amp;gt;             &lt;br /&gt;
&amp;lt;xsl:param name="ShowActionLinks" /&amp;gt;             &lt;br /&gt;
&amp;lt;xsl:param name="MoreResultsText" /&amp;gt;             &lt;br /&gt;
&amp;lt;xsl:param name="MoreResultsLink" /&amp;gt;             &lt;br /&gt;
&amp;lt;xsl:param name="CollapsingStatusLink" /&amp;gt;             &lt;br /&gt;
&amp;lt;xsl:param name="CollapseDuplicatesText" /&amp;gt;             &lt;br /&gt;
&amp;lt;xsl:param name="AlertMeLink" /&amp;gt;             &lt;br /&gt;
&amp;lt;xsl:param name="AlertMeText" /&amp;gt;             &lt;br /&gt;
&amp;lt;xsl:param name="SrchRSSText" /&amp;gt;             &lt;br /&gt;
&amp;lt;xsl:param name="SrchRSSLink" /&amp;gt;             &lt;br /&gt;
&amp;lt;xsl:param name="ShowMessage" /&amp;gt;             &lt;br /&gt;
&amp;lt;xsl:param name="IsThisListScope" /&amp;gt;             &lt;br /&gt;
&amp;lt;xsl:param name="DisplayDiscoveredDefinition" select="True" /&amp;gt;             &lt;br /&gt;
&amp;lt;xsl:param name="NoFixedQuery" /&amp;gt;             &lt;br /&gt;
&amp;lt;xsl:param name="NoKeyword" /&amp;gt;             &lt;br /&gt;
&amp;lt;xsl:param name="NoResults" /&amp;gt;             &lt;br /&gt;
&amp;lt;xsl:param name="NoResults1" /&amp;gt;             &lt;br /&gt;
&amp;lt;xsl:param name="NoResults2" /&amp;gt;             &lt;br /&gt;
&amp;lt;xsl:param name="NoResults3" /&amp;gt;             &lt;br /&gt;
&amp;lt;xsl:param name="NoResults4" /&amp;gt;             &lt;br /&gt;
&amp;lt;xsl:param name="DefinitionIntro" /&amp;gt; &lt;/p&gt;          

&lt;p&gt;&amp;lt;!-- When there is keywory to issue the search --&amp;gt;            &lt;br /&gt;
&amp;lt;xsl:template name="dvt_1.noKeyword"&amp;gt;             &lt;br /&gt;
&amp;nbsp; &amp;lt;span class="srch-description"&amp;gt;             &lt;br /&gt;
&amp;nbsp; &amp;lt;xsl:choose&amp;gt;             &lt;br /&gt;
&amp;nbsp; &amp;lt;xsl:when test="$IsFixedQuery"&amp;gt;             &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;xsl:value-of select="$NoFixedQuery" /&amp;gt;             &lt;br /&gt;
&amp;nbsp; &amp;lt;/xsl:when&amp;gt;             &lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;lt;xsl:otherwise&amp;gt;             &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;xsl:value-of select="$NoKeyword" /&amp;gt;             &lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;lt;/xsl:otherwise&amp;gt;             &lt;br /&gt;
&amp;nbsp; &amp;lt;/xsl:choose&amp;gt;             &lt;br /&gt;
&amp;nbsp; &amp;lt;/span&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;lt;/xsl:template&amp;gt; &lt;/p&gt;          

&lt;p&gt;&amp;lt;!-- When empty result set is returned from search --&amp;gt;            &lt;br /&gt;
&amp;lt;xsl:template name="dvt_1.empty"&amp;gt;             &lt;br /&gt;
&amp;lt;div class="srch-sort"&amp;gt;             &lt;br /&gt;
&amp;nbsp; &amp;lt;xsl:if test="$AlertMeLink and $ShowActionLinks"&amp;gt;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;span class="srch-alertme" &amp;gt; &amp;lt;a href ="{$AlertMeLink}" id="CSR_AM1" title="{$AlertMeText}"&amp;gt;&amp;lt;img style="vertical-align: middle;" src="/_layouts/images/bell.gif" alt="" border="0"/&amp;gt;&amp;lt;xsl:text disable-output-escaping="yes"&amp;gt;&amp;amp;amp;nbsp;&amp;lt;/xsl:text&amp;gt;&amp;lt;xsl:value-of select="$AlertMeText" /&amp;gt;&amp;lt;/a&amp;gt;             &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/span&amp;gt;             &lt;br /&gt;
&amp;nbsp; &amp;lt;/xsl:if&amp;gt; &lt;/p&gt;          

&lt;p&gt;&amp;nbsp; &amp;lt;xsl:if test="string-length($SrchRSSLink) &amp;amp;gt; 0 and $ShowActionLinks"&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;lt;xsl:if test="$AlertMeLink"&amp;gt;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; |             &lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;lt;/xsl:if&amp;gt;             &lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;lt;a type="application/rss+xml" href ="{$SrchRSSLink}" title="{$SrchRSSText}" id="SRCHRSSL"&amp;gt;&amp;lt;img style="vertical-align: middle;" border="0" src="/_layouts/images/rss.gif" alt=""/&amp;gt;&amp;lt;xsl:text disable-output-escaping="yes"&amp;gt;&amp;amp;amp;nbsp;&amp;lt;/xsl:text&amp;gt;&amp;lt;xsl:value-of select="$SrchRSSText"/&amp;gt;&amp;lt;/a&amp;gt;             &lt;br /&gt;
&amp;nbsp; &amp;lt;/xsl:if&amp;gt;             &lt;br /&gt;
&amp;lt;/div&amp;gt;             &lt;br /&gt;
&amp;lt;br/&amp;gt; &amp;lt;br/&amp;gt; &lt;/p&gt;          

&lt;p&gt;&amp;nbsp; &amp;lt;span class="srch-description" id="CSR_NO_RESULTS"&amp;gt;            &lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;lt;xsl:value-of select="$NoResults" /&amp;gt; &lt;/p&gt;          

&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;ol&amp;gt;            &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;li&amp;gt;&amp;lt;xsl:value-of select="$NoResults1" /&amp;gt;&amp;lt;/li&amp;gt;             &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;li&amp;gt;&amp;lt;xsl:value-of select="$NoResults2" /&amp;gt;&amp;lt;/li&amp;gt;             &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;li&amp;gt;&amp;lt;xsl:value-of select="$NoResults3" /&amp;gt;&amp;lt;/li&amp;gt;             &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;li&amp;gt;&amp;lt;xsl:value-of select="$NoResults4" /&amp;gt;&amp;lt;/li&amp;gt;             &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/ol&amp;gt;             &lt;br /&gt;
&amp;nbsp; &amp;lt;/span&amp;gt;             &lt;br /&gt;
&amp;lt;/xsl:template&amp;gt; &lt;/p&gt;          

&lt;p&gt;&amp;lt;!-- Main body template. Sets the Results view (Relevance or date) options --&amp;gt;            &lt;br /&gt;
&amp;lt;xsl:template name="dvt_1.body"&amp;gt;             &lt;br /&gt;
&amp;nbsp; &amp;lt;div class="srch-results"&amp;gt;             &lt;br /&gt;
&amp;nbsp; &amp;lt;xsl:if test="$ShowActionLinks"&amp;gt;             &lt;br /&gt;
&amp;nbsp; &amp;lt;div class="srch-sort"&amp;gt; &amp;lt;xsl:value-of select="$ResultsBy" /&amp;gt;             &lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;lt;xsl:if test="$ViewByUrl"&amp;gt;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |             &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;a href ="{$ViewByUrl}" id="CSR_RV" title="{$ViewByValue}"&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;xsl:value-of select="$ViewByValue" /&amp;gt;             &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/a&amp;gt;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;lt;/xsl:if&amp;gt;             &lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;lt;xsl:if test="$AlertMeLink"&amp;gt;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |             &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;span class="srch-alertme" &amp;gt; &amp;lt;a href ="{$AlertMeLink}" id="CSR_AM2" title="{$AlertMeText}"&amp;gt;&amp;lt;img style="vertical-align: middle;" src="/_layouts/images/bell.gif" alt="" border="0"/&amp;gt;&amp;lt;xsl:text disable-output-escaping="yes"&amp;gt;&amp;amp;amp;nbsp;&amp;lt;/xsl:text&amp;gt;&amp;lt;xsl:value-of select="$AlertMeText" /&amp;gt;&amp;lt;/a&amp;gt;             &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/span&amp;gt;             &lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;lt;/xsl:if&amp;gt;             &lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;lt;xsl:if test="string-length($SrchRSSLink) &amp;amp;gt; 0"&amp;gt;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; |             &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;a type="application/rss+xml" href ="{$SrchRSSLink}" title="{$SrchRSSText}" id="SRCHRSSL"&amp;gt;&amp;lt;img style="vertical-align: middle;" border="0" src="/_layouts/images/rss.gif" alt=""/&amp;gt;&amp;lt;xsl:text disable-output-escaping="yes"&amp;gt;&amp;amp;amp;nbsp;&amp;lt;/xsl:text&amp;gt;&amp;lt;xsl:value-of select="$SrchRSSText"/&amp;gt;&amp;lt;/a&amp;gt;             &lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;lt;/xsl:if&amp;gt;             &lt;br /&gt;
&amp;nbsp; &amp;lt;/div&amp;gt;             &lt;br /&gt;
&amp;nbsp; &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;             &lt;br /&gt;
&amp;nbsp; &amp;lt;/xsl:if&amp;gt;             &lt;br /&gt;
&amp;nbsp; &amp;lt;xsl:apply-templates /&amp;gt; &lt;/p&gt;          

&lt;p&gt;&amp;nbsp; &amp;lt;/div&amp;gt;&amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;lt;xsl:call-template name="DisplayMoreResultsAnchor" /&amp;gt;             &lt;br /&gt;
&amp;lt;/xsl:template&amp;gt; &lt;/p&gt;          

&lt;p&gt;
&lt;strong&gt;
&lt;span style="color: rgb(255, 0, 0);"&gt;&amp;lt;!—Your Results Template Goes Here –&amp;gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;
&lt;/strong&gt;
&lt;/p&gt;          

&lt;p&gt;
&lt;strong&gt;
&lt;span style="color: rgb(255, 0, 0);"&gt;&amp;lt;!—Your Results Template Goes Here –&amp;gt;&lt;/span&gt;
&lt;/strong&gt;&amp;nbsp;&amp;nbsp; &lt;/p&gt;          

&lt;p&gt;&amp;lt;!-- The "view more results" for fixed query --&amp;gt;            &lt;br /&gt;
&amp;lt;xsl:template name="DisplayMoreResultsAnchor"&amp;gt;             &lt;br /&gt;
&amp;nbsp; &amp;lt;xsl:if test="$MoreResultsLink"&amp;gt;             &lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;lt;a href="{$MoreResultsLink}" id="CSR_MRL"&amp;gt;             &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;xsl:value-of select="$MoreResultsText"/&amp;gt;             &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/a&amp;gt;             &lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;lt;/xsl:if&amp;gt;             &lt;br /&gt;
&amp;lt;/xsl:template&amp;gt; &lt;/p&gt;          

&lt;p&gt;&amp;lt;xsl:template match="All_Results/DiscoveredDefinitions"&amp;gt;            &lt;br /&gt;
&amp;nbsp; &amp;lt;xsl:variable name="FoundIn" select="DDFoundIn" /&amp;gt;             &lt;br /&gt;
&amp;nbsp; &amp;lt;xsl:variable name="DDSearchTerm" select="DDSearchTerm" /&amp;gt;             &lt;br /&gt;
&amp;nbsp; &amp;lt;xsl:if test="$DisplayDiscoveredDefinition = 'True' and string-length($DDSearchTerm) &amp;amp;gt; 0"&amp;gt;             &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;script language="javascript"&amp;gt;             &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; function ToggleDefinitionSelection()             &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {             &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var selection = document.getElementById("definitionSelection");             &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (selection.style.display == "none")             &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {             &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; selection.style.display = "inline";             &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }             &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else             &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {             &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; selection.style.display = "none";             &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }             &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }             &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/script&amp;gt;             &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;div&amp;gt;             &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;a href="#" onclick="ToggleDefinitionSelection(); return false;"&amp;gt;             &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;xsl:value-of select="$DefinitionIntro" /&amp;gt;&amp;lt;b&amp;gt;&amp;lt;xsl:value-of select="$DDSearchTerm"/&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;/a&amp;gt;             &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;div id="definitionSelection" class="srch-Description" style="display:none;"&amp;gt;             &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;xsl:for-each select="DDefinitions/DDefinition"&amp;gt;             &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;br/&amp;gt;             &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;xsl:variable name="DDUrl" select="DDUrl" /&amp;gt;             &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;xsl:value-of select="DDStart"/&amp;gt;             &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;b&amp;gt;             &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;xsl:value-of select="DDBold"/&amp;gt;             &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/b&amp;gt;             &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;xsl:value-of select="DDEnd"/&amp;gt;             &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;br/&amp;gt;             &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;xsl:value-of select="$FoundIn"/&amp;gt;             &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;a href="{$DDUrl}"&amp;gt;             &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;xsl:value-of select="DDTitle"/&amp;gt;             &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/a&amp;gt;             &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/xsl:for-each&amp;gt;             &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/div&amp;gt;             &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/div&amp;gt;             &lt;br /&gt;
&amp;nbsp; &amp;lt;/xsl:if&amp;gt;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;lt;/xsl:template&amp;gt; &lt;/p&gt;          

&lt;p&gt;&amp;lt;!-- XSL transformation starts here --&amp;gt;            &lt;br /&gt;
&amp;lt;xsl:template match="/"&amp;gt;             &lt;br /&gt;
&amp;nbsp; &amp;lt;xsl:if test="$AlertMeLink"&amp;gt;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;lt;input type="hidden" name="P_Query" /&amp;gt;             &lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;lt;input type="hidden" name="P_LastNotificationTime" /&amp;gt;             &lt;br /&gt;
&amp;nbsp; &amp;lt;/xsl:if&amp;gt;             &lt;br /&gt;
&amp;nbsp; &amp;lt;xsl:choose&amp;gt;             &lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;lt;xsl:when test="$IsNoKeyword = 'True'" &amp;gt;             &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;xsl:call-template name="dvt_1.noKeyword" /&amp;gt;             &lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;lt;/xsl:when&amp;gt;             &lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;lt;xsl:when test="$ShowMessage = 'True'"&amp;gt;             &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;xsl:call-template name="dvt_1.empty" /&amp;gt;             &lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;lt;/xsl:when&amp;gt;             &lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;lt;xsl:otherwise&amp;gt;             &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;xsl:call-template name="dvt_1.body"/&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;lt;/xsl:otherwise&amp;gt;             &lt;br /&gt;
&amp;nbsp; &amp;lt;/xsl:choose&amp;gt;             &lt;br /&gt;
&amp;lt;/xsl:template&amp;gt; &lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;
&lt;/table&gt;&lt;img src="http://feeds.feedburner.com/~r/Itbully/~4/FS-mTpfwrq0" height="1" width="1"/&gt;</description>
 <comments>http://www.itbully.com/articles/moss-search-saga-modifying-search-result-page#comments</comments>
 <category domain="http://www.itbully.com/category/tags/moss">MOSS</category>
 <category domain="http://www.itbully.com/category/tags/search">Search</category>
 <category domain="http://www.itbully.com/category/tags/sharepoint">Sharepoint</category>
 <pubDate>Tue, 24 Nov 2009 11:25:00 +0000</pubDate>
 <dc:creator>Lefteris Karafilis</dc:creator>
 <guid isPermaLink="false">46 at http://www.itbully.com</guid>
<feedburner:origLink>http://www.itbully.com/articles/moss-search-saga-modifying-search-result-page</feedburner:origLink></item>
<item>
 <title>The MOSS Search Saga: Modifying the advanced search page</title>
 <link>http://feedproxy.google.com/~r/Itbully/~3/iip9IEe8N-4/moss-search-saga-modifying-advanced-search-page</link>
 <description>&lt;p align="justify"&gt;In a &lt;a href="http://www.itbully.com/articles/moss-search-saga-modifying-search-result-page"&gt;previous post&lt;/a&gt; of mine I explained how to create managed properties and modify the search results page for a custom Protocol application. In this post I am going to continue from my previous example by modifying the advanced search tab.&lt;/p&gt;  

&lt;p align="justify"&gt;The idea is to modify the search page in order to include some of my managed properties in the search query logic, add the “contains” and “does not contain” equation in my search expressions and limit the language query options to English an Greek only.&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;     

&lt;div align="justify"&gt;I navigate to the advanced search page and I go into edit page mode        &lt;br /&gt;
&lt;a href="http://lh3.ggpht.com/_muhEKRxmy8M/SpOyNy1UvtI/AAAAAAAAAIs/KN3IFx-Di2w/s1600-h/image%5B15%5D.png"&gt;
&lt;img title="image" alt="image" src="http://lh4.ggpht.com/_muhEKRxmy8M/SpOyPNYoO2I/AAAAAAAAAIw/AvJKQdtkO2A/image_thumb%5B7%5D.png?imgmax=800" border="0" height="158" width="244" /&gt;&lt;/a&gt;
&lt;/div&gt;   &lt;/li&gt;    &lt;li&gt;     

&lt;div align="justify"&gt;I select the edit menu of the &lt;em&gt;Advanced Search Box &lt;/em&gt;webpart and the &lt;em&gt;Modify Shared Web part &lt;/em&gt;option         &lt;br /&gt;
&lt;a href="http://lh5.ggpht.com/_muhEKRxmy8M/SpOyQAgt_zI/AAAAAAAAAI0/xpjCD21Cjlg/s1600-h/image%5B18%5D.png"&gt;
&lt;img title="image" alt="image" src="http://lh6.ggpht.com/_muhEKRxmy8M/SpOyRF1W5FI/AAAAAAAAAI4/0CZ9DDwFyak/image_thumb%5B8%5D.png?imgmax=800" border="0" height="180" width="215" /&gt;&lt;/a&gt;
&lt;/div&gt;   &lt;/li&gt;    &lt;li&gt;     

&lt;div align="justify"&gt;In the &lt;em&gt;Advanced Search Box –&amp;gt; Properties –&amp;gt; I pres the … &lt;/em&gt;icon in the &lt;em&gt;Properties&lt;/em&gt; field         &lt;br /&gt;
&lt;a href="http://www.itbully.com/sites/default/files/wlw/image_13.png"&gt;
&lt;img style="border-width: 0px; display: inline;" title="image" alt="image" src="http://www.itbully.com/sites/default/files/wlw/image_thumb_13.png" border="0" height="244" width="100" /&gt;&lt;/a&gt; &lt;/div&gt;   &lt;/li&gt;    &lt;li&gt;     

&lt;div align="justify"&gt;A new window appears with the XML format of the advanced search properties&lt;/div&gt;      

&lt;table border="1" cellpadding="2" cellspacing="0" width="581"&gt;
&lt;tbody&gt;         &lt;tr&gt;           &lt;td valign="top" width="579"&gt;             

&lt;p&gt;&amp;lt;root xmlns:xsi="&lt;a href="http://www.w3.org/2001/XMLSchema-instance%22"&gt;http://www.w3.org/2001/XMLSchema-instance%22&lt;/a&gt;&amp;gt;                 &lt;br /&gt;
&lt;span style="color: rgb(255, 0, 0);"&gt;
&lt;strong&gt;&amp;lt;Option Name="AllowOpContains" Value="False"/&amp;gt;                    &lt;br /&gt;
&lt;/strong&gt;
&lt;/span&gt;&amp;lt;LangDefs&amp;gt;                 &lt;br /&gt;
&amp;lt;&lt;strong&gt;
&lt;span style="color: rgb(128, 128, 128);"&gt;LangDef DisplayName="Arabic" LangID="1"/&amp;gt;                    &lt;br /&gt;
&amp;lt;LangDef DisplayName="Bengali" LangID="69"/&amp;gt;                     &lt;br /&gt;
&amp;lt;LangDef DisplayName="Bulgarian" LangID="2"/&amp;gt;                     &lt;br /&gt;
&amp;lt;LangDef DisplayName="Catalan" LangID="3"/&amp;gt;                     &lt;br /&gt;
&amp;lt;LangDef DisplayName="Chinese" LangID="4"/&amp;gt;                     &lt;br /&gt;
&amp;lt;LangDef DisplayName="Croatian/Serbian" LangID="26"/&amp;gt;                     &lt;br /&gt;
&amp;lt;LangDef DisplayName="Czech" LangID="5"/&amp;gt;                     &lt;br /&gt;
&amp;lt;LangDef DisplayName="Danish" LangID="6"/&amp;gt;                     &lt;br /&gt;
&amp;lt;LangDef DisplayName="Dutch" LangID="19"/&amp;gt;                     &lt;br /&gt;
&amp;lt;LangDef DisplayName="Finnish" LangID="11"/&amp;gt;                     &lt;br /&gt;
&amp;lt;LangDef DisplayName="French" LangID="12"/&amp;gt;                     &lt;br /&gt;
&amp;lt;LangDef DisplayName="German" LangID="7"/&amp;gt;                     &lt;br /&gt;
&amp;lt;LangDef DisplayName="Greek" LangID="8"/&amp;gt;                     &lt;br /&gt;
&amp;lt;LangDef DisplayName="Gujrati" LangID="71"/&amp;gt;                     &lt;br /&gt;
&amp;lt;LangDef DisplayName="Hebrew" LangID="13"/&amp;gt;                     &lt;br /&gt;
&amp;lt;LangDef DisplayName="Hindi" LangID="57"/&amp;gt;                     &lt;br /&gt;
&amp;lt;LangDef DisplayName="Hungarian" LangID="14"/&amp;gt;                     &lt;br /&gt;
&amp;lt;LangDef DisplayName="Icelandic" LangID="15"/&amp;gt;                     &lt;br /&gt;
&amp;lt;LangDef DisplayName="Indonesian" LangID="33"/&amp;gt;                     &lt;br /&gt;
&amp;lt;LangDef DisplayName="Italian" LangID="16"/&amp;gt;                     &lt;br /&gt;
&amp;lt;LangDef DisplayName="Japanese" LangID="17"/&amp;gt;                     &lt;br /&gt;
&amp;lt;LangDef DisplayName="Kannada" LangID="75"/&amp;gt;                     &lt;br /&gt;
&amp;lt;LangDef DisplayName="Korean" LangID="18"/&amp;gt;                     &lt;br /&gt;
&amp;lt;LangDef DisplayName="Latvian" LangID="38"/&amp;gt;                     &lt;br /&gt;
&amp;lt;LangDef DisplayName="Lithuanian" LangID="39"/&amp;gt;                     &lt;br /&gt;
&amp;lt;LangDef DisplayName="Malay" LangID="62"/&amp;gt;                     &lt;br /&gt;
&amp;lt;LangDef DisplayName="Malayalam" LangID="76"/&amp;gt;                     &lt;br /&gt;
&amp;lt;LangDef DisplayName="Marathi" LangID="78"/&amp;gt;                     &lt;br /&gt;
&amp;lt;LangDef DisplayName="Norwegian" LangID="20"/&amp;gt;                     &lt;br /&gt;
&amp;lt;LangDef DisplayName="Polish" LangID="21"/&amp;gt;                     &lt;br /&gt;
&amp;lt;LangDef DisplayName="Portugese" LangID="22"/&amp;gt;                     &lt;br /&gt;
&amp;lt;LangDef DisplayName="Punjabi" LangID="70"/&amp;gt;                     &lt;br /&gt;
&amp;lt;LangDef DisplayName="Romanian" LangID="24"/&amp;gt;                     &lt;br /&gt;
&amp;lt;LangDef DisplayName="Russian" LangID="25"/&amp;gt;                     &lt;br /&gt;
&amp;lt;LangDef DisplayName="Slovak" LangID="27"/&amp;gt;                     &lt;br /&gt;
&amp;lt;LangDef DisplayName="Slovenian" LangID="36"/&amp;gt;                     &lt;br /&gt;
&amp;lt;LangDef DisplayName="Spanish" LangID="10"/&amp;gt;                     &lt;br /&gt;
&amp;lt;LangDef DisplayName="Swedish" LangID="29"/&amp;gt;                     &lt;br /&gt;
&amp;lt;LangDef DisplayName="Tamil" LangID="73"/&amp;gt;                     &lt;br /&gt;
&amp;lt;LangDef DisplayName="Telugu" LangID="74"/&amp;gt;                     &lt;br /&gt;
&amp;lt;LangDef DisplayName="Thai" LangID="30"/&amp;gt;                     &lt;br /&gt;
&amp;lt;LangDef DisplayName="Turkish" LangID="31"/&amp;gt;                     &lt;br /&gt;
&amp;lt;LangDef DisplayName="Ukrainian" LangID="34"/&amp;gt;                     &lt;br /&gt;
&amp;lt;LangDef DisplayName="Urdu" LangID="32"/&amp;gt;                     &lt;br /&gt;
&amp;lt;LangDef DisplayName="Vietnamese" LangID="42"/&amp;gt;                     &lt;br /&gt;
&lt;/span&gt;
&lt;/strong&gt;&amp;lt;/LangDefs&amp;gt;                 &lt;br /&gt;
&amp;lt;Languages&amp;gt;                 &lt;br /&gt;
&lt;strong&gt;
&lt;span style="color: rgb(255, 128, 0);"&gt;&amp;lt;Language LangRef="12"/&amp;gt;                    &lt;br /&gt;
&amp;lt;Language LangRef="7"/&amp;gt;                     &lt;br /&gt;
&amp;lt;Language LangRef="17"/&amp;gt;                     &lt;br /&gt;
&amp;lt;Language LangRef="10"/&amp;gt;                     &lt;br /&gt;
&lt;/span&gt;
&lt;/strong&gt;&amp;lt;/Languages&amp;gt;                 &lt;br /&gt;
&amp;lt;PropertyDefs&amp;gt;                 &lt;br /&gt;
&lt;strong&gt;
&lt;span style="color: rgb(0, 128, 255);"&gt;&amp;lt;PropertyDef Name="Path" DataType="text" DisplayName="URL"/&amp;gt;                    &lt;br /&gt;
&amp;lt;PropertyDef Name="Size" DataType="integer" DisplayName="Size"/&amp;gt;                     &lt;br /&gt;
&amp;lt;PropertyDef Name="Write" DataType="datetime" DisplayName="Last Modified Date"/&amp;gt;                     &lt;br /&gt;
&amp;lt;PropertyDef Name="FileName" DataType="text" DisplayName="Name"/&amp;gt;                     &lt;br /&gt;
&amp;lt;PropertyDef Name="Description" DataType="text" DisplayName="Description"/&amp;gt;                     &lt;br /&gt;
&amp;lt;PropertyDef Name="Title" DataType="text" DisplayName="Title"/&amp;gt;                     &lt;br /&gt;
&amp;lt;PropertyDef Name="Author" DataType="text" DisplayName="Author"/&amp;gt;                     &lt;br /&gt;
&amp;lt;PropertyDef Name="DocSubject" DataType="text" DisplayName="Subject"/&amp;gt;                     &lt;br /&gt;
&amp;lt;PropertyDef Name="DocKeywords" DataType="text" DisplayName="Keywords"/&amp;gt;                     &lt;br /&gt;
&amp;lt;PropertyDef Name="DocComments" DataType="text" DisplayName="Comments"/&amp;gt;                     &lt;br /&gt;
&amp;lt;PropertyDef Name="Manager" DataType="text" DisplayName="Manager"/&amp;gt;                     &lt;br /&gt;
&amp;lt;PropertyDef Name="Company" DataType="text" DisplayName="Company"/&amp;gt;                     &lt;br /&gt;
&amp;lt;PropertyDef Name="Created" DataType="datetime" DisplayName="Created Date"/&amp;gt;                     &lt;br /&gt;
&amp;lt;PropertyDef Name="CreatedBy" DataType="text" DisplayName="Created By"/&amp;gt;                     &lt;br /&gt;
&amp;lt;PropertyDef Name="ModifiedBy" DataType="text" DisplayName="Last Modified By"/&amp;gt;                     &lt;br /&gt;
&lt;/span&gt;
&lt;/strong&gt;&amp;lt;/PropertyDefs&amp;gt;                 &lt;br /&gt;
&amp;lt;ResultTypes&amp;gt;                 &lt;br /&gt;
&lt;span style="color: rgb(0, 128, 0);"&gt;
&lt;strong&gt;&amp;lt;ResultType DisplayName="All Results" Name="default"&amp;gt;                    &lt;br /&gt;
&amp;lt;Query/&amp;gt;                     &lt;br /&gt;
&amp;lt;PropertyRef Name="Author"/&amp;gt;                     &lt;br /&gt;
&amp;lt;PropertyRef Name="Description"/&amp;gt;                     &lt;br /&gt;
&amp;lt;PropertyRef Name="FileName"/&amp;gt;                     &lt;br /&gt;
&amp;lt;PropertyRef Name="Size"/&amp;gt;                     &lt;br /&gt;
&amp;lt;PropertyRef Name="Path"/&amp;gt;                     &lt;br /&gt;
&amp;lt;PropertyRef Name="Created"/&amp;gt;                     &lt;br /&gt;
&amp;lt;PropertyRef Name="Write"/&amp;gt;                     &lt;br /&gt;
&amp;lt;PropertyRef Name="CreatedBy"/&amp;gt;                     &lt;br /&gt;
&amp;lt;PropertyRef Name="ModifiedBy"/&amp;gt;                     &lt;br /&gt;
&amp;lt;/ResultType&amp;gt;                     &lt;br /&gt;
&amp;lt;ResultType DisplayName="Documents" Name="documents"&amp;gt;                     &lt;br /&gt;
&amp;lt;Query&amp;gt;IsDocument=1&amp;lt;/Query&amp;gt;                     &lt;br /&gt;
&amp;lt;PropertyRef Name="Author"/&amp;gt;                     &lt;br /&gt;
&amp;lt;PropertyRef Name="DocComments"/&amp;gt;                     &lt;br /&gt;
&amp;lt;PropertyRef Name="Description"/&amp;gt;                     &lt;br /&gt;
&amp;lt;PropertyRef Name="DocKeywords"/&amp;gt;                     &lt;br /&gt;
&amp;lt;PropertyRef Name="FileName"/&amp;gt;                     &lt;br /&gt;
&amp;lt;PropertyRef Name="Size"/&amp;gt;                     &lt;br /&gt;
&amp;lt;PropertyRef Name="DocSubject"/&amp;gt;                     &lt;br /&gt;
&amp;lt;PropertyRef Name="Path"/&amp;gt;                     &lt;br /&gt;
&amp;lt;PropertyRef Name="Created"/&amp;gt;                     &lt;br /&gt;
&amp;lt;PropertyRef Name="Write"/&amp;gt;                     &lt;br /&gt;
&amp;lt;PropertyRef Name="CreatedBy"/&amp;gt;                     &lt;br /&gt;
&amp;lt;PropertyRef Name="ModifiedBy"/&amp;gt;                     &lt;br /&gt;
&amp;lt;PropertyRef Name="Title"/&amp;gt;                     &lt;br /&gt;
&amp;lt;PropertyRef Name="Manager"/&amp;gt;                     &lt;br /&gt;
&amp;lt;PropertyRef Name="Company"/&amp;gt;                     &lt;br /&gt;
&amp;lt;/ResultType&amp;gt;                     &lt;br /&gt;
&amp;lt;ResultType DisplayName="Word Documents" Name="worddocuments"&amp;gt;                     &lt;br /&gt;
&amp;lt;Query&amp;gt;FileExtension='doc' Or FileExtension='docx' Or FileExtension='dot'&amp;lt;/Query&amp;gt;                     &lt;br /&gt;
&amp;lt;PropertyRef Name="Author"/&amp;gt;                     &lt;br /&gt;
&amp;lt;PropertyRef Name="DocComments"/&amp;gt;                     &lt;br /&gt;
&amp;lt;PropertyRef Name="Description"/&amp;gt;                     &lt;br /&gt;
&amp;lt;PropertyRef Name="DocKeywords"/&amp;gt;                     &lt;br /&gt;
&amp;lt;PropertyRef Name="FileName"/&amp;gt;                     &lt;br /&gt;
&amp;lt;PropertyRef Name="Size"/&amp;gt;                     &lt;br /&gt;
&amp;lt;PropertyRef Name="DocSubject"/&amp;gt;                     &lt;br /&gt;
&amp;lt;PropertyRef Name="Path"/&amp;gt;                     &lt;br /&gt;
&amp;lt;PropertyRef Name="Created"/&amp;gt;                     &lt;br /&gt;
&amp;lt;PropertyRef Name="Write"/&amp;gt;                     &lt;br /&gt;
&amp;lt;PropertyRef Name="CreatedBy"/&amp;gt;                     &lt;br /&gt;
&amp;lt;PropertyRef Name="ModifiedBy"/&amp;gt;                     &lt;br /&gt;
&amp;lt;PropertyRef Name="Title"/&amp;gt;                     &lt;br /&gt;
&amp;lt;PropertyRef Name="Manager"/&amp;gt;                     &lt;br /&gt;
&amp;lt;PropertyRef Name="Company"/&amp;gt;                     &lt;br /&gt;
&amp;lt;/ResultType&amp;gt;                     &lt;br /&gt;
&amp;lt;ResultType DisplayName="Excel Documents" Name="exceldocuments"&amp;gt;                     &lt;br /&gt;
&amp;lt;Query&amp;gt;FileExtension='xls' Or FileExtension='xlsx' Or FileExtension='xlt'&amp;lt;/Query&amp;gt;                     &lt;br /&gt;
&amp;lt;PropertyRef Name="Author"/&amp;gt;                     &lt;br /&gt;
&amp;lt;PropertyRef Name="DocComments"/&amp;gt;                     &lt;br /&gt;
&amp;lt;PropertyRef Name="Description"/&amp;gt;                     &lt;br /&gt;
&amp;lt;PropertyRef Name="DocKeywords"/&amp;gt;                     &lt;br /&gt;
&amp;lt;PropertyRef Name="FileName"/&amp;gt;                     &lt;br /&gt;
&amp;lt;PropertyRef Name="Size"/&amp;gt;                     &lt;br /&gt;
&amp;lt;PropertyRef Name="DocSubject"/&amp;gt;                     &lt;br /&gt;
&amp;lt;PropertyRef Name="Path"/&amp;gt;                     &lt;br /&gt;
&amp;lt;PropertyRef Name="Created"/&amp;gt;                     &lt;br /&gt;
&amp;lt;PropertyRef Name="Write"/&amp;gt;                     &lt;br /&gt;
&amp;lt;PropertyRef Name="CreatedBy"/&amp;gt;                     &lt;br /&gt;
&amp;lt;PropertyRef Name="ModifiedBy"/&amp;gt;                     &lt;br /&gt;
&amp;lt;PropertyRef Name="Title"/&amp;gt;                     &lt;br /&gt;
&amp;lt;PropertyRef Name="Manager"/&amp;gt;                     &lt;br /&gt;
&amp;lt;PropertyRef Name="Company"/&amp;gt;                     &lt;br /&gt;
&amp;lt;/ResultType&amp;gt;                     &lt;br /&gt;
&amp;lt;ResultType DisplayName="Presentations" Name="presentations"&amp;gt;                     &lt;br /&gt;
&amp;lt;Query&amp;gt;FileExtension='ppt'&amp;lt;/Query&amp;gt;                     &lt;br /&gt;
&amp;lt;PropertyRef Name="Author"/&amp;gt;                     &lt;br /&gt;
&amp;lt;PropertyRef Name="DocComments"/&amp;gt;                     &lt;br /&gt;
&amp;lt;PropertyRef Name="Description"/&amp;gt;                     &lt;br /&gt;
&amp;lt;PropertyRef Name="DocKeywords"/&amp;gt;                     &lt;br /&gt;
&amp;lt;PropertyRef Name="FileName"/&amp;gt;                     &lt;br /&gt;
&amp;lt;PropertyRef Name="Size"/&amp;gt;                     &lt;br /&gt;
&amp;lt;PropertyRef Name="DocSubject"/&amp;gt;                     &lt;br /&gt;
&amp;lt;PropertyRef Name="Path"/&amp;gt;                     &lt;br /&gt;
&amp;lt;PropertyRef Name="Created"/&amp;gt;                     &lt;br /&gt;
&amp;lt;PropertyRef Name="Write"/&amp;gt;                     &lt;br /&gt;
&amp;lt;PropertyRef Name="CreatedBy"/&amp;gt;                     &lt;br /&gt;
&amp;lt;PropertyRef Name="ModifiedBy"/&amp;gt;                     &lt;br /&gt;
&amp;lt;PropertyRef Name="Title"/&amp;gt;                     &lt;br /&gt;
&amp;lt;PropertyRef Name="Manager"/&amp;gt;                     &lt;br /&gt;
&amp;lt;PropertyRef Name="Company"/&amp;gt;                     &lt;br /&gt;
&amp;lt;/ResultType&amp;gt;                     &lt;br /&gt;
&lt;/strong&gt;
&lt;/span&gt;&amp;lt;/ResultTypes&amp;gt;                 &lt;br /&gt;
&amp;lt;/root&amp;gt;&lt;/p&gt;           &lt;/td&gt;         &lt;/tr&gt;       &lt;/tbody&gt;
&lt;/table&gt;   &lt;/li&gt; &lt;/ul&gt;  

&lt;p align="justify"&gt;Let’s explore the XML in order to see how we can manipulate the advanced search box query properties:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;     

&lt;div align="justify"&gt;To include the “contains” and “does not contain” equation in my search expressions I just need to edit the Option AllowOpContains &lt;span style="color: rgb(255, 0, 0);"&gt;
&lt;strong&gt;(Red Text) &lt;/strong&gt;
&lt;/span&gt;
&lt;span style="color: rgb(0, 0, 0);"&gt;from &lt;em&gt;False&lt;/em&gt; to &lt;em&gt;True&lt;/em&gt;.&lt;/span&gt;
&lt;/div&gt;   &lt;/li&gt;    &lt;li&gt;     

&lt;div align="justify"&gt;
&lt;span style="color: rgb(0, 0, 0);"&gt;To leave only the Greek and English language option in my languages search query, I have to edit the &amp;lt;Language LangRef=”&lt;em&gt;Number&lt;/em&gt;”&amp;gt; tag &lt;strong&gt;
&lt;span style="color: rgb(255, 128, 0);"&gt;(Orange Text)&lt;/span&gt;
&lt;/strong&gt; with the appropriate language definition number &lt;strong&gt;
&lt;span style="color: rgb(128, 128, 128);"&gt;(Grey Text)&lt;/span&gt;
&lt;/strong&gt;. &lt;/span&gt;
&lt;/div&gt;   &lt;/li&gt;    &lt;li&gt;     

&lt;div align="justify"&gt;
&lt;span style="color: rgb(0, 0, 0);"&gt;I check the &lt;em&gt;language definitions&lt;/em&gt; list for the Greek language and I notice that the Greek definition is equal to “8” &lt;strong&gt;
&lt;span style="color: rgb(128, 128, 128);"&gt;(Grey Text)&lt;/span&gt;
&lt;/strong&gt;. I Remove all &amp;lt;Language LangRef=”&lt;em&gt;Number&lt;/em&gt;”&amp;gt; tags and I leave only one; the one with the Greek language Definition &amp;lt;Language LangRef=”&lt;em&gt;8&lt;/em&gt;”&amp;gt; &lt;strong&gt;
&lt;span style="color: rgb(255, 128, 0);"&gt;(Orange Text)&lt;/span&gt;
&lt;/strong&gt;. &lt;/span&gt;
&lt;/div&gt;   &lt;/li&gt;    &lt;li&gt;     

&lt;div align="justify"&gt;
&lt;span style="color: rgb(0, 0, 0);"&gt;To include my managed properties in search terms I have to add a property definition for my managed property &lt;strong&gt;
&lt;span style="color: rgb(0, 128, 192);"&gt;(Blue Text)&lt;/span&gt;
&lt;/strong&gt; and a Property Reference &lt;strong&gt;
&lt;span style="color: rgb(0, 128, 64);"&gt;(Green Text)&lt;/span&gt;
&lt;/strong&gt; for the appropriate definition to appear in the properties dropdown list.&lt;/span&gt;
&lt;/div&gt;   &lt;/li&gt;    &lt;li&gt;     

&lt;div align="justify"&gt;
&lt;span style="color: rgb(0, 0, 0);"&gt;To create a property definition for my ProtOurPID managed property, I have to include a &amp;lt;PropertyDef Name=”ProtOurPID” DataType=”Text” DisplayName=”Our PID”/&amp;gt; tag &lt;strong&gt;
&lt;span style="color: rgb(0, 128, 192);"&gt;(Blue Text)&lt;/span&gt;
&lt;/strong&gt; where Name=”&lt;em&gt;My managed property name&lt;/em&gt;”, DataType=”&lt;em&gt;Data type (Text, DateTime, etc)&lt;/em&gt;”, DisplayName=”&lt;em&gt;The appearance in the pick property drop down menu&lt;/em&gt;”&lt;/span&gt;
&lt;/div&gt;      

&lt;table border="1" cellpadding="2" cellspacing="0" width="587"&gt;
&lt;tbody&gt;         &lt;tr&gt;           &lt;td valign="top" width="585"&gt;             

&lt;p&gt;&amp;lt;PropertyDef Name="ProtOurPID" DataType="text" DisplayName="Our PID"/&amp;gt;                &lt;br /&gt;
&amp;lt;PropertyDef Name="ProtSubject" DataType="text" DisplayName="Subject"/&amp;gt;                 &lt;br /&gt;
&amp;lt;PropertyDef Name="ProtINOUT" DataType="text" DisplayName="IN/OUT"/&amp;gt;                 &lt;br /&gt;
&amp;lt;PropertyDef Name="ProtDocumentDate" DataType="datetime" DisplayName="Document Date"/&amp;gt;                 &lt;br /&gt;
&amp;lt;PropertyDef Name="ProtINTOriginDestination" DataType="text" DisplayName="Internal Origin/Destination"/&amp;gt;                 &lt;br /&gt;
&amp;lt;PropertyDef Name="ProtEXTOriginDestination" DataType="text" DisplayName="External Origin/Destination"/&amp;gt;                 &lt;br /&gt;
&amp;lt;PropertyDef Name="ProtCommentsDescriptions" DataType="text" DisplayName="Protocol Comments / Description"/&amp;gt;                 &lt;br /&gt;
&amp;lt;PropertyDef Name="ProtTheirPID" DataType="text" DisplayName="Their PID"/&amp;gt;&lt;/p&gt;           &lt;/td&gt;         &lt;/tr&gt;       &lt;/tbody&gt;
&lt;/table&gt;   &lt;/li&gt;    &lt;li&gt;     

&lt;div align="justify"&gt;
&lt;span style="color: rgb(0, 0, 0);"&gt;Finally, I need to be able to query my custom &lt;em&gt;managed properties&lt;/em&gt;. In order to do so, I have to create a &lt;em&gt;Property Reference&lt;/em&gt; for my &lt;em&gt;Property Definitions&lt;/em&gt; I created earlier. I have the option to create groupings of &lt;em&gt;Property References&lt;/em&gt; called &lt;em&gt;Result Types&lt;/em&gt;. &lt;em&gt;Result Types&lt;/em&gt; can have their own groupings of &lt;em&gt;Property References&lt;/em&gt; and filtering queries. For example, to create a Result Type for my Protocol Lists I can add the following markup just before the &amp;lt;/ResultTypes&amp;gt; closing tag:&lt;/span&gt;
&lt;/div&gt;      

&lt;table border="1" cellpadding="2" cellspacing="0" width="592"&gt;
&lt;tbody&gt;         &lt;tr&gt;           &lt;td valign="top" width="590"&gt;             

&lt;p&gt;&amp;lt;ResultType DisplayName="Protocols" Name="Protocol"&amp;gt;                &lt;br /&gt;
&lt;strong&gt;&amp;lt;Query&amp;gt;IsDocument=0&amp;lt;/Query&amp;gt;&lt;/strong&gt;                 &lt;br /&gt;
&amp;lt;PropertyRef Name="ProtOurPID"/&amp;gt;                 &lt;br /&gt;
&amp;lt;PropertyRef Name="ProtSubject"/&amp;gt;                 &lt;br /&gt;
&amp;lt;PropertyRef Name="ProtINOUT"/&amp;gt;                 &lt;br /&gt;
&amp;lt;PropertyRef Name="ProtDocumentDate"/&amp;gt;                 &lt;br /&gt;
&amp;lt;PropertyRef Name="ProtINTOriginDestination"/&amp;gt;                 &lt;br /&gt;
&amp;lt;PropertyRef Name="ProtEXTOriginDestination"/&amp;gt;                 &lt;br /&gt;
&amp;lt;PropertyRef Name="ProtTheirPID"/&amp;gt;                 &lt;br /&gt;
&amp;lt;/ResultType&amp;gt;&lt;/p&gt;           &lt;/td&gt;         &lt;/tr&gt;       &lt;/tbody&gt;
&lt;/table&gt;   &lt;/li&gt;    &lt;li&gt;This &lt;em&gt;result type&lt;/em&gt; will query the results that are not documents “&amp;lt;Query&amp;gt;IsDocument=0&amp;lt;/Query&amp;gt;” and will allow you to query only the grouping of the &lt;em&gt;managed properties&lt;/em&gt; referenced in that particular &lt;em&gt;result type&lt;/em&gt;. &lt;/li&gt; &lt;/ul&gt;  

&lt;p&gt;You can always create more complex queries by adding OR and AND statements. Like:&lt;/p&gt;  

&lt;table border="1" cellpadding="2" cellspacing="0" width="634"&gt;
&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" &gt;         

&lt;p&gt;
&lt;span style="color: rgb(0, 128, 0);"&gt;
&lt;span style="color: rgb(0, 0, 0);"&gt;&amp;lt;Query&amp;gt;FileExtension='xls' Or FileExtension='xlsx' Or FileExtension='xlt'&amp;lt;/Query&amp;gt;&lt;/span&gt; &lt;/span&gt;
&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;
&lt;/table&gt;&lt;img src="http://feeds.feedburner.com/~r/Itbully/~4/iip9IEe8N-4" height="1" width="1"/&gt;</description>
 <comments>http://www.itbully.com/articles/moss-search-saga-modifying-advanced-search-page#comments</comments>
 <category domain="http://www.itbully.com/category/tags/search">Search</category>
 <category domain="http://www.itbully.com/category/tags/sharepoint">Sharepoint</category>
 <category domain="http://www.itbully.com/category/tags/xml">XML</category>
 <category domain="http://www.itbully.com/category/tags/xslt">XSLT</category>
 <pubDate>Sat, 14 Nov 2009 11:28:00 +0000</pubDate>
 <dc:creator>Lefteris Karafilis</dc:creator>
 <guid isPermaLink="false">47 at http://www.itbully.com</guid>
<feedburner:origLink>http://www.itbully.com/articles/moss-search-saga-modifying-advanced-search-page</feedburner:origLink></item>
</channel>
</rss>

