True/False vs 0/1 in MySQL

后端 未结 4 1323
忘了有多久
忘了有多久 2020-12-02 19:59

Which is faster in a MySQL database? Booleans, or using zero and one to represent boolean values? My frontend just has a yes/no radio button.

4条回答
  •  情深已故
    2020-12-02 20:08

    In MySQL TRUE and FALSE are synonyms for TINYINT(1).

    So therefore its basically the same thing, but MySQL is converting to 0/1 - so just use a TINYINT if that's easier for you

    P.S.
    The performance is likely to be so minuscule (if at all), that if you need to ask on StackOverflow, then it won't affect your database :)

提交回复
热议问题