Announcement

Announcement Module
Collapse
No announcement yet.

MySQL bitwise operations

Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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!

  • #2
    Hmm, it's come to my attention that a bitmap index would be required.

    MySQL doesn't feature bitmap type indexes.

    Comment

    Working...
    X