This one has me stumped. We have a simple view on a table which enforces some security rules so users can only see the data they're entitled to see. This is on SQL 2008 (client software and we can't force them to upgrade, alas)
We have two users, both set up identically as far as we can see.
When we run the same query, they both get the same results, but one takes less than a second, the other takes more than 5 seconds.
The execution plans (attached) look the same for both.
What should we be looking for?
The "Estates_v" is defined as below:
ELECT [AllTheFieldsFromTheTable] from [dbo].[Estates] where (TeamCode in (Select TU.TeamCode from TeamUsers TU, StaffUser SU where SU.StaffCode = TU.StaffCode and SU.Username = SUSER_SNAME()) ) OR (TeamCode = 'ALL') OR (SUSER_SNAME() in ('sa','kpi_stats'))) WITH CHECK OPTION
Any insight greatly appreciated.