Hi - I have a query which is running very slow under a certain condition. I have 2 tables, Employees and EmployeeGroups. Employee has employees personal information and employeegroups has a mapping of each employee to the group it belongs to. One employee
can be a part of multiple groups. The problem is with the below query.
SELECT emp_GUID, emp_firstname,emp_LastName
FROM Employee E join EmployeeGroups ON Emp_Guid=EMG_Emp_GUID
where EMG_GUID In ('multiple group GUIDs') and emp_Lastname like 'abc%'
EMG_Emp_GUID - Employee id of the employee
EMG_GUID - ID of the group employee belongs to.
The query runs well with less number of groups but it slows down as the number of groups i.e data increases. The tables is well indexed.
I am running out of ideas on this. Need help.
View Complete Post