. , . , . sku SS2K5, (noexpand), ( ). sku , , , .
-, , , ;)
create view postCount__
as
select
threadId
,postCount=count_big(*)
from thread
group by threadId
go
create unique clustered index postCount__xpk_threadid on postCount__(threadId)
go
create view postCount
as
select
threadId
,postCount=cast(postCount as int)
from postCount__ with (noexpand)
go
, , . , noexpand. count_big, int , asp.net 32- int. , .
EDIT. I can say that forum software always denormalizes the number of posts in the thread table. It kills the database to constantly count the number of posts on each pageview, if you have an active forum. I like that mssql has indexed views, so you can describe denormalization declaratively rather than supporting it yourself.
source
share