none
Performance of query on indexed Boolean/Bit column vs Datetime column RRS feed

  • Question

  • Given both are indexed and hundreds of thousands or records, is there a performance hit if I were to query:

    Select * from mytable where isActive = 1

    versus

    Select * from mytable where expirationDate > GETDATE()

    ?


    . · * ´ ¨ ) .· ` T C H ( . . · *

    Thursday, August 22, 2019 8:17 PM

All replies

  • Hi,

    In my opinion, using the first option will be a better option. First of all because the amount of bytes involved. Of course using a boolean bit column will use much less space than datetime datatype. Your second option, considering you'll use as you describe above, an equal operator with a database system function, maybe the execution plan will not be so optimized as the it could be (we should test both options).

    Regards,
    Rafael

    Thursday, August 22, 2019 8:54 PM