On Wed, Nov 08, Jon Frisby wrote:

> On Nov 7, 2006, at 6:47 PM, Michael Fischer wrote:
> 
> >
> > Any thoughts on using BINARY(N) or CHAR(N) as a primary key?
> >
> > Performance issues? In mysql, in general?
> >
> > Yes, in the context of the application, there is a very good
> > reason for doing this, and not using an auto increment integer.

> I'm curious to know why simply having a UNIQUE constraint on the  
> column is inadequate...
> 
> -JF

I'm concerned with performance, not integrity constraints.

I was wondering, with respect to mysql internals, whether there
was any substantial penalty to using CHAR or BINARY vs. INTEGER
based primary keys. I imagine, though I have not probed the 
source code, that comparisons are done with bitwise-ands, or 
memcmp(3). For this of course, VARCHAR and VARBINARY fields
would be a pain, because, from row to row, you couldn't 
accurately optimize for the width of the data in the key field.
However, it might be perfectly reasonable to do so with fixed
length CHAR or BINARY ones.

Thanks.

Michael
-- 
Michael Fischer                         Happiness is a config option.
[EMAIL PROTECTED]                        Recompile and be happy. 

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

Reply via email to