SQL 存储过程中注释的性能影响 [英] Performance Implications of Comments in SQL Stored Procedures

查看:56
本文介绍了SQL 存储过程中注释的性能影响的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近在我的日常工作中被告知关于我们的存储过程的任何评论不得存在于存储过程中,而必须使用扩展属性.

Recently at my day-job were were instructed that any comments regarding our stored procedures MUST NOT exist inside the stored procedure and rather Extended Properties must be used.

过去我们使用过这样的东西.

In the past we used something like this.

/*
 * NOTE: Auto-Generated Procedure DO NOT MODIFY
 */
CREATE PROCEDURE dbo.MyProc
AS
SELECT *
FROM MyTable
GO

这样,只要有人在 SSMS 中打开程序,他们就会看到注释,程序中也存在其他注释来记录我们的流程.现在我不知道这有任何性能/内存问题.但是,我们有些人坚持这样做.

This way anytime anyone opened the procedure in SSMS they would see the note, other comments also existed in procedures to document our process. Now I was not aware of any performance/memory issues with this. However we have individuals that insist it does.

我找不到任何文档来证明或否认此类评论存在性能和/或内存问题.

I have not been able to find any documentation to prove or deny the existance of performance and/or memory issues with this type of comments.

所以我的问题是,有人知道可以证明或否认这一点的任何文件吗?

So my question is, does anyone know of any documentation that can either prove or deny this?

推荐答案

它会稍微减慢存储过程的编译速度,无论如何这种情况不应该经常发生.

It will slow down the compilation of the stored procedure just a tiny bit, and that shouldn't happen often anyway.

基本上这听起来像是在吓唬人.考虑到评论的有用性(适度)我会要求证据评论会影响性能.对我来说,这听起来像是一个荒谬的政策.

Basically this sounds like scare-mongering. Given how useful comments can be (in moderation) I would demand evidence that comments hurt performance. It sounds like a ridiculous policy to me.

(每当有人提出有关性能的要求时都要求提供证据是一个很好的一般规则 - 特别是如果他们建议您为了所谓的性能提升而牺牲可读性或其他一些积极的属性.)

(Demanding evidence any time someone makes claims about performance is a good general rule - particularly if they're suggesting that you sacrifice readability or some other positive attribute for the sake of the supposed performance gain.)

这篇关于SQL 存储过程中注释的性能影响的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆