01.10.2013, 12:17 | #1 |
Участник
|
тормозят селекты по вьюхам
Всем привет.
может кто сталкивался: простые запросы к вьюхам адски тормозят. Код: select top 251 "phonecall0".Subject as "subject" , "phonecall0".StateCode as "statecode" , "phonecall0".PriorityCode as "prioritycode" , "phonecall0".ScheduledEnd as "scheduledend" , "phonecall0".CreatedBy as "createdby" , "phonecall0".RegardingObjectId as "regardingobjectid" , "phonecall0".ActivityId as "activityid" , "phonecall0".CreatedOn as "createdon" , "phonecall0".ModifiedOn as "modifiedon" , "phonecall0".New_sringtime as "new_sringtime" , "phonecall0".OwnerId as "ownerid" , "phonecall0".New_durationsecs as "new_durationsecs" , "phonecall0".OverriddenCreatedOn as "overriddencreatedon" , "phonecall0".CreatedByName as "createdbyname" , "phonecall0".CreatedByYomiName as "createdbyyominame" , "phonecall0".RegardingObjectTypeCode as "regardingobjecttypecode" , "phonecall0".RegardingObjectIdName as "regardingobjectidname" , "phonecall0".RegardingObjectIdYomiName as "regardingobjectidyominame" , "phonecall0".OwnerIdType as "owneridtype" , "phonecall0".OwnerIdName as "owneridname" , "phonecall0".OwnerIdYomiName as "owneridyominame" from PhoneCall as "phonecall0" (NOLOCK) join SystemUser as "aa" (NOLOCK) on ("phonecall0".OwningUser = "aa".SystemUserId and (("aa".BusinessUnitId = '571EA980-8733-E011-B92E-001A6433B300'))) join SystemUser as "ad" (NOLOCK) on ("phonecall0".CreatedBy = "ad".SystemUserId and (("ad".BusinessUnitId = '7520170E-0D94-DF11-9328-001A6433B300'))) where (( "phonecall0".CreatedOn >= '2013-06-30 20:00:00' and "phonecall0".CreatedOn < '2013-08-31 20:00:00' )) order by "phonecall0".Subject asc если сделать вьюху phonecall1 с изменением всего 1 поля: Код: CASE WHEN XXowner.OwnerIdType = 8 THEN XXowner.OwnerId ELSE NULL END AS OwningUser, Код: XXowner.OwnerId AS OwningUser, CRM 2011 + RU 14 есть идеи, что можно сделать? |
|