Reputation: 83
I am building a database for an Android app using SQLite. The database consists of Zip code long/lat information. At runtime, a row will be added to a table in the database. I am trying to find the best way to design the database for both scalability and speed. This app will be released for all US states.
My question is this: Would it be better to create a table for each US zip code, which stores this new information (and query the DB at runtime)
Or, would it be better to create 1 table in which all new data is added (and query the DB at runtime)?
-I might have answered my own question here, but the data added will only be kept in the database for approx. 1 week (most likely only a few days).
Any advice would be great!
Upvotes: 0
Views: 101
Reputation: 5940
One table that contains all zip codes is better. Otherwise you would have a maintenance nightmare on your hands and the code itself would be more complex. SQL queries are designed to be very fast as long as you have proper indexing.
Upvotes: 1