Adhoc query performance issue UFN_STATE_GETDESCRIPTION and ADDRESSTYPECODEID_TRANSLATION

Queries utilizing [V_QUERY_CONSTITUENT\Addresses].[STATEID_TRANSLATION] and/or [V_QUERY_CONSTITUENT\Addresses].[ADDRESSTYPECODEID_TRANSLATION] may experience degraded performance due to nested selects, such as: 
and [V_QUERY_CONSTITUENT\Addresses].[ADDRESSTYPECODEID_TRANSLATION] in (select [DESCRIPTION] from [dbo].[ADDRESSTYPECODE] where ID in (N'61c1f95b-d517-4217-8ada-2f4b18f99cba', N'0462f667-05d8-488a-9e35-66c42acda1bb', N'f5f6cbe6-eb6a-4847-a988-4039d25d4f70', N'c983d2c2-52eb-4bda-a4ba-a8808a563479')))
Or the use of the lookup function UFN_STATE_GETDESCRIPTION, such as:
or [V_QUERY_CONSTITUENT\Addresses].[STATEID_TRANSLATION] in (select [dbo].[UFN_STATE_GETDESCRIPTION](N'ae6e6e11-a0c0-46b4-9e3a-8161b05bbd6e') union select [dbo].[UFN_STATE_GETDESCRIPTION](N'e443ccb3-d81e-4176-bfb7-92fee33ae8f0') union select [dbo].[UFN_STATE_GETDESCRIPTION](N'dc8f1901-16d5-4b18-8b6b-23baf36d4f9b'))))

 
We’re currently evaluating this issue for a fix in a future patch or service pack.

Steps to Duplicate

  1. Review a query with [V_QUERY_CONSTITUENT\Addresses].[STATEID_TRANSLATION] and/or [V_QUERY_CONSTITUENT\Addresses].[ADDRESSTYPECODEID_TRANSLATION]
  2. Preview the generated SQL in CRM.
  3. If the query is running slower that before 4.0, and has one of these two fields, this query may be impacted.

Environment

 Blackbaud CRM
 4.0

Was this article helpful?