vverr
V2EX  ›  问与答

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

  •  
  •   vverr · Sep 1, 2021 · 1786 views
    This topic created in 1741 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   ·   1250 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 62ms · UTC 17:27 · PVG 01:27 · LAX 10:27 · JFK 13:27
    ♥ Do have faith in what you're doing.