-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Fri, 16 Nov 2007 20:00:29 +0000 Sam Mason <sam@xxxxxxxxxxxxx> wrote: > > > Normally a primary key would just be a single column. When you > > > start going to that many I'd probably have a serial column as the > > > primary key, and a UNIQUE index on those six fields. Depends on > > > what you're doing, though unless you've got a few years > > > experience I'd be tempted to stay away from primary keys of more > > > than a single column. > > > > Fie on you evil synthetic key lovers. Long live the Natural Key! > > Really? I started off with everything using sequences and everything > was good. Then I found I wanted to do more complicated things so I > started to transition to natural keys and things were better. Then > I took things too far and wanted something artificial back in my When that is needed I do this: create table foo(id serial unique, a text, b text, primary (a,b)); Joshua D. Drake > life. I'm back to almost never using natural keys now, mainly because > interfacing with the outside world gets too complicated. When I'm > just doing stuff inside the database then I can use natural keys and > all is good, otherwise things just get too complicated. > > I'll probably look back in another few years and remember how young > and naive I was back now. > > > Sam > > ---------------------------(end of > broadcast)--------------------------- TIP 6: explain analyze is your > friend > - -- === The PostgreSQL Company: Command Prompt, Inc. === Sales/Support: +1.503.667.4564 24x7/Emergency: +1.800.492.2240 PostgreSQL solutions since 1997 http://www.commandprompt.com/ UNIQUE NOT NULL Donate to the PostgreSQL Project: http://www.postgresql.org/about/donate PostgreSQL Replication: http://www.commandprompt.com/products/ -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFHPfhWATb/zqfZUUQRArjCAJ90cXYwuw/A/yojQanj1gv+RJqJnQCdFvPv 6nGph8K57KcKtk1rTgfFSFg= =fQ5l -----END PGP SIGNATURE----- ---------------------------(end of broadcast)---------------------------TIP 1: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to majordomo@xxxxxxxxxxxxxx so that your message can get through to the mailing list cleanly