Table value functions vs UDF SQL Server I am currently watching this video on Entity Framework and about 15 minutes in, the speaker says that table value functions occasionally out perform UDF's. 

My question is in what scenario do TVF's out perform UDF's?
A scalar UDF with table access acts like a lookup inside a RBAR curso. That is, it executes once per row. And it's black box to the optimier
TVF is a macro that expands like a view and is consider part of the outer query


Scalar UDF have uses, but not in this case.

The performance difference can be huge: I've achived x100,000+ improvements by removing idiotic uses of UDFs