Does setting Query Optimizer Fixes to ON enable Scalar UDF Inlining on a database with compatibility level 140?

dba.stackexchange https://dba.stackexchange.com/questions/261035

Question

Azure SQL Database Managed Instance. Current Compatibility Level is set to 140 to match on-prem SQL Server 2017 test and development server. I just read this article on Scalar UDF Inlining and was curious if setting Query Optimizer Fixes to ON would enable this feature? I have read several more articles on the topic but none of them address this question.

Was it helpful?

Solution

No, 'query optimizer fixes' only affects optimizer bug fixes that may result in unexpected query plan changes. It does not enable new features.

The only way to enable scalar function inlining is to set the database compatibility level to 150:

Enabling Scalar UDF Inlining

You can make workloads automatically eligible for Scalar UDF Inlining by enabling compatibility level 150 for the database. You can set this using Transact-SQL. For example:

ALTER DATABASE [WideWorldImportersDW] SET COMPATIBILITY_LEVEL = 150;

Apart from this, there are no other changes required to be made to UDFs or queries to take advantage of this feature.

Licensed under: CC-BY-SA with attribution
Not affiliated with dba.stackexchange
scroll top