I am new to database but have been researching techniques, but not quite clear on the best plan for my DB?
I have a ‘index_table’ with the following columns (with about 65,000 rows)
dbo.index_table
Line
Locality
Route (unique)
I then plan about 65,000 tables with the following columns: (each with about 20-40 rows)
dbo.table2,3.4....etc
Route
Place
Name
Stop
My C# web service with find a match between line and locality in the index_table and the result will be the Route.
I then need to return all matching rows in the other tables.
Basically each table (apart from the index_table) contains stops on a transit route, so I am finding the stops from the Route identifier.
Is this the correct way to design or should I be doing it a different way to ease and performance reasons.
I am a beginner, please be gentle 🙂
I see absolutely no need for 65,000 tables. You should read up on database normalization to understand the principles around having an efficient and organized schema. You would be making your life much harder to try to implement and manage 65,000 tables. A single table that has (65000 * 20-40) 1300000-2600000 rows could be very efficiently managed.
On your
index_table, when you meanroute, do you mean a single value? Or will thisroutehave more than one value in it?My thought on the design would be:
route (route, line, locality)
route_stop (route, place, name, stop)
route_stop.routewould be a foreign key toroute.routeroute_stopcould be a composite of the columns that make a unique value