[email]roch77[/email] wrote:One problem with limiting the primary key to 15 characters is you might> I have a users table, the typical firstname, lastname, phone, email
> Will have about 10,000 users.
> Mostly all selects as opposed to updates, inserts
> I was thinking of having the primary key as the email address field
> which I have set at varchar(70) and limiting the index to the first 15
> characters. Is this going to be too slow compared to an index using an
> autoincremented integer?
> I prefer the email address, since it has meaning and searches would be
> straight forward.
> Any suggestions?
> My platform is : MySQL 5.0.22 /INNODB
have different emails - but they are rejected. For instance,
Not likely, I will admit - but with 10K users it will happen. And what
happens if someone doesn't have an email address (not likely, but
Remember - the reason for a primary key is to uniquely identify a row.
That way if you do something like:
SELECT rec_id, name, email FROM member_tbl WHERE state='confusion';
Then while you're going through the records you want to change
something, you can do
UPDATE member_tbl SET state='not confused' WHERE rec_id=$rec_id;
(assuming you saved the rec_id in variable $rec_id, of course).
This would be much faster than doing the same in email.
I use the member id for the primary key in my association work. Of
course, you can still add an index to the email if you are doing
requests which match or sort on the field.
Remove the "x" from my email address
JDS Computer Training Corp.