If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > General > Database Concepts & Design > one question of database.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-09-09, 05:01
cs221313 cs221313 is offline
Registered User
 
Join Date: Mar 2009
Posts: 4
one question of database.

Someone ask me a question. Let's say we have following tables: tb_person(person_id, name, age, sex, location), tb_city(city_id, population, ..., name). tb_person.person_id points to tb_city.city_id. There are so many records in both tables. He seperate the tb_person into like: tb_person_in_shanghai, tb_person_in_Beijing, etc. He deleted location field to let the records to be less to improve the performance when query. I think that looks ugly. Do you think it's a right way or you have any other good idea?
Reply With Quote
  #2 (permalink)  
Old 03-09-09, 05:20
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
you may tell him that's a terrible design
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #3 (permalink)  
Old 03-09-09, 23:11
cs221313 cs221313 is offline
Registered User
 
Join Date: Mar 2009
Posts: 4
what is the right way?

what is the right way to implement that?

Thanks
Reply With Quote
  #4 (permalink)  
Old 03-09-09, 23:20
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
only two tables in total -- one for people, one for cities
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #5 (permalink)  
Old 03-09-09, 23:30
cs221313 cs221313 is offline
Registered User
 
Join Date: Mar 2009
Posts: 4
how to increase the performance?

how to increase the performance with the much larger data?
Reply With Quote
  #6 (permalink)  
Old 03-09-09, 23:33
cs221313 cs221313 is offline
Registered User
 
Join Date: Mar 2009
Posts: 4
Add an index on it?

Can we add an index on table?
Reply With Quote
  #7 (permalink)  
Old 03-09-09, 23:40
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
absolutely yes, you need indexes
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On