zoukankan      html  css  js  c++  java
  • 使用查询调控器防止查询长时间运行

    在SQL Server服务器属性--连接中,有一个名为“使用查询调控器防止查询长时间运行”的选项:

    官网解释如下:

    query governor cost limit option:

    Use the query governor cost limit option to specify an upper limit on the time period in which a query can run. Queries that have estimated run times greater than this limit, return an error and are not executed. Query cost refers to the estimated elapsed time, in seconds, required to complete a query on a specific hardware configuration.If you specify a nonzero, nonnegative value, the query governor disallows execution of any query that has an estimated cost exceeding that value. Specifying 0 (the default) for this option turns off the query governor, and all queries are allowed to run without any time limitation.If you use sp_configure to change the value of query governor cost limit, the changed value is server wide. To change the value on a per-connection basis, use the SET QUERY_GOVERNOR_COST_LIMIT statement.The query governor cost limit option is an advanced option. If you are using the sp_configure system stored procedure to change the setting, you can change query governor cost limit only when show advanced options is set to 1. The setting takes effect immediately (without a server restart).
     
    说明此设置是一个cost阈值,无单位。如果某个query的subtreecost大于设置值,则不会执行,而是直接报如下错误:

    消息 8649,级别 17,状态 1,服务器 LEOSWONDERWORLD,第 1 行
    查询已取消,因为此查询的估计开销(59)超出了配置的阈值 5。请与系统管理员联系。

    需要特别注意的一点是,这个设置貌似对sqlserver management studio(ssms.exe)工具无效,无论是在DB Server本地还是远程连接,使用ssms进行的查询都不会受此参数影响。

    但是通过链接服务器查询或者osql、sqlcmd则可以验证。

  • 相关阅读:
    图片上传
    解决Vuex持久化插件-在F5刷新页面后数据不见的问题
    vue登录
    拖动排序的vue组件
    vue图片懒加载
    vue中使用图片预加载
    前端架构知识体系
    html判断IE版本
    HighCharts 在IE8下饼图不显示的问题
    新一代调试王者Console
  • 原文地址:https://www.cnblogs.com/leohahah/p/7761483.html
Copyright © 2011-2022 走看看