dbTalk Databases Forums  

Use IDs or strings?

comp.databases comp.databases


Discuss Use IDs or strings? in the comp.databases forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Victor Porton
 
Posts: n/a

Default Use IDs or strings? - 10-26-2008 , 03:58 PM






I design a DB which contains districts of cities.

The question: Is it reasonable to store IDs of districts instead of
district names, provided that we have hard-coded map from district IDs
to district names? Conditions: 1. Disk space is not an issue. 2.
Search on districts is not going to be implemented.

I'm sure that disk space and ability to quickly search districts
mandate to use IDs in place of strings. But that's is not an issue.

So, should I?

Reply With Quote
  #2  
Old   
Jasen Betts
 
Posts: n/a

Default Re: Use IDs or strings? - 10-26-2008 , 08:44 PM






On 2008-10-26, Victor Porton <porton (AT) narod (DOT) ru> wrote:
Quote:
I design a DB which contains districts of cities.

The question: Is it reasonable to store IDs of districts instead of
district names, provided that we have hard-coded map from district IDs
to district names? Conditions: 1. Disk space is not an issue. 2.
Search on districts is not going to be implemented.

I'm sure that disk space and ability to quickly search districts
mandate to use IDs in place of strings. But that's is not an issue.
if it's not going to be a foreign key for some other reason there's no
need make it one.

Bye.
Jasen


Reply With Quote
  #3  
Old   
Jasen Betts
 
Posts: n/a

Default Re: Use IDs or strings? - 10-26-2008 , 08:44 PM



On 2008-10-26, Victor Porton <porton (AT) narod (DOT) ru> wrote:
Quote:
I design a DB which contains districts of cities.

The question: Is it reasonable to store IDs of districts instead of
district names, provided that we have hard-coded map from district IDs
to district names? Conditions: 1. Disk space is not an issue. 2.
Search on districts is not going to be implemented.

I'm sure that disk space and ability to quickly search districts
mandate to use IDs in place of strings. But that's is not an issue.
if it's not going to be a foreign key for some other reason there's no
need make it one.

Bye.
Jasen


Reply With Quote
  #4  
Old   
Jasen Betts
 
Posts: n/a

Default Re: Use IDs or strings? - 10-26-2008 , 08:44 PM



On 2008-10-26, Victor Porton <porton (AT) narod (DOT) ru> wrote:
Quote:
I design a DB which contains districts of cities.

The question: Is it reasonable to store IDs of districts instead of
district names, provided that we have hard-coded map from district IDs
to district names? Conditions: 1. Disk space is not an issue. 2.
Search on districts is not going to be implemented.

I'm sure that disk space and ability to quickly search districts
mandate to use IDs in place of strings. But that's is not an issue.
if it's not going to be a foreign key for some other reason there's no
need make it one.

Bye.
Jasen


Reply With Quote
  #5  
Old   
Ed Prochak
 
Posts: n/a

Default Re: Use IDs or strings? - 10-28-2008 , 06:46 AM



On Oct 26, 4:58*pm, Victor Porton <por... (AT) narod (DOT) ru> wrote:
Quote:
I design a DB which contains districts of cities.

The question: Is it reasonable to store IDs of districts instead of
district names, provided that we have hard-coded map from district IDs
to district names? Conditions: 1. Disk space is not an issue. 2.
Search on districts is not going to be implemented.

I'm sure that disk space and ability to quickly search districts
mandate to use IDs in place of strings. But that's is not an issue.

So, should I?
I usually stick to the natural keys when possible. Now some questions
are:

Are these IDs natural? (e.g. plot map lot numbers)
Are these IDs known to users?
If the answer to either of these is yes, then use the IDs.

Are you merely "normalizing" the verbiage out to reduce space? What
does you data model look like? Are you planning on leaving the
district names totally out of the database?

Your search comment is totally wrong for many DBMS products. Numeric
ID keys are NOT significantly faster than text keys. And with the
prices and capacities of disc drives nowadays, trying to squeeze disc
space is a poor planning approach. Before thinking about space or
speed, get the system functioning first.

Ed



Reply With Quote
  #6  
Old   
Ed Prochak
 
Posts: n/a

Default Re: Use IDs or strings? - 10-28-2008 , 06:46 AM



On Oct 26, 4:58*pm, Victor Porton <por... (AT) narod (DOT) ru> wrote:
Quote:
I design a DB which contains districts of cities.

The question: Is it reasonable to store IDs of districts instead of
district names, provided that we have hard-coded map from district IDs
to district names? Conditions: 1. Disk space is not an issue. 2.
Search on districts is not going to be implemented.

I'm sure that disk space and ability to quickly search districts
mandate to use IDs in place of strings. But that's is not an issue.

So, should I?
I usually stick to the natural keys when possible. Now some questions
are:

Are these IDs natural? (e.g. plot map lot numbers)
Are these IDs known to users?
If the answer to either of these is yes, then use the IDs.

Are you merely "normalizing" the verbiage out to reduce space? What
does you data model look like? Are you planning on leaving the
district names totally out of the database?

Your search comment is totally wrong for many DBMS products. Numeric
ID keys are NOT significantly faster than text keys. And with the
prices and capacities of disc drives nowadays, trying to squeeze disc
space is a poor planning approach. Before thinking about space or
speed, get the system functioning first.

Ed



Reply With Quote
  #7  
Old   
Ed Prochak
 
Posts: n/a

Default Re: Use IDs or strings? - 10-28-2008 , 06:46 AM



On Oct 26, 4:58*pm, Victor Porton <por... (AT) narod (DOT) ru> wrote:
Quote:
I design a DB which contains districts of cities.

The question: Is it reasonable to store IDs of districts instead of
district names, provided that we have hard-coded map from district IDs
to district names? Conditions: 1. Disk space is not an issue. 2.
Search on districts is not going to be implemented.

I'm sure that disk space and ability to quickly search districts
mandate to use IDs in place of strings. But that's is not an issue.

So, should I?
I usually stick to the natural keys when possible. Now some questions
are:

Are these IDs natural? (e.g. plot map lot numbers)
Are these IDs known to users?
If the answer to either of these is yes, then use the IDs.

Are you merely "normalizing" the verbiage out to reduce space? What
does you data model look like? Are you planning on leaving the
district names totally out of the database?

Your search comment is totally wrong for many DBMS products. Numeric
ID keys are NOT significantly faster than text keys. And with the
prices and capacities of disc drives nowadays, trying to squeeze disc
space is a poor planning approach. Before thinking about space or
speed, get the system functioning first.

Ed



Reply With Quote
  #8  
Old   
Marco Mariani
 
Posts: n/a

Default Re: Use IDs or strings? - 10-28-2008 , 08:15 AM



Ed Prochak wrote:

Quote:
Your search comment is totally wrong for many DBMS products. Numeric
ID keys are NOT significantly faster than text keys. And with the
prices and capacities of disc drives nowadays, trying to squeeze disc
space is a poor planning approach.
Another approach when in doubt of using surrogate keys, would be to ask
oneself: "how many million districts will there ever be? how many times
per day will a district change its name?"



Reply With Quote
  #9  
Old   
Marco Mariani
 
Posts: n/a

Default Re: Use IDs or strings? - 10-28-2008 , 08:15 AM



Ed Prochak wrote:

Quote:
Your search comment is totally wrong for many DBMS products. Numeric
ID keys are NOT significantly faster than text keys. And with the
prices and capacities of disc drives nowadays, trying to squeeze disc
space is a poor planning approach.
Another approach when in doubt of using surrogate keys, would be to ask
oneself: "how many million districts will there ever be? how many times
per day will a district change its name?"



Reply With Quote
  #10  
Old   
Marco Mariani
 
Posts: n/a

Default Re: Use IDs or strings? - 10-28-2008 , 08:15 AM



Ed Prochak wrote:

Quote:
Your search comment is totally wrong for many DBMS products. Numeric
ID keys are NOT significantly faster than text keys. And with the
prices and capacities of disc drives nowadays, trying to squeeze disc
space is a poor planning approach.
Another approach when in doubt of using surrogate keys, would be to ask
oneself: "how many million districts will there ever be? how many times
per day will a district change its name?"



Reply With Quote
Reply




Thread Tools
Display Modes

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

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



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.