V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
dtgxx
V2EX  ›  问与答

大佬们, where 后面是肯定的还是否定的对性能有影响吗?

  •  
  •   dtgxx · 2021-09-01 09:53:19 +08:00 · 989 次点击
    这是一个创建于 939 天前的主题,其中的信息可能已经有所发展或是发生改变。

    table 有两个相同最大长度的字段 a,b

    select a,b from table where a is null;

    select a,b from table where b is not null;

    这两个在性能上 是一样的吗

    3 条回复    2021-09-01 13:14:54 +08:00
    rainymoring1995
        1
    rainymoring1995  
       2021-09-01 11:00:26 +08:00
    看一下执行计划就知道了
    jtwor
        2
    jtwor  
       2021-09-01 11:19:31 +08:00   ❤️ 1
    is not null 会索引失效
    blackshow
        3
    blackshow  
       2021-09-01 13:14:54 +08:00
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1048 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 22:35 · PVG 06:35 · LAX 15:35 · JFK 18:35
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.