<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://sqlblog.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Kalen Delaney : metadata, SQL Server 2008</title><link>http://sqlblog.com/blogs/kalen_delaney/archive/tags/metadata/SQL+Server+2008/default.aspx</link><description>Tags: metadata, SQL Server 2008</description><dc:language>en</dc:language><generator>CommunityServer 2.1 SP2 (Build: 61129.1)</generator><item><title>Geek City: Two Compression Questions and Parameter Metadata</title><link>http://sqlblog.com/blogs/kalen_delaney/archive/2009/03/10/two-compression-questions-and-parameter-metadata.aspx</link><pubDate>Tue, 10 Mar 2009 17:46:00 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:12539</guid><dc:creator>Kalen Delaney</dc:creator><slash:comments>3</slash:comments><comments>http://sqlblog.com/blogs/kalen_delaney/comments/12539.aspx</comments><wfw:commentRss>http://sqlblog.com/blogs/kalen_delaney/commentrss.aspx?PostID=12539</wfw:commentRss><description>&lt;P&gt;I am teaching the SQL 2008 version of my course for the first time this week. My life is still is disarray and spare time is practically non-existent.&amp;nbsp; During the evenings after I class I am trying to get caught up on several projects that I fell way behind on&amp;nbsp;over the last month when most of my time was spent in the hospital. Blogging has been put on the back burner, but I thought I could share some of the questions that came up in class on the first day.&amp;nbsp; I usually try to track down answers to open questions, and then share them with the students the next day.&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#0000ff&gt;&lt;I&gt;1. Why can't the stored procedure sp_estimate_data_compression_savings be available on SQL Server 2008 Standard Edition, instead of just Enterprise, Developer and Evaluation? We realize that compression is an Enterprise only feature, but if non-Enterprise users could see how much space they would save, it might help them determine whether Enterprise Edition is worth while?&lt;/I&gt;&lt;/FONT&gt; &lt;/P&gt;
&lt;P&gt;(OK, here's a really geeky part... speaking of Enterprise, my #1 son sent me &lt;A href="http://www.traileraddict.com/trailer/star-trek-xi/feature-trailer"&gt;this link&lt;/A&gt; yesterday. ) &lt;/P&gt;
&lt;P&gt;Now I'm not saying that Microsoft should be obnoxious about this and say "See what you could save if you upgraded to Enterprise",&amp;nbsp; and do that whether the user wants to know or not. It would be on request, when the user ran this procedure. &lt;/P&gt;
&lt;P&gt;I also understand that the procedure actually applies compression to a sample of pages to compute the savings potential. And it was confirmed last night when I started researching this question that Enterprise features are just turned on and off through a switch so it actually would be easy enough to just not do the check for Enterprise Edition within this stored procedure. Microsoft is looking at possibly making this change, but it looks like it might not happen before the next major release.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#0000ff&gt;&lt;I&gt;2. Since page compression is applied on a page by page basis, what's the point of compressing a read-only table? Each page would be compressed, perhaps into a small amount of space, but if no new rows were added, the empty space on each page wouldn't get used and we would still have the same number of pages in the table.&lt;/I&gt;&lt;/FONT&gt; &lt;/P&gt;
&lt;P&gt;Although it is true that compression is applied on each page individually, you need to rebuild the table or index in order to compress it, with ALTER TABLE or ALTER INDEX.&amp;nbsp; And rebuilding a table or index moves the data to all new pages. So as the table is being rebuilt, when a page gets full, it is compressed, but then more rows can be added, and when are sufficient number are added, it gets recompressed, and keeps getting recompressed as more rows are added, until there is no chance of any more more rows being added. So during the rebuild process the table really isn't read-only, as the original data is being inserted into the a new copy of the table. You could end up with far few pages.&lt;/P&gt;
&lt;P&gt;This is pretty easy to test out, by just compressing a relatively full table of your own into a test table (so no one will update it) and then compressing it. It should take less space. &lt;/P&gt;
&lt;P&gt;There are lots of compression scripts, plus a lot more detail about how compression works, in my new book, which is scheduled for release TOMORROW!!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#0000ff&gt;&lt;I&gt;3. Where is the metadata that contains the default values of SQL Server stored procedure parameters?&lt;/I&gt;&lt;/FONT&gt; &lt;/P&gt;
&lt;P&gt;Uh, the answer appears to be 'None of the above'. There is no metadata, either system views or system tables (viewable using the DAC) that contains this information. &lt;/P&gt;
&lt;P&gt;You can read this Connect request for more details (and even vote for it if you like): &lt;/P&gt;
&lt;P&gt;&lt;A title=https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=234143 href="https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=234143"&gt;https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=234143&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;It does seem strange that this information is not available and it's hard to believe SQL Server parses the procedure definition every time it wants to know the default.&amp;nbsp; It turns out that even if all you want to know is whether or not a default exists is not easy to find. (You might want to know that to be able to determine if a parameter is optional.)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So now you know.&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#ff00ff size=4&gt;~Kalen&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://sqlblog.com/aggbug.aspx?PostID=12539" width="1" height="1"&gt;</description><category domain="http://sqlblog.com/blogs/kalen_delaney/archive/tags/compression/default.aspx">compression</category><category domain="http://sqlblog.com/blogs/kalen_delaney/archive/tags/metadata/default.aspx">metadata</category><category domain="http://sqlblog.com/blogs/kalen_delaney/archive/tags/SQL+Server+2008/default.aspx">SQL Server 2008</category></item><item><title>Geek City: Clearing a Single Plan From Cache in SQL Server 2008</title><link>http://sqlblog.com/blogs/kalen_delaney/archive/2008/10/31/clearing-a-single-plan-from-cache-in-sql-server-2008.aspx</link><pubDate>Fri, 31 Oct 2008 23:43:00 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:9787</guid><dc:creator>Kalen Delaney</dc:creator><slash:comments>4</slash:comments><comments>http://sqlblog.com/blogs/kalen_delaney/comments/9787.aspx</comments><wfw:commentRss>http://sqlblog.com/blogs/kalen_delaney/commentrss.aspx?PostID=9787</wfw:commentRss><description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I just today found out about something that was in plain sight in the Books Online... but the documentation is so vast, I haven't discovered everything yet. &lt;/P&gt;
&lt;P&gt;I blogged about &lt;A href="http://sqlblog.com/blogs/kalen_delaney/archive/2007/09/29/geek-city-clearing-a-single-plan-from-cache.aspx" target=_blank&gt;clearing a single plan from cache in SQL Server 2005&lt;/A&gt; a while back, and mentioned a rumor that there would be a new way to do this in SQL Server 2008. And then just today, someone posted a comment on that blog post, asking about the new 2008 method. &lt;/P&gt;
&lt;P&gt;One of my contacts on the SQL Server team at Microsoft just sent me an email telling me about new features related to plan caching, as I am starting to work on updating that chapter for my 2008 book. He mentioned that DBCC now takes parameters, and one of the parameters is a plan handle!&lt;/P&gt;&lt;PRE&gt;DBCC FREEPROCCACHE [ ( { plan_handle | sql_handle | pool_name } ) ] [ WITH NO_INFOMSGS ]&lt;/PRE&gt;
&lt;P&gt;There is full example in the Books Online, so I won't repeat it here. If you don't have a local copy of BOL handy, you can read about the new option to DBCC FREEPROCCACHE online here:&lt;/P&gt;
&lt;P&gt;&lt;A title=http://msdn.microsoft.com/en-us/library/ms174283.aspx href="http://msdn.microsoft.com/en-us/library/ms174283.aspx"&gt;http://msdn.microsoft.com/en-us/library/ms174283.aspx&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Have fun!&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#ff00ff size=4&gt;~Kalen&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://sqlblog.com/aggbug.aspx?PostID=9787" width="1" height="1"&gt;</description><category domain="http://sqlblog.com/blogs/kalen_delaney/archive/tags/metadata/default.aspx">metadata</category><category domain="http://sqlblog.com/blogs/kalen_delaney/archive/tags/plan+cache/default.aspx">plan cache</category><category domain="http://sqlblog.com/blogs/kalen_delaney/archive/tags/SQL+Server+2008/default.aspx">SQL Server 2008</category></item></channel></rss>