dtgxx
V2EX  ›  问与答

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

  •  
  •   dtgxx · Sep 1, 2021 · 1736 views
    This topic created in 1716 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   ·   1560 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 35ms · UTC 16:45 · PVG 00:45 · LAX 09:45 · JFK 12:45
    ♥ Do have faith in what you're doing.