Long Running with inner Join

XexeX 2013-10-17 09:44:46

I'm new to SQL, a user report that the server running slow, and I found that he run a query with inner which need more than 2 mins to completed.

I take a look from execution plan, the Actual Number or Row of Lazy Pool is very high, I don't know why the Actual number of row is higher than the number of row of table.

Can you help to found what problem with this query?


Dan Holmes 2013-10-17 21:10:56
"inner join inclbla b on a.label_id= b.label_id +'-' +b.label_id_suffix "

the right side (the b side) isn't sargable and will force the index scan that is in the lower branch. If that is really the only way to make this join, you may need to create a computed persisted column based on that expression and then index that new column.

XexeX 2013-10-21 04:28:45
Can I create a index which include "b.label_id" and "b.label_id_suffix" to fix this problem?