REPORT-674 - fixing deadlocks introduced as a result of the speedup by joining on idset table

See also UHM-1371 in PIH JIRA