On 8/1/08, Josh Berkus <[EMAIL PROTECTED]> wrote:
>
>
> > > I don't believe anyone in Drizzle's target audience is doing bitwise
> > > math in the database, including left and right shifts, and especially
> > > not the groupwise functions.  I can see it coming in handy with
>
>
> Hmmm.  I don't know about that; large numbers of flags is a pretty common
> situation with some types of websites (personals, for example).  I know
> three reasonable ways to handle that, bitstrings, arrays and hstore.
>
> So I'd say that it would be reasonable to drop it if we had some other way
> to handle large numbers of flags.  Suggestions?


I mentioned using bitstrings for large numbers of flags earlier in the
conversation, but I neglected to mention that bitstrings often do not work
well:
Firstly, there are many parameters that do not fit well into a bit (hair
color, income level) which some folks end up forcing into a bit structure,
which ends up being unnecessarily complicated (having a bit for each income
level and true/false values for each).

Secondly, using a bitstring requires magic positions -- the code has to
create and break down the bitstrings and search values, knowing somehow that
"0010" means "find someone with brown hair".

Thirdly, bitstrings are a hack designed to deal with the fact that MySQL
does not utilize bit indexes very well due to lack of selectivity
(exceptions are for when you are finding very few values among many,
sometimes an index on a status bit can be used if the search is for the
value not often used).

Fourthly, while some applications may actually be using bit operators (&, |,
~, etc) to compare flags, this falls apart pretty quickly.  Using bit
operators to find "someone with blue eyes and any color hair" is possible.
Finding "someone with blue eyes, any color hair, with an age between 20-27,
who is interested in finding a life partner but not threesomes" ends up
using multiple queries, subqueries, UNIONs or other techniques to hackily
force the complex queries into the bitstring model.

(and are folks actually using the groupwise bit operators in this scenario?
SELECT BIT_AND(col1) FROM tbl1....?)

If SET could handle more values, it might be an appropriate
substitution.....I see this as an RDBMS problem.  Even using bit strings
means the application code is involved in parsing the meaning of a bit
string.  And with everything, bit operators are not being banished from
Drizzle, just from the core.  I don't believe there's a core need for bit
operators; though there is a need to solve "how can we optimize searching
across multiple sets of flags?"

-- 
- Sheeri K. Cabral
_______________________________________________
Mailing list: https://launchpad.net/~drizzle-discuss
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~drizzle-discuss
More help   : https://help.launchpad.net/ListHelp

Reply via email to