可以在mysql中创建的数据库的最大限制? [英] max limit of databases that can be created in mysql?

查看:415
本文介绍了可以在mysql中创建的数据库的最大限制?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以在Mysql中创建多达500000000个数据库吗?

如果是,那么效率高吗?

在这里,每个数据库都保存有6个表的用户数据,其中包含用户信息.

请向我解释这种想法在性能和实现方面的利弊.

解决方案

请不要!

无论您在想什么,无论出于什么原因.绝对不可能创建那么多数据库是一个好主意.

如果您要存储每个用户或每个X的数据.那么请再次查看关系数据库是什么:关系数据库通过使用数据集中发现的通用特征来匹配数据."

比方说,您正在创建图像服务,并希望每个用户都有自己的图像.一种方法是为每个用户提供自己的数据库.这是错误的,因为每个用户的数据包含相同的特征,所以唯一不同的是关系(用户A有图片A,用户B有图片B),(1个用户有0 ... *图片,以及1张图片属于1位用户).因此,您无需创建大量数据库,而是可以创建用户表,并将其与图片表相关联,从而有效地使用了数据库.

回答您更直接的问题.创建具有50.000个条目的表肯定比创建50.000个数据库更有效.

在mysql.com上编辑相关答案: http:///forums.mysql.com/read.php?20,74692,74705#msg-74705

can i create as many as 500000000 databases in Mysql??

If yes, is it efficient??

here, each database holds user data with 6 tables in it containing user info in it..

please explain me the pros and cons of this idea with respect to performance and implementation..

解决方案

Please Don't!

Whatever you're thinking, whatever the reason. There is absolutely no way that creating that many databases is a good idea.

If you're looking for storing data per user, or for every X. Then please take a look again at what a relational database is "A relational database matches data by using common characteristics found within the data set."

Let's say you're createing an image service and want each user to have their own images. One way is to give each user their own database. This is wrong, because the data for each user contains the same characteristics, the only thing that is different is the relation (user A has picture A, user B has picture B), (1 user has 0...* pictures, and 1 picture belongs to 1 user). So instead of creating that many databases, you create a user table, and relate that to a picture table, this way you've efficiently used a database.

To answer your more direct question. Create a table with 50.000 entries is surely more efficient then creating 50.000 databases.

Edit a related answer on mysql.com: http://forums.mysql.com/read.php?20,74692,74705#msg-74705

这篇关于可以在mysql中创建的数据库的最大限制?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆