5 ms·
The problem at least with MSSQL is that these Table Valued Functions or User Defined Functions (scalar) are definitely not zero-cost abstractions. Another issu
by sebazzz 4y ago
The problem at least with MSSQL is that these Table Valued Functions or User Defined Functions (scalar) are definitely not zero-cost abstractions.
Another issue is that the “SELECT” is also part of the function, which makes it even worse - so you can’t create just one function and reuse it all over the place. If only you could tell SQL that a certain JOIN always contains one row, or zero or one row (for a LEFT JOIN), then there would be more room for optimization.
- trimethylpurine 4y agoI think that's subjective. You can index to optimize for whatever your function is doing. I don't see any reason that the "select" limits reusability. If you define your function with relevant parameters you can create theoretically infinite reusability.