返回存储过程的 SQL 性能 [英] SQL performance for a returning stored procedure

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

问题描述

有人问我以下问题,当您想提高存储过程性能时,您会考虑什么?存储过程正在返回一些值并在其中包含三个连接.除了确保连接写得很好之外,还可以做些什么来使其性能更好?这是一个普遍的问题,没有提供代码.有什么想法吗?

I have been asked the following question, what would you look into when you want to improve a stored procedure performance? The stored procedure is returning some value and have three joins in it. Other than making sure the joins are well written what one can do to make it perform better? This was a general question and no code was provided. Any ideas?

推荐答案

您可以做很多事情来优化过程,但听起来您的 SQL 语句非常简单.需要注意的一些事项:

There are a lot of things you can do to optimize procedures, but it sounds like your SQL statement is pretty simple. Some things to watch out for:

  • 内联函数.这些会导致 SQL 逐行评估并减慢速度
  • 连接语句上的数据转换.这些可以防止使用索引.
  • 确保在 where 子句上/在 where 子句中连接的列已编入索引(对于大型数据集)

您可以查看此网站以获取更多性能提示,但我想我已经涵盖了您对简单语句所需的大部分内容:

You can check out this website for more performance tips, but I think I covered most of what you need for simple statements:

SQL 优化学校

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

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