user3203425
user3203425

Reputation: 3059

Is mysql designed to create and drop databases frequently?

I have a turn-based multiplayer games. Each time a user hosts a new game, I want to create a new mysql database dedicated to the game. The database will consist of 8 tables. When the game is finished, I will delete the database. Examples of the tables are like:

tableMonsterEntities;
tablePlayerCommands;
etc..

I am expecting to have 1,500 live games at any time. So there would be 1,500 databases. Is mysql designed to be used in this way? Is there a limit on the number of databases? Is there going to be a problem with the way mysql allocates memory when you have so many database instances?

Thanks

Upvotes: 0

Views: 59

Answers (1)

Rick James
Rick James

Reputation: 142278

1500 databases == 1500 directories in the file system.

If there are 20 tables in each database, then that is 30000 tables.

No, MySQL is not designed for rapid create/drop of tables or databases.

Design your schema with a fixed number of tables, probably in a single database; include a game number in most tables, and include that in the composite indexes you use.

Upvotes: 1

Related Questions