Review your favorite Linux distribution.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 07-27-2011, 09:40 AM   #1
Registered: Jul 2005
Location: France / Ireland
Distribution: Debian mainly, and Ubuntu
Posts: 536

Rep: Reputation: 79
Question Database design using IDs as opposed as Candidate keys as Primary key (UML design)

Hello There,

Self learner developer since about 2 years, I'm trying to understand deeper how to design a database in the best and most efficient way possible.

Reading about UML design, I've found this:
Do not automatically add “ID numbers” (surrogate keys) or substitute keys to a table until you are sure that:

• There is at least one candidate key (before the surrogate is added),

• the table is a parent in at least one association, and

• there is no candidate key small enough for its values to be copied many times into the child table.
in the section PK size might matter

Until then, I've always did this (I mean using ID) to identify my rows.

So my questions are:
1. Why should we avoid using ID to identify rows?

2. Candidate keys add some weight to our database, and this can huge if we have millions of records, so why should we use these over surrogate keys?

Thank you for your light and advices,
Best regards,
Old 07-27-2011, 09:58 AM   #2
Registered: Jul 2005
Location: France / Ireland
Distribution: Debian mainly, and Ubuntu
Posts: 536

Original Poster
Rep: Reputation: 79
Sorry I miss understood,

What they mean is not to use them, but not always use them as they may not be the best solution...



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Linux for Graphic Design, web design, and publishing maelstrom209 Linux - Software 8 07-17-2011 12:35 PM
database design help mattca Programming 13 12-09-2010 04:20 PM
How to better design a database Jzarecta Linux - General 1 02-10-2007 02:48 AM
Database design Wim Sturkenboom Programming 4 08-30-2006 02:45 AM
LXer: Better database design with foreign keys and referential integrity ... LXer Syndicated Linux News 0 07-19-2006 10:21 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:25 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration