Reputation: 311
I'm working on a project and I have some problem with optimization in MySQL. My main table looks like and have around 1M rows:
+----+------+---------+
| id | Name | city_id | City_id is between (0, 2000).
+----+------+---------+
I'll make many queries like:
It is only to show you main operations on this database
If i'll make 2k small tables will it be good solution?
Upvotes: 0
Views: 44
Reputation: 1269443
I think the solution you are looking for is an index. Try this:
create index idx_table_city_id on table(city_id, id);
SQL is designed to handle large tables. There are very few reasons why you would want to split up data from one table to multiple tables. The only good reason I can think of are when doing so is needed to meet security requirements.
Upvotes: 3