| |||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | #1 (permalink) |
| Straight from Sweden | Trying to prove him wrong, ( my database teacher ) He claims that using words as a unque key in databases is more of general standard. But how does that affect speed if the database is pretty big. My self prefer counters as id 1 2 3 4 5 6 etc its easy much easier than using words. Has anyone done any research on this? Best Regards Jawn
__________________ Second place in seoworldchampionship 2007. |
| |
| | #3 (permalink) | |
| Straight from Sweden | Quote:
Imagine you have a database with 1 million lines, one with words as primary key and one with a plain counter 12345 etc If you want to select one row using the word primary key database, the database "server" will have no idea where to look and it will go through whole database until it finds the correct row. But using the counter one it will know exactly where to look? But i might be wrong hehe It would be intresting if someone who has actually done a test on this to post a input ![]() Best Regards Jawn
__________________ Second place in seoworldchampionship 2007. | |
| |
| | #5 (permalink) |
| NamePros Regular | the main diference is on size, the speed is same basically
__________________ Joćo Fernandes Silva Selling : 19P.ORG - ARCADEHITS.ORG - AZIAN.NET - COREFANS.COM - CTUTORIALS.NET - DEDISEEK.COM - HITCHECK.COM - HOST15.COM - HOSTCUSTOMER.COM - LARGETIPS.COM - SCRIPTCANDY.COM - VISUALBOOK.NET - VOXVPS.COM / .NET - WALLPAPERSARENA.COM |
| |
| | #7 (permalink) |
| Barru. | I'd have thought that using integers would be more of a standard - im doing databases in school now (teacher dosn't have a clue, we are using an ancient textbook for another version of the software) and we have about 3 tables in this database, all with numeric keys.
__________________ |
| |
| | #8 (permalink) |
| Senior Member | Are we talking about column headings for tables here? If so, all that would effect is the speed of the query manipulating the database. You would be talking about the difference of a few dozen bytes worth of data, which depending on the word size of your processor would be a matter of milliseconds. |
| |
| | #9 (permalink) | |
| Barru. | Quote:
Code: primary_key | field1 | field2 | field3 | field4 | etc
------------|--------|--------|--------|--------|------
0 | value | value | value | value | value
1 | value | value | value | value | value
2 | value | value | value | value | value
__________________ | |
| |
| | #10 (permalink) |
| NamePros Regular | Personally i always use integers as my primary keys simply because it makes the database smaller and makes it easier to cross-reference and use foreign keys. So if he says that most primary keys are text/words i wouldn't assume he is right.. im guessing im not the only one using integers as my primary keys... right..?
__________________ -Beaver6813.com V5 Soon! Last edited by beaver6813; 02-16-2007 at 01:18 PM. |
| |
| | #12 (permalink) | |
| Straight from Sweden | Quote:
The normalization standard says that your supposed to stay away from "counter/integer" way as long is its possible. If the primary key isnt strong enough you should pick several primary keys to make it a strong identity. This can be hard sometimes thats why people use counter/integer way, you dont have to worry about weak identities.
__________________ Second place in seoworldchampionship 2007. | |
| |
| | #15 (permalink) | |
| NamePros Regular | Quote:
__________________ -Beaver6813.com V5 Soon! | |
| |
| | #16 (permalink) | |
| NamePros Regular | Quote:
__________________ DarkNeoNetwork | |
| |
| | #18 (permalink) |
| Senior Member | The chances are he is referring to Access databases...MSSQL, and not MYSQL. Teachers generally know naff all when it comes to modern technology...My IT teacher thought that for several rows in a table that you had to do each row as a singular table (She didn't know <tr> tags existed).
__________________ I am no longer a NP moderator -- please do not PM me with moderation requests! ~ VPSSpeed.com - Unmanaged VPS Hosting from $9.95 Get a FREE Mach-1 VPS PLAN with any order - Use the coupon FREEWHIZ |
| |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| |