zoukankan      html  css  js  c++  java
  • 查询时带Ntext或nvarchar(Max)到底有多影响速度

    我测试的可能不多准确,但是至少说明慢了不少,并发的话会更慢。 这是一个23000条数据的表 仅仅2W多条。
    set   statistics   time   on
    select top 20 title,left([content],200from test
    where 
    id 
    <  (select min(id) from (select top 20 id from test order by id descas idlist)
    order by id desc

    select top 20 title,[content] from test
    where 
    id 
    <  (select min(id) from (select top 20 id from test order by id descas idlist)
    order by id desc

    select top 20 title from test
    where 
    id 
    <  (select min(id) from (select top 20 id from test order by id descas idlist)
    order by id desc

    select top 20 id,title from test
    where 
    id 
    <  (select min(id) from (select top 20 id from test order by id descas idlist)
    order by id desc

    select top 20 title from test
    where 
    id 
    not in (select top 20 id from test order by id desc)
    order by id desc

    SQL Server 分析和编译时间:
       CPU 时间 = 16 毫秒,占用时间 = 44 毫秒。

    SQL Server 执行时间:
       CPU 时间 = 0 毫秒,占用时间 = 1 毫秒。

    (20 行受影响)

    SQL Server 执行时间:
       CPU 时间 = 842 毫秒,占用时间 = 1078 毫秒。

    (20 行受影响)

    SQL Server 执行时间:
       CPU 时间 = 78 毫秒,占用时间 = 246 毫秒。

    (20 行受影响)

    SQL Server 执行时间:
       CPU 时间 = 47 毫秒,占用时间 = 63 毫秒。

    (20 行受影响)

    SQL Server 执行时间:
       CPU 时间 = 47 毫秒,占用时间 = 58 毫秒。

    (20 行受影响)

    SQL Server 执行时间:
       CPU 时间 = 62 毫秒,占用时间 = 75 毫秒。


    速度差别出来了, 如果网站需要带简介 还得用一个字段才行的。。

  • 相关阅读:
    ES6和Node.js的import和export
    重写Router.prototype.push后还报NavigationDuplicated错误的解决方法
    nightwatch对前端做自动化测试
    使用video.js 7在html中播放rtmp视频流
    UEFI开发环境搭建
    类的静态成员
    const成员函数
    类和结构
    最长递增子序列
    C语言将十六进制字符串转化成十六进制
  • 原文地址:https://www.cnblogs.com/mad/p/1377509.html
Copyright © 2011-2022 走看看