If you want to use as little space as possible use char(0) and null/not-null
for your boolean values:

CREATE TEMPORARY TABLE test_bool (i char(5), bool char(0));
INSERT INTO test_bool VALUES
('true',''),('false',null),('true',''),('true',''),('false',null);
SELECT * FROM test_bool WHERE bool is not Null;
SELECT * FROM test_bool WHERE bool is Null;

In a multi-column table that saves you 1 byte per row.

Regards,
Tim.

----- Original Message ----- 
From: "Brian Mansell" <[EMAIL PROTECTED]>
To: "Cemal Dalar" <[EMAIL PROTECTED]>
Cc: "Group MySQL List" <[EMAIL PROTECTED]>
Sent: Friday, June 25, 2004 8:01 AM
Subject: Re: ENUM vs TINYINT


> Cemal,
>
> I recall hearing a similar question mentioned in a previous email
> thread. In fact, here it is:
>
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&threadm=c6h60e%2419dd%241%40FreeBSD.csie.NCTU.edu.tw&rnum=1&prev=/groups%3Fq%3D%2522enum%2Bor%2Btinyint%2522%26hl%3Den%26lr%3D%26ie%3DUTF-8%26selm%3Dc6h60e%252419dd%25241%2540FreeBSD.csie.NCTU.edu.tw%26rnum%3D1
>
> (thread is titled "enum or tinyint")
>
> I hope that helps!
>
> On Thu, 24 Jun 2004 21:17:09 +0300, Cemal Dalar <[EMAIL PROTECTED]> wrote:
> >
> > Hi all,
> >
> >     I need a boolean column and at to this time I always used
ENUM('Y','N')
> > for this. I'am wondering that will there be a performance difference
between
> > using ENUM('Y','N') and TINYINT(1) or BOOLEAN?. And put 0 or 1 to
TINYINT
> > column.
> >
> > Best Regards,
> > Cemal Dalar a.k.a Jimmy
> > System Administrator & Web Developer
> > http://www.dalar.net
> >
> >
> > --
> > MySQL General Mailing List
> > For list archives: http://lists.mysql.com/mysql
> > To unsubscribe:
http://lists.mysql.com/[EMAIL PROTECTED]
> >
> >
>
> -- 
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:
http://lists.mysql.com/[EMAIL PROTECTED]
>


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to