[development] User Status [WAS: User last access]
David Timothy Strauss
david at fourkitchens.com
Sun May 4 15:02:23 UTC 2008
A bitmask isn't a column type; it's an operation to perform on a column to extract a bit. Bitmasking is handled by functions, and MySQL can't index the results of functions. That's why I say MySQL can't index bitmasks. You can put an index on the bitfield/int column, but it's useless for the majority of lookups.*
*The index could function for conjunctive (AND) conditions beginning with the leftmost bit and not skipping any bits, but the query would have to be carefully constructed.
----- "Earnie Boyd" <earnie at users.sourceforge.net> wrote:
> > -----Original Message-----
> > From: Earnie Boyd <earnie at users.sourceforge.net>
> >
> > Date: Sat, 03 May 2008 09:59:43
> > To:development at drupal.org
> > Subject: Re: [development] User Status [WAS: User last access]
> >
> >
> > Quoting Larry Garfield <larry at garfieldtech.com>:
> >
> >>
> >> A) Make status have a lot of different states with int/consts.
> >> B) Make status a bitmask field (compact but harder to query).
> >> C) Break status out into a series of is_foo fields (possibly a lot
> of
> >> needless data).
> >>
> >
> > I like option B for this.
> >
>
> Quoting David Strauss <david at fourkitchens.com>:
>
> > Remember that MySQL cannot truly index bitmasks. Consider a series
> of
> > CHAR(0) columns, which would take the same space but be indexable.
> >
>
> I was thinking more of an integer field used as a bitmask.
>
> Earnie -- http://for-my-kids.com/
> -- http://give-me-an-offer.com/
More information about the development
mailing list