OUTER APPLY to external table costs 49% of the entire execution plan

Juliano 2016-01-29 17:28:18

I'm creating a stored procedure that will be used to return data for a report in my application. The query used in this stored procedure must have some information from a different database (I couldn't use LEFT JOIN because it can return more than one rows for the same ID, but with different description, so I need to use TOP 1) .

The problem is that I had to use OUTER APPLY and this is costing to much in the execution plan. Do I have any option?

Juliano 2016-02-01 12:37:08
The table that was causing the RID Lookup was missing a primary key. Also had to include the column RAZAO_SOCIAL in the index to get rid of the Key Lookup.