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


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

  • 相关阅读:
    SqlServer 本地连接打不开
    Ftp服务器搭建方法
    SQL分页查询
    sql 多表更新
    SQL 循环截取指定位置字符串
    创建在“system.net/defaultProxy”配置节中指定的 Web 代理时出错。
    python入门学习的第一天
    操作系统第二章总结/
    操作系统第一章总结/
    终端执行for循环
  • 原文地址:https://www.cnblogs.com/mad/p/1377509.html
Copyright © 2011-2022 走看看