Search Postgresql Archives

Re: primary keys

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Grant Maxwell <grant.maxwell@xxxxxxxxxxxx> writes:
> I don't know why it was done this way but it seems to me that the  
> email addresses are unique, non null and could be used as the primary  
> key. This would make the replication much faster and simpler.

> Does anyone out there think the change (number to email address as  
> primary key) would be a bad idea ?

One thing that's often considered a useful attribute of a primary key is
that it be immutable.  In your application, do users ever change their
email addresses?  If so, what should happen --- is it okay to treat that
as effectively a new entry?

Also, if you have any other tables referencing this one via foreign
keys, you'd have to have them storing the email address instead of
the serial number; it'll be bulkier and address updates will be that
much more expensive.

You can find lots and lots and lots of discussion of this topic if
you search the archives for talk about natural versus surrogate keys.

			regards, tom lane

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux