vverr
V2EX  ›  问与答

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

  •  
  •   vverr · Sep 1, 2021 · 2167 views
    This topic created in 1903 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
    rainymoring1995
    Sep 1, 2021
    1
    看一下执行计划就知道了
    jtwor
    jtwor
    Sep 1, 2021❤️1
    2
    is not null 会索引失效
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   4343 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 08:59 · PVG 16:59 · LAX 00:59 · JFK 03:59
    ♥ Do have faith in what you're doing.