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 毫秒。


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

  • 相关阅读:
    匿名对象
    再次安装xampp遇到的各类问题汇总
    jupyter notebook添加Anaconda虚拟环境的python kernel
    1003. 我要通过!
    大数据分析-excel常用技巧
    Jupyter Notebook 修改默认打开的文件夹的位置
    A*算法介绍
    MATLAB常用函数(不定时更新)
    2019数学建模美赛感悟
    Windows许可证即将到期激活教程
  • 原文地址:https://www.cnblogs.com/mad/p/1377509.html
Copyright © 2011-2022 走看看