MySQL bitwise operations

Hi,

Do bitwise operations utilize indexes as efficiently as using equality operators?

For example:
Bitwise:
SELECT * FROM temp WHERE flag & 6;

Equality:
SELECT * FROM temp WHERE flag<=4;

Where 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

Cheers!

Hmm, it’s come to my attention that a bitmap index would be required.

MySQL doesn’t feature bitmap type indexes.