I have a TVF that when called takes 10 secs to run.
However if I take the query inside that TVF, it takes only 1 sec. I have added correct indexes on this underlying query tables.
In the Execution Plan of the TVF it is performing a table scan. How do I find out why it is doing this?
select Username, Identifier from [dbo].Unmapped(@CustID, @StartDate, @EndDate)
Table Scan properties...