Results 1 to 7 of 7
  1. #1
    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?

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    you may tell him that's a terrible design
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Mar 2009
    Posts
    4

    what is the right way?

    what is the right way to implement that?

    Thanks

  4. #4
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    only two tables in total -- one for people, one for cities
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  5. #5
    Join Date
    Mar 2009
    Posts
    4

    how to increase the performance?

    how to increase the performance with the much larger data?

  6. #6
    Join Date
    Mar 2009
    Posts
    4

    Add an index on it?

    Can we add an index on table?

  7. #7
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    absolutely yes, you need indexes
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •