List:General Discussion« Previous MessageNext Message »
From:Jim McAtee Date:July 13 2003 7:36pm
Subject:Re: does mySQL support a boolean data type?
View as plain text  
If storage space is really a big motivator, you can roll your own by using
something like unsigned integers, each of which will accomodate 32 bit fields.
Then use bitmasks to read/write the values.  Probably makes writing WHERE
clauses a bit tedious, and doing joins on the bit fields may not be possible
without a lot of effort.  It would also be a bit slower, since you have to
apply boolean operations every time you read or write a field.  But that's
completely application dependant and it may not add much overhead to your
particular app.  If you can live with those shortcoming, then move the bit
logic into your application.



----- Original Message ----- 
From: "Dan Anderson" <dan@stripped>
To: <nospam@stripped>
Cc: <mysql@stripped>
Sent: Sunday, July 13, 2003 11:21 AM
Subject: Re: does mySQL support a boolean data type?


> > why don't you use int(1) and set it to 0 or 1?
>
> Storage space is an issue because I am designing a very large database
> for a client.  Every byte I save per row will translate into many many
> megs.  So if all I need is a single bit for true or false I want to get
> as close to that single bit as possible.  (Although most bools end up
> being more then a single bit because of architecture issues).
>
> So, to put a long story short, I am trying to make every column's
> internal data structure as tiny as possible.

Thread
does mySQL support a boolean data type?Dan Anderson13 Jul
  • Re: does mySQL support a boolean data type?nospam13 Jul
    • Re: does mySQL support a boolean data type?Dan Anderson13 Jul
  • Re: does mySQL support a boolean data type?Ed Leafe13 Jul
  • Re: does mySQL support a boolean data type?Sagi Bashari13 Jul
    • Re: does mySQL support a boolean data type?Andreas D. Landmark14 Jul
  • Re: does mySQL support a boolean data type?Phil Bitis13 Jul
  • Re: does mySQL support a boolean data type?Phil Bitis13 Jul
  • Re: does mySQL support a boolean data type?nospam13 Jul
  • Re: does mySQL support a boolean data type?Phil Bitis13 Jul
  • Re: does mySQL support a boolean data type?Jim McAtee13 Jul