<?xml version="1.0" encoding="utf-8"?><!-- generator="b2evolution/6.11.7-stable" -->
<rdf:RDF xmlns="http://purl.org/rss/1.0/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel rdf:about="https://www.insidesql.org/blogs/tgrohser/">
	<title>=tg= Thomas Grohser - Latest Comments</title>
	<link>https://www.insidesql.org/blogs/tgrohser/?disp=comments</link>
	<description></description>
	<dc:language>en-EU</dc:language>
	<admin:generatorAgent rdf:resource="http://b2evolution.net/?v=6.11.7-stable"/>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<sy:updateBase>2000-01-01T12:00+00:00</sy:updateBase>
	<items>
		<rdf:Seq>
					<rdf:li rdf:resource="https://www.insidesql.org/blogs/tgrohser/2011/08/05/found-prove-that-sql-server#c1185"/>
						<rdf:li rdf:resource="https://www.insidesql.org/blogs/tgrohser/2011/01/26/maximum-count-performance#c1161"/>
						<rdf:li rdf:resource="https://www.insidesql.org/blogs/tgrohser/2011/01/26/a-little-bit-more-information-on-multi-location-backups#c1150"/>
						<rdf:li rdf:resource="https://www.insidesql.org/blogs/tgrohser/2011/01/26/a-little-bit-more-information-on-multi-location-backups#c1149"/>
						<rdf:li rdf:resource="https://www.insidesql.org/blogs/tgrohser/2011/01/26/maximum-count-performance#c1145"/>
						<rdf:li rdf:resource="https://www.insidesql.org/blogs/tgrohser/2011/01/26/maximum-count-performance#c1143"/>
						<rdf:li rdf:resource="https://www.insidesql.org/blogs/tgrohser/2011/01/26/maximum-count-performance#c1142"/>
						<rdf:li rdf:resource="https://www.insidesql.org/blogs/tgrohser/2011/01/24/hello-world#c1138"/>
					</rdf:Seq>
	</items>
</channel>
<item rdf:about="https://www.insidesql.org/blogs/tgrohser/2011/08/05/found-prove-that-sql-server#c1185">
	<title>In response to: Found prove that SQL Server is the Devils Engine - ERROR 666</title>
	<link>https://www.insidesql.org/blogs/tgrohser/2011/08/05/found-prove-that-sql-server#c1185</link>
	<dc:date>2011-08-09T05:53:17Z</dc:date>
	<dc:creator><a href="http://www.insidesql.org/blogs/" title="Show the user profile" class="login user nowrap" rel="bubbletip_user_1"><span class="identity_link_username">admin</span></a></dc:creator>
	<description>Brilliant! I like that developer&#039;s humour... :-)</description>
	<content:encoded><![CDATA[Brilliant! I like that developer's humour... :-)]]></content:encoded>
</item>
<item rdf:about="https://www.insidesql.org/blogs/tgrohser/2011/01/26/maximum-count-performance#c1161">
	<title>In response to: increasing the performance of count(*)</title>
	<link>https://www.insidesql.org/blogs/tgrohser/2011/01/26/maximum-count-performance#c1161</link>
	<dc:date>2011-02-24T18:25:46Z</dc:date>
	<dc:creator><span class="user anonymous" rel="bubbletip_comment_1161">Christoph Ingenhaag</span></dc:creator>
	<description>An indexed view is another choice. 

With 1100000 rows in MyTable a select makes 957 logical reads on my system using the IX_ID index.
A select on MyView (code follows) makes 2 logical reads

create view dbo.MyView 
with schemabinding
as
select
    count_big(*) as cnt
from dbo.MyTable
go

create unique clustered index cuidx on MyView(Cnt)
go

select cnt from MyView with (noexpand)

It is interessting the noexpand hint is necessary with more then 1000000 rows in MyTable on my system... (with Express Editions you need this hint)

And, the inserts are faster without the IX_ID Index. The update of the indexed view costs almost nothing. To check this I used the number function from Steve Kass (http://stevekass.com/2006/06/03/how-to-generate-a-sequence-on-the-fly/) and this statement:

insert into MyTable(Payload) 
select replicate(&#039;ABC&#039;, 100)
from dbo.numbers(1, 100000) 

Please check the plan. Maybe I have overseen something.&lt;br /&gt;</description>
	<content:encoded><![CDATA[An indexed view is another choice. 

With 1100000 rows in MyTable a select makes 957 logical reads on my system using the IX_ID index.
A select on MyView (code follows) makes 2 logical reads

create view dbo.MyView 
with schemabinding
as
select
    count_big(*) as cnt
from dbo.MyTable
go

create unique clustered index cuidx on MyView(Cnt)
go

select cnt from MyView with (noexpand)

It is interessting the noexpand hint is necessary with more then 1000000 rows in MyTable on my system... (with Express Editions you need this hint)

And, the inserts are faster without the IX_ID Index. The update of the indexed view costs almost nothing. To check this I used the number function from Steve Kass (http://stevekass.com/2006/06/03/how-to-generate-a-sequence-on-the-fly/) and this statement:

insert into MyTable(Payload) 
select replicate('ABC', 100)
from dbo.numbers(1, 100000) 

Please check the plan. Maybe I have overseen something.<br />]]></content:encoded>
</item>
<item rdf:about="https://www.insidesql.org/blogs/tgrohser/2011/01/26/a-little-bit-more-information-on-multi-location-backups#c1150">
	<title>In response to: A little bit more information on multi location backups</title>
	<link>https://www.insidesql.org/blogs/tgrohser/2011/01/26/a-little-bit-more-information-on-multi-location-backups#c1150</link>
	<dc:date>2011-01-28T09:59:41Z</dc:date>
	<dc:creator><a href="https://www.insidesql.org/blogs/tgrohser/?disp=user&amp;user_ID=17" title="Show the user profile" class="login user nowrap" rel="bubbletip_user_17"><span class="identity_link_username">tgrohser</span></a></dc:creator>
	<description>Log shipping is a great way to do unfortunately with the build in log shipping you cant use multiple locations, but you can write your own log shipping to do so</description>
	<content:encoded><![CDATA[Log shipping is a great way to do unfortunately with the build in log shipping you cant use multiple locations, but you can write your own log shipping to do so]]></content:encoded>
</item>
<item rdf:about="https://www.insidesql.org/blogs/tgrohser/2011/01/26/a-little-bit-more-information-on-multi-location-backups#c1149">
	<title>In response to: A little bit more information on multi location backups</title>
	<link>https://www.insidesql.org/blogs/tgrohser/2011/01/26/a-little-bit-more-information-on-multi-location-backups#c1149</link>
	<dc:date>2011-01-28T09:02:38Z</dc:date>
	<dc:creator><a href="https://www.insidesql.org/blogs/tgrohser/?disp=user&amp;user_ID=6" title="Show the user profile" class="login user nowrap" rel="bubbletip_user_6"><span class="identity_link_username">cmu</span></a></dc:creator>
	<description>Good idea! Additionaly you can set up log shipping to proof the consistency of your log backups.</description>
	<content:encoded><![CDATA[Good idea! Additionaly you can set up log shipping to proof the consistency of your log backups.]]></content:encoded>
</item>
<item rdf:about="https://www.insidesql.org/blogs/tgrohser/2011/01/26/maximum-count-performance#c1145">
	<title>In response to: increasing the performance of count(*)</title>
	<link>https://www.insidesql.org/blogs/tgrohser/2011/01/26/maximum-count-performance#c1145</link>
	<dc:date>2011-01-26T19:33:36Z</dc:date>
	<dc:creator><a href="http://www.insidesql.org/blogs/" title="Show the user profile" class="login user nowrap" rel="bubbletip_user_1"><span class="identity_link_username">admin</span></a></dc:creator>
	<description>LOL. 

Agreed, in that table dimensions I guess it is really not worth it departing from the &quot;standard&quot; way of doing things. :-)</description>
	<content:encoded><![CDATA[LOL. 

Agreed, in that table dimensions I guess it is really not worth it departing from the "standard" way of doing things. :-)]]></content:encoded>
</item>
<item rdf:about="https://www.insidesql.org/blogs/tgrohser/2011/01/26/maximum-count-performance#c1143">
	<title>In response to: increasing the performance of count(*)</title>
	<link>https://www.insidesql.org/blogs/tgrohser/2011/01/26/maximum-count-performance#c1143</link>
	<dc:date>2011-01-26T14:53:15Z</dc:date>
	<dc:creator><a href="https://www.insidesql.org/blogs/tgrohser/?disp=user&amp;user_ID=17" title="Show the user profile" class="login user nowrap" rel="bubbletip_user_17"><span class="identity_link_username">tgrohser</span></a></dc:creator>
	<description>The actual problem was in the size of about 0 to 2000 rows, so not a huge table, the exact count was not 100% relevant, we thought about query in the system tables too but we found out that the actual work for sql server in this size of table was smaller letting him count than finding the right object, the coresponding partitions and then reading the result.
Sure there is overhead for the extra index but the counting was done much more often then inserts.

for large tables I totaly agree the system tables are the much better way to go</description>
	<content:encoded><![CDATA[The actual problem was in the size of about 0 to 2000 rows, so not a huge table, the exact count was not 100% relevant, we thought about query in the system tables too but we found out that the actual work for sql server in this size of table was smaller letting him count than finding the right object, the coresponding partitions and then reading the result.
Sure there is overhead for the extra index but the counting was done much more often then inserts.

for large tables I totaly agree the system tables are the much better way to go]]></content:encoded>
</item>
<item rdf:about="https://www.insidesql.org/blogs/tgrohser/2011/01/26/maximum-count-performance#c1142">
	<title>In response to: increasing the performance of count(*)</title>
	<link>https://www.insidesql.org/blogs/tgrohser/2011/01/26/maximum-count-performance#c1142</link>
	<dc:date>2011-01-26T13:22:49Z</dc:date>
	<dc:creator><a href="http://www.insidesql.org/blogs/" title="Show the user profile" class="login user nowrap" rel="bubbletip_user_1"><span class="identity_link_username">admin</span></a></dc:creator>
	<description>If I were to perform a COUNT(*) constantly on a large table I would maybe revise this strategy and question the requirement at all. Even with a tailored index just to support that query, the actual work still has to be carried out by SQL Server and I wouldn&#039;t be surprised when the query still runs like a dog.

However, if accuracy of the COUNT(*) isn&#039;t important at all, say for example, if you want to use this for some kind of paging, or track growth over time, or other stuff where you can live with a more or less &quot;good approximation&quot;, it might be an option to get the row_count from the system tables such as sys.partitions. 
Of course, with the usual caveat, that system tables can change over time...</description>
	<content:encoded><![CDATA[If I were to perform a COUNT(*) constantly on a large table I would maybe revise this strategy and question the requirement at all. Even with a tailored index just to support that query, the actual work still has to be carried out by SQL Server and I wouldn't be surprised when the query still runs like a dog.

However, if accuracy of the COUNT(*) isn't important at all, say for example, if you want to use this for some kind of paging, or track growth over time, or other stuff where you can live with a more or less "good approximation", it might be an option to get the row_count from the system tables such as sys.partitions. 
Of course, with the usual caveat, that system tables can change over time...]]></content:encoded>
</item>
<item rdf:about="https://www.insidesql.org/blogs/tgrohser/2011/01/24/hello-world#c1138">
	<title>In response to: Hello World</title>
	<link>https://www.insidesql.org/blogs/tgrohser/2011/01/24/hello-world#c1138</link>
	<dc:date>2011-01-24T12:04:19Z</dc:date>
	<dc:creator><a href="http://www.insidesql.org/blogs/" title="Show the user profile" class="login user nowrap" rel="bubbletip_user_1"><span class="identity_link_username">admin</span></a></dc:creator>
	<description>Hi Thomas,

a warm welcome from me again as well. Good to have you here!
--
Cheers,
Frank</description>
	<content:encoded><![CDATA[Hi Thomas,

a warm welcome from me again as well. Good to have you here!
--
Cheers,
Frank]]></content:encoded>
</item>
</rdf:RDF>
