List:General Discussion« Previous MessageNext Message »
From:Jeremy Zawodny Date:September 16 2001 4:41am
Subject:Re: Storing binary flags
View as plain text  
On Wed, Sep 12, 2001 at 07:55:05PM +0200, Sander Pilon wrote:
> Dear List,
> 
> I need to store a set of flags in SQL, as in 20 true or false
> values.  The logical choice seems to be the SET type, but does it
> use an index?

I don't think so...  It is implemented as a bitmask behind the scenes.

It *could* use an index (not exactly in the normal way), but my gut
feel is that it doesn't.

> The manual gives an examle where a set is queried with LIKE
> '%flag%'. That scares me a bit, because the table is going to
> contain hundredthousands of rows - and I need to be able to filter
> on these flags effeciently.
> 
> I could make 20 separate rows as tinyint, but that seems like a lot
> of overhead.

What sort of overhead?  The relational model suggests that you might
want to use multiple rows in a separate table that you can join with
the main table.

MySQL is rather fast, even with a lot of data thrown at it.  Might be
worth a try.

Jeremy
-- 
Jeremy D. Zawodny, <jzawodn@stripped>
Technical Yahoo - Yahoo Finance
Desk: (408) 349-7878   Fax: (408) 349-5454   Cell: (408) 685-5936

MySQL 3.23.41-max: up 10 days, processed 184,514,329 queries (213/sec. avg)
Thread
Faster mysqlMarcin Pyla12 Sep
  • Re: Faster mysqlJeremy Zawodny16 Sep
RE: Faster mysqlSimon Green12 Sep
  • RE: Faster mysqlMarcin Pyla12 Sep
RE: Faster mysqlSimon Green12 Sep
  • Storing binary flagsSander Pilon12 Sep
    • Re: Storing binary flagsJeremy Zawodny16 Sep
Re: Faster mysqlRobert Cross12 Sep