了解数据库模式
我使用 MySQL Workbench 对 phpbb 的数据库进行了逆向工程,以查看架构是什么样的。
嗯,它提出了大约 20 个表,这些表通过各种关系相互关联(不用担心)。还有另外50张左右的桌子,虽然没有任何关系,但独立坐着。
我关心的不是这是否真实地代表了 phpbb 使用的数据库。它确实提出了一些我无法找到答案的问题(可能是由于搜索了错误的术语)
数据库真的存在并且像这样工作吗? 如果是的话,他们叫什么?
编辑:对于每个关注 phpbb DB 的人来说,我不明白为什么你会这样,因为我说过这不是一个问题。我之所以提到它,是因为这就是我提出这些问题时所看到的。
用不同的词来尝试我的问题...
如果数据库有任意数量(例如 1/3)的表,这些表通过关系相互关联,然后其余 2/3 的表是独立的(即没有与其他表的关系)有这个名称吗?
谢谢
Using MySQL Workbench I reverse engineered phpbb's database to see what the schema would look like.
Well it came up with about 20 tables that were associated with each other through various relationships (no concern there). There are another 50 or so tables sitting independently though without any relationships.
My concern is not that this is a true representation of the database phpbb uses or not. It did bring up some questions that I couldn't find the answers for though (probably due to searching for the wrong terms)
Do databases actually exist and work like this?
If so what are they called?
EDIT: For everyone concentrating on the phpbb DB I don't understand why you are since I said that is not a concern. I only referred to it because that is what I was looking at when I came up with these questions.
To try my questions in different words...
If a DB is to have an arbitrary number (say 1/3) of tables that are associated to one another through relationships and then the remaining 2/3's of the tables are independent (i.e. no relationship to other tables) is there a name for this?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
创建一个没有任何链接表的数据库/系统是非常容易的......我会这样做吗?没有,但我见过很多。
我怀疑这些表中至少有 2/3 实际上与其他表相关(在最松散的意义上),但这种关系是通过代码完成的,而不是通过数据库强制执行的。
It is perfectly easy to create a database/system without any linked tables...would I do it that way? No, but I have seen plenty.
I suspect that at least some of those 2/3 of those tables are in fact related (in the loose-est sense) to other tables, but that relationship is done through the code, not enforced through the database.
拥有不与其他表链接的表可能是合理的,但我不确定 PHPBB 数据库中的情况是否如此。
检查下面的链接以尝试记录 PHPBB 数据库结构。它包括大约 20 个表,听起来就像您看到的链接表。您能否提供您正在查看的未链接表的名称?
http://www.phpbbdoctor.com/doc_tables.php
表列表:
编辑 - 在回答您的问题编辑时,没有 1/3 的具体名称链接表,2/3 未链接。对于未链接的表,我能立即想到的主要场景是让审计表跟踪特定表中随时间推移发生的更改。不过,审核“未链接”表的数量会少于链接表的数量。
我们关注 PHPBB 的原因是您所展示的示例 - 它可能是您正在查看的 PHPBB 特定安装的一个怪癖,这当然不是一个正常的事情。
您可以将您的工具与另一个数据库一起使用并查看结果吗?
另外,就您运行工具的数据库而言 - 这是您的组织执行的自定义安装吗?我怀疑您可以看到的这些未链接的表是通过自定义修改添加到基本 PHPBB 安装中的,或者是可能不相关的表,因为它方便且可用而已添加到数据库中(例如博客表)。最好的办法是询问支持数据库安装的人员。就您更广泛的问题而言 - 如上所述,它不是一个特别正常的模式,但可能是插件的混合和其他事物对数据库的(错误)使用可以解释它。
Having tables that aren't linked to others can be reasonable, but I'm not sure that's the case in the PHPBB database.
Check the link below for an attempt at documenting the PHPBB database structure. It includes about 20 tables, which sounds like the linked tables you saw. Can you provide the names of the unlinked tables you're looking at?
http://www.phpbbdoctor.com/doc_tables.php
Table list:
EDIT - In answer to your question edit, there isn't a specific name for having 1/3 linked tables, and 2/3 unlinked. The main scenario I can think of off the top of my head for unlinked tables is having audit tables tracking the changes that occur over time in particular tables. There would be less audit 'unlinked' tables than linked though.
The reason we're focussing on PHPBB is that's the example you've shown - it may be a quirk of the particular installation of PHPBB that you're looking at, this certainly isn't a normal thing to find.
Can you use your tool with another database and see what results from that?
Also in terms of the database you have run your tool against - is that a custom installation that your organisation has performed? My suspicion is that these unlinked tables that you can see have been added by custom modifications to the base PHPBB install, or are potentially unrelated tables that have been added to the database because it was convenient and available (e.g. the blog table). Your best bet is to ask the person who supports that installation of the database. In terms of your wider question - as mentioned above, its not a particularly normal pattern, but possibly a mix of addons and (mis)use of the database by other things would explain it.