List:General Discussion« Previous MessageNext Message »
From:Kyong Kim Date:June 30 2010 4:47am
Subject:Re: Two Primary Keys
View as plain text  
This isn't true for innodb.
I think the only requirement is that you need to have a unique index
on the auto increment column.
We created a composite primary key + auto_increment to take advantage
of clustering by primary key while satisfying unique constraint for
the primary key. It worked out well for us except for the sheer size
of the indexes.
Kyong

2010/6/29 João Cândido de Souza Neto <joao@stripped>:
> As far as I know, if you have an auto_increment primary key, you cant have
> any other field in its primary key.
>
>
> João Cândido.
>
> "Victor Subervi" <victorsubervi@stripped> escreveu na mensagem
> news:AANLkTikzkSMBx5hUe0X_Q3Hx_68gICndghpkJdRNA9xA@ style="color:#666">stripped...
>> Hi;
>> I have the following:
>>
>> create table pics (
>>   picture_id int auto_increment primary key,
>>   product_sku int not null primary key,
>>   picture_num int not null,
>>   picture_desc varchar(100),
>>   picture_data longblob
>> );
>>
>> which doesn't work I need to auto_increment and declare primary key on two
>> fields. How do?
>> TIA,
>> Victor
>>
>
>
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    http://lists.mysql.com/mysql?unsub=1
>
>
Thread
Two Primary KeysVictor Subervi29 Jun
  • Re: Two Primary Keysjoao29 Jun
    • Re: Two Primary KeysVictor Subervi29 Jun
      • Re: Two Primary KeysDuĊĦan Pavlica29 Jun
        • RE: Two Primary KeysSteven Staples29 Jun
    • Re: Two Primary KeysKyong Kim30 Jun
  • Re: Two Primary Keysjoao29 Jun
    • Re: Two Primary Keyspetya29 Jun
  • Re: Two Primary KeysMySQL)29 Jun
  • Re: Two Primary Keysjoao29 Jun
    • Re: Two Primary KeysVictor Subervi29 Jun
Re: Two Primary Keyspetya29 Jun