Recently, it was discovered that Workflow (and by association Servicedesk) has a SQL view that, in its original form, when accessed, takes unnecessary time to complete. The view in question is the “UserReferenceIDLookup” view, and is used when users log in to the ProcessManager portal, and in many other areas of portal use as well, especially when permissions are accessed.
In all environments, especially larger ones, this change should result in significant performance gains. Specifically, In one customers environment, the old view resolution took approximately 25 seconds. After changing the view definition to add the “UNION ALL” statement, the results came back in 25 milliseconds!
Here are the instructions to make the change:
1. You should have abilities in SQL to modify views. If not, seek the assistance of your SQL DBA.
2. On the SQL server, find and open the SQL Management Studio
3. Find and expand the ProcessManager database( or choose the name of your Workflow/Servicedesk database).
4. Expand Views
5. Find the dbo.UserReferenceIDLookup view and Right-click on it.
6. Choose Script View as, and choose the flyout for ALTER To, then select New Query Editor Window
7. In the query window you should see something similar to the following:
USE [ProcessManager]
GO
/******Object View [dbo].[ UserReferenceIDLookup] Script Date: xx/xx/xxxx xx:xx:xx ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER view [dbo].[UserReferenceIDLookup]
as
select UserID, UserID ReferenceID from dbo.[User] with (nolock)
-- insert the users groups
union all
select UserID, GroupID ReferenceID from dbo.UserGroup with (nolock)
-- insert the users org units
union
select UserID, OrganizationUnitID ReferenceID from dbo.UserOrganizationUnit with (nolock)
-- insert the users permissons
union
select UserID, PermissionID ReferenceID from dbo.UserPermission with (nolock)
-- insert the users permissons from groups
union
select distinct ug.UserID, gp.PermissionID ReferenceID
from dbo.UserGroup ug with (nolock) INNER JOIN
dbo.GroupPermission gp with (nolock) ON ug.GroupID = gp.GroupID
GO
8. Change the first “union” statement to be “union all”, as shown in bold above.
9. Now click the execute button.
10. That’s all that is required. You can close SQL and now begin to observe the changes in performance that should occur any time this view is accessed.
This change will be included in all current 7.5 and future releases.
The attached file contains the SQL.