We are seeing a huge performance hit with a query that uses the IS_MEMBER function to make sure the current login is part of an specific set of groups in AD.
When we run the code containing the IS_MEMBER function, the query runs in 02:06 minutes.
When the IS_MEMBER piece of code is removed, without checking for the group information, the query runs in 1 second.
While observing the query running for over 2 minutes, I see most of time being spent on the following WAIT STATS:
PREEMPTIVE_OS_LOOKUPACCOUNTSID
PREEMPTIVE_OS_AUTHORIZATIONOPS
These are not well documented WAIT STATS. It seems that only Paul Randal has some information on them.
About my environment:
SQL Server 2012 with AlwaysOn Enabled. This query runs in one of the AlwaysOn Replicas.
For troubleshooting purposes we ran this on the principal as well, and we're still having the same performance.
Are you guys familiar with any issues with that function?
Would the ADSI link work better than the IS_MEMBER function?
Anywhere you guys could point me to?
--- Best Regards, Igor Santos Twitter: @sqlsantos Blog: sqlsantos.wordpress.com