Hi.

On Thu, Oct 04, 2001 at 09:01:05AM +0000, [EMAIL PROTECTED] wrote:
[...]
> > Actually, it's in the manual (but just recently ;), but it tells
> > otherwise: http://www.mysql.com/doc/C/o/Column_types.html
> 
> Ah. One question about using CHAR(1) as BOOL, though:
> Will the value be stored as 0/1 or as '0'/'1'?

I am not sure what you mean by 0/1. The characters representations of
byte value 0 resp. 1?

It is stored as "0" and "1", i.e. the characters with ASCII values 48
and 49.

> The former would give all sorts of troubles, and the latter would
> require a huge number of string<->int conversions when the column is
> used in a WHERE.

Well, such conversions are really a minor part of what MySQL has to do
to resolve a query (about 1 second for 2.000.000 conversions on a
Pention III 800 MHz). A typical index seek for equivalence has log(N)
comparisons, i.e. 20 for 1.000.000 rows. And without indexes, reading
2.000.000 rows will surely take much longer.

More interesting is the fact that this conversion may prevent the use
of indexes. On the other hand, you only have two values, and index
wouldn't be of much use anyhow - in most cases at least.

> Is the performance difference between BOOL and TINYINT(1) know?

Don't know. Considering the above, TINYINT should be faster. If it's
significant, that's different question.

Bye,

        Benjamin.

-- 
[EMAIL PROTECTED]

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to