>>>>> "Christof" == Christof Damian <cdamian@stripped> writes:
Christof> Michael Widenius wrote:
>> >>>>> "Christof" == Christof Damian <cdamian@stripped>
Christof> I got a table which contains a set, it looks something like this:
Christof> now I need a select which gives me:
Christof> SELECT BIT_OR(col2) gives me the result, but only as binary value and
Christof> there is no way to get back to the set values (or is there?). I also
Christof> have no idea how fast it is with big tables.
>> SELECT MAKE_SET(BIT_OR(col2),'a','b','c','d') ...
Christof> Yes, I figured that out myself, but then the application always has to
Christof> know about the database definition. I probably could get that
Christof> information with "SHOW COLUMNS FROM ...", but that still requires some
Christof> string juggling on the application site. Well I use it anyway.
Christof> Which brings me to my second question: Is BIT_OR() optimized to use
Christof> indexes or does it has to look through all rows ?
BIT_OR() is a summary function. This doesn't have to be indexed for
MySQL to be able to use indexes.
PS: If you ask a question about optimization, please ALWAYS include
some sample query!