I have a T-SQL query that is causing performance issues. Its a chunky one but the part that seems to be causing an issue is a simple LEFT JOIN.
This can be resolved by removing the left join and using a subquery in the select, however this seems unsatisfactory to me as I can't see why one works quickly and not the other.
Theres not a lot of data involved and there are keys/indexes on all the join columns. Only other thing I was wondering was about statistics on the database and whether they were affecting performance.
For instance (N.b. this is just a simplification of a much more complex query
SLOW
SELECT A.1,A.2,B.3 FROM A LEFT JOIN B ON A.ID = B.ID ...
FAST
SELECT A.1, A.2, (SELECT B.3 FROM B WHERE B.ID = A.ID) FROM A