Do bitwise operations utilize indexes as efficiently as using equality operators?
SELECT * FROM temp WHERE flag & 6;
SELECT * FROM temp WHERE flag<=4;
flag is a non-unique index.
My gut impression is bitwise operations aren’t efficient.
An EXPLAIN results in a larger number of rows examined when using bit operations:
Bitwise: 5 out of 5 rows examined
Equality: 3 out of 5 rows examined