なぜこれは最初は遅いのですか? これを避けるにはどうすればよいですか?
create PROCEDURE [dbo].[GetMicrosoftXmlFeedData]
@PageTemplateIds varchar(500),
@PageTemplateLocationIds varchar(500),
@ContentTypeIds varchar(500),
@PageSourceIds varchar(500),
@NumberOfDays int = 1
AS
BEGIN
select
P.pageid
, P.maskurl as ArticleURL
, C.ContentID
, cast(C.ContentXML as xml).value('Content[1]/Headline[1]','varchar(200)') as Headline
, cast(C.ContentXML as xml).value('Content[1]/Byline [1]','varchar(200)') as AuthorName
, cast(C.ContentXML as xml).value('Content[1]/Deck[1]','varchar(200)') as Description
, cast(C.ContentXML as xml).value('Content[1]/BodyContent[1]','varchar(max)') as ArticleDetails
, C.DateCreated as POSTING_DATETIME
from cmspage(nolock) P
join cmspagecontent(nolock) PC on P.pageid = PC.pageid
join cmsContent(nolock) C on PC.contentid = C.contentid
join cmsContentType(nolock) CT on C.ContentTypeId = CT.ContentTypeId
where C.DateCreated > getdate() - @NumberOfDays --100
AND P.pagetemplateid in (
select value from dbo.fnParseDelimString(@PageTemplateIds, ',')
--15252, --Article
--16543 -- Article - Infogram
)
and PC.pagetemplatelocationid in (
select value from dbo.fnParseDelimString(@PageTemplateLocationIds, ',')
--17163,
--15250
)
and CT.contenttypeid in (select value from dbo.fnParseDelimString(@ContentTypeIds, ','))--(6)
and P.isactive = 1
and P.HasBeenPublished = 1
and P.IsRedirect = 0
--and
--C.DateCreated > getdate() - @NumberOfDays --100
and
P.pagesourceid in (select value from dbo.fnParseDelimString(@PageSourceIds, ','))--(16,1896)
END