首页 \ 问答 \ SQL过程中的打印语句会影响性能?(Print Statement in SQL procedure should affect Performance?)

SQL过程中的打印语句会影响性能?(Print Statement in SQL procedure should affect Performance?)

我正在使用SQL Server过程,并且有习惯在存储过程中使用Print语句来区分过程代码。

我的数据库中有近200-250个程序。 打印声明是否会影响性能? 我正在开发多用户Windows应用程序。


I am using SQL Server procedures and I have a habit of using of Print statements in the stored procedures to differentiate the code of procedure.

I have almost 200-250 procedures in my DB. Should print statement affect the performance? I am working on multi-user Windows application.


原文:https://stackoverflow.com/questions/3690127
更新时间:2023-07-29 13:07

最满意答案

携带可以订阅a s的事件的来源具有以下类型

type Source m a = (a -> m ()) -> m (m ())
                   |             |  ^--- how to unsubscribe             
                   |             ^--- how to subscribe
                   ^--- what to do when an `a` happens

消费者或事件处理者天真地接受事件源并订阅它

type Handler m a = (Source m a             ) -> m ()
                 = ((a -> m ()) -> m (m ())) -> m ()
                                                ^-- set up the consumer.

这有点令人费解,我们可以将事物颠倒过来并为事件处理函数获得更好的表示形式:

type Handler m a = m () -> m (a -> m ())
                   |       |  ^-- what to do when an `a` happens
                   |       ^-- set up the consumer
                   ^-- how to unsubscribe

原始事件来源有点棘手, 订阅者可能想要响应事件发生而取消订阅,在这种情况下,他们需要递归地将产生的取消订阅行为转变为事件发生时要做的事情。 从处理程序的更好的定义开始,我们没有这个问题。 事件源现在是接受事件处理程序并发布给它的东西。

type Source m a = (Handler m a          ) -> m ()
                = (m () -> m (a -> m ())) -> m ()
                                             ^-- how to subscribe

An source of events carrying as that can be subscribed to has the following type

type Source m a = (a -> m ()) -> m (m ())
                   |             |  ^--- how to unsubscribe             
                   |             ^--- how to subscribe
                   ^--- what to do when an `a` happens

A consumer or handler of events is naively something that accepts an event source and subscribes to it

type Handler m a = (Source m a             ) -> m ()
                 = ((a -> m ()) -> m (m ())) -> m ()
                                                ^-- set up the consumer.

This is a bit convoluted, we can invert things and get a nicer representation for an event handler:

type Handler m a = m () -> m (a -> m ())
                   |       |  ^-- what to do when an `a` happens
                   |       ^-- set up the consumer
                   ^-- how to unsubscribe

The original event source was a bit tricky to use; a subscriber might want to unsubscribe in response to an event happening, in which case they'd need to recursively get the resulting unsubscribe action into what to do when an event happens. Starting with the nicer definition of a Handler we don't have this problem. An event source is now something that accepts an event handler and publishes to it.

type Source m a = (Handler m a          ) -> m ()
                = (m () -> m (a -> m ())) -> m ()
                                             ^-- how to subscribe

相关问答

更多