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 wel
y projects I am working on, where I've done this, but done it in
code, rather than in mysql.
Steven Staples
> -Original Message-
> From: Dušan Pavlica [mailto:pavl...@unidataz.cz]
> Sent: June 29, 2010 11:26 AM
> To: Victor Subervi
> Cc: mysql@lists.mysql.com
>
You were talking about multiple fields in the primary key, not multiple
primary keys.
On 06/29/2010 03:51 PM, Johan De Meersman wrote:
Correct, but you still can't have more than one primary key. Kind of
defeats the idea of it being primary, really.
On Tue, Jun 29, 2010 at 3:36 PM, petya mailt
to_increment primary key, you cant have
any other field in its primary key.
Makes sense. Actually, I was just copying what someone else gave me and
adding the auto_increment, then I got to wondering, what is the purpose of
having two primary keys?
TIA,
V
--
MySQL General Mailing List
F
2010/6/29 João Cândido de Souza Neto
> I think the best, or may be the right way is to use picture_id as primary
> key and a unique index to product_sku.
>
Yes, sounds good. So the purpose, then, is to speed lookups on fields
commonly accessed. I'd forgotten that.
Thanks,
V
I think the best, or may be the right way is to use picture_id as primary
key and a unique index to product_sku.
--
João Cândido de Souza Neto
"Victor Subervi" escreveu na mensagem
news:aanlktikzksmbx5hue0x_q3hx_68gicndghpkjdrna...@mail.gmail.com...
> Hi;
> I have the following:
>
> create
On 6/29/2010 9:24 AM, Victor Subervi wrote:
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 au
If you use innodb, primary key lookups are far faster than secondary
indexes.
Peter
On 06/29/2010 03:34 PM, João Cândido de Souza Neto wrote:
I think the real question is: What´s the purpose of any other field in my
primary key if the first one is an auto_increment and will never repeat?
t is the purpose of
having two primary keys?
TIA,
V
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org
at is the purpose of
having two primary keys?
TIA,
V
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" escreveu na mensagem
news:aanlktikzksmbx5hue0x_q3hx_68gicndghpkjdrna...@mail.gmail.com...
> Hi;
> I have the following:
>
> create table pics (
> p
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
fi
12 matches
Mail list logo