code_junkie

Why does MySQL not use an index on a int field that's being used as a boolean?

Nov 13th, 2011
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. select * from myTable where myInt
  2.  
  3. select * from myTable where myInt = true
  4.  
  5. SELECT * FROM MyTable WHERE MyInt;
  6.  
  7. SELECT * FROM MyTable WHERE MyInt != 0;
  8.  
  9. SELECT * FROM MyTable WHERE MyInt IS TRUE;
  10.  
  11. SELECT * FROM MyTable WHERE MyInt = TRUE;
  12.  
  13. select * from myTable where myInt is not null
Add Comment
Please, Sign In to add comment