Optimize mysql query to use index in broken where argument

I have a query that looks like this:

select count(*) from m1
WHERE  (m1.`resource` & 1472 );

Although I have an index on the resource, it does not use it. How can this be optimized for bitwise operation?

+3
source share
3 answers

I do not believe that MySQL can be used to use indexes for bitwise operations.

MySQL: http://forums.mysql.com/read.php?24,35318 ( " ?" ), MySQL (, -) . , , , .

http://dev.mysql.com/tech-resources/articles/mysql-set-datatype.html SET ( ), , - , SET s.

+8

MySQL , , .

- . , , .

eg -

indexedCol * 2 = 6;

-

indexedCol = 6/2;

, .

+3

On the Sql server, it uses a bitwise index. I am trying to reproduce the execution on MySql, but I can’t ... MySql is a great idea, but if they do not take into account the fundamental performance of bitwise operations, for example, this is a big disappointment!

0
source

All Articles