MySQL Forums
Forum List  »  Quality Assurance

Binary versus Integer ...
Posted by: Alexandre Ostanine
Date: August 22, 2012 08:23PM

I've just discovered ...probably bit too late ...or bit too early
that MySQL can work with bit fields ...wow...great ..
directly setted up a test table... works ..OK..

than i added binary (64bit) field to my working table with 1.9mil records...
that previously had 1 integer field with a flag to indicate state of the field ...0,1

ok ..then i did this: (to check state of new system that was bit based ..not field based):

select x from table y where state & 1<<16

I was killed by result ... it was 100 times slower than if i would check the integral field ...WHY ?


it took 0.003sec to check 1.9mil records for a single field ...
and it took 0.5sec if it was bit field ...

EXCUSE ME ?...

CMP EAX,EBX ...
JAE @above_equal
or
AND EAX,EBX
JNZ @not_zero..

(and there are 64bit mmx registers, and 128 xmmx registers if needed
so - i guess working on each byte is not an issue here ...)

are taking less than 1 CPU cicle ...(even as on 486)...
Why is this operation takes 100 times more time ?
or you shifting the bit for each iteration ? even if its given as constant ?
even then - it just can not take 100 times more time...

Could you please explain this ?

Options: ReplyQuote


Subject
Views
Written By
Posted
Binary versus Integer ...
3022
August 22, 2012 08:23PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.