BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News SQL Server 2016: Natively Compiled Functions

SQL Server 2016: Natively Compiled Functions

Bookmarks

Server 2014 saw the introduction of Natively Compiled Stored Procedures. In 2016 we’ll be able to do the same for Scalar User Defined Functions (Scalar UDF).

In SQL Server, normal T-SQL is compiled into a proprietary intermediate language. That intermediate language is then interpreted at run time. With native compilation, the stored procedure is converted into C code, which is then compiled into a DLL that SQL Server uses at run time.

A Scalar UDF can now be compiled to machine code in a similar manner. For simple operations, this should result in a significant performance improvement. Natively compiled Scalar UDFs can be used anywhere normal Scalar UDFs can be used. Beyond that, they can also be used in Natively Compiled Stored Procedures. This is a huge win for code reusability, which has historically meant poor performance in SQL Server.

Like Natively Compiled Stored Procedures, Natively Compiled Scalar UDFs must be declared as schema bound. With stored procedures, the WITH SCHEMABINDING option indicates that native compilation is desired. It is unclear how that will work with UDFs, as you can have interpreted, schema-bound functions. Perhaps it will automatically detect whether or not a schema bound UDF is a candidate for native compilation and react accordingly.

 

Rate this Article

Adoption
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

BT