SQL Server语言扩展性能

发布于 2025-01-31 12:01:47 字数 81 浏览 3 评论 0原文

SQL Server语言扩展功能在外部进程中执行。这是否意味着当在Select子句中调用此函数时,它会为应用程序的每个行中的每个行创建一个新的过程?

A SQL Server Language Extension function is executed in an external process. Does it mean that when such a function is called in a Select clause it creates a new process for every row in the recordset on which it is applied?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

递刀给你 2025-02-07 12:01:47

我认为您正在混淆两个不同的功能 /技术。

  • sqlClr 是运行.NET代码的能力(最常见于C#或vb.net,但有时是Visual C ++,有时是F#,尽管F#不受正式支持) SQL Server进程。该代码可以称为存储过程,触发器,标量功能,表值功能,聚合功能,甚至用户定义的类型。即使存在主动事务,也可以在调用会话中执行T-SQL(即正确执行执行)。

  • 外部脚本(语言扩展)比SQLCLR更新,并且不是.NET特定的。可以使用的语言是:R,Python,Java和最近的C#。该代码只能通过 sp_execute_external_script 存储过程;没有选项可以通过函数调用这些外部脚本。因此,没有每行执行的概念。这些脚本由单独的服务(IE外部)执行,因此没有选项的t-sql代码执行(含义:通过外部脚本执行T-SQL将作为单独的会话连接)。

    )。

其他详细信息可以在我的帖子中找到:
sqlclr vs sql Server 2017,第8部分:SQLClr是否已弃用python或r(sp_execute_external_script)?

I think you are confusing two different features / technologies.

  • SQLCLR is the ability to run .NET code (most often C# or VB.NET, but sometimes Visual C++ and occasionally F#, though F# is not officially supported) within the SQL Server process. This code can be called as stored procedures, triggers, scalar functions, table-valued functions, aggregate functions, and even user-defined types. This has the ability to execute T-SQL within the calling session, even if there's an active transaction (i.e. true in-process execution).

  • External Scripts (language extensions) is newer than SQLCLR and is not .NET-specific. Languages that can be used are: R, Python, Java, and most recently C#. This code can only be executed via the sp_execute_external_script stored procedure; there is not option to call these external scripts via a function. Hence, there is no concept of per-row execution. These scripts are executed by a separate service (i.e. external), hence there is no option for in-process T-SQL code execution (meaning: executing T-SQL via an external script will connect as a separate session).

Additional details can be found in my post:
SQLCLR vs SQL Server 2017, Part 8: Is SQLCLR Deprecated in Favor of Python or R (sp_execute_external_script)?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文