LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices



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

Rep: Reputation: 75
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:
Quote:
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
http://www.tomjewett.com/dbdesign/db...?page=keys.php

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,
Angel.
 
Old 07-27-2011, 09:58 AM   #2
angel115
Member
 
Registered: Jul 2005
Location: France / Ireland
Distribution: Debian mainly, and Ubuntu
Posts: 494

Original Poster
Rep: Reputation: 75
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...

Angel.
 
  


Reply


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


All times are GMT -5. The time now is 10:30 AM.

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