V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
dtgxx
V2EX  ›  问与答

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

  •  
  •   dtgxx · Sep 1, 2021 · 1717 views
    This topic created in 1709 days ago, the information mentioned may be changed or developed.

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

    select a,b from table where a is null;

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

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

    3 replies    2021-09-01 13:14:54 +08:00
    rainymoring1995
        1
    rainymoring1995  
       Sep 1, 2021
    看一下执行计划就知道了
    jtwor
        2
    jtwor  
       Sep 1, 2021   ❤️ 1
    is not null 会索引失效
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3066 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 58ms · UTC 15:09 · PVG 23:09 · LAX 08:09 · JFK 11:09
    ♥ Do have faith in what you're doing.