0

I want to design a database for a listing website, this is the first time I design the database, so I am not sure if I in the correct path. Here is the fields that needed in a listing,

  1. title - Character
  2. pub_date -Timestamp
  3. modi_date -Timestamp
  4. ex_date - Timestamp
  5. desc - Character
  6. thumb - Character
  7. office_no - Integer
  8. mobile_no - Integer
  9. email - Character
  10. web - Character
  11. status - Character
  12. state - Character
  13. city - Character
  14. address - Character
  15. postcode - Character
  16. lat - float
  17. lng - float

The lat (latitude) and lng (longitude) are used for searching, eg, searching nearby listing by comparing the lat and lng. So these fields will be queried often.

My question is should I separate the lat and lng into another table (normalization) since these fields will be query a lot. Or I just leave it in one table.

1
  • Using relational databases, since postgresql is in my consideration.
    – dev-jim
    Sep 16, 2015 at 18:43

1 Answer 1

0

Separating fields "because of performance" is not normalization. Usually having good indexes is the key.

Normalization will help you get rid of redundancy and insert/update/delete anomalies. lat and lng columns in your table do not seems to suffer from these so moving them to a separate table is not "normalization".

On the other hand, it is still a valid move and may be even beneficial in some use cases - imagine you have a table of cars with GPS locators and keep their actual position in those columns. Moving them to a separate table would allow you to make more updates per second to those columns without affecting the remaining data. But for SELECTs you need proper indexing. – https://dba.stackexchange.com/users/64556

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.