IF NOT EXISTS (SELECT * FROM SYS.indexes WHERE name = 'IDX_USER_RID' and object_id = OBJECT_ID('IDN_UMA_RESOURCE'))
CREATE INDEX IDX_USER_RID ON IDN_UMA_RESOURCE (RESOURCE_ID, RESOURCE_OWNER_NAME, USER_DOMAIN, CLIENT_ID);
