Drupal 数据库结构 - 高效/低效?
我当然不是 Drupal 专家,但我之前设计并构建了一些数据库,所以我对 3rd 方团队正在研究的数据库结构感到困惑,我让 Sequel Pro 添加了一些虚拟内容.如果使用 Drupal 的后端 GUI,我认为结构不会很明显,但我没有凭据,只有 ftp 和 ssh 访问权限.
I'm certainly no Drupal expert, but I've schemed and built a few databases before, so am puzzled by the structure of a database a 3rd party team is working on that I had Sequel Pro'd into to add some dummy content. I presume the structure wouldn't be apparent if one were to use Drupal's back end GUI, but I don't have creds, just ftp, and ssh access.
看到没有我所期望的单个表格,例如一个组织,其中包含 ID、姓名、地址、电子邮件、邮政编码等列,我有点害怕
I was a bit horrified to see not the single table I would have expected for, say, an Organization, with columns for ID, Name, Address, Email, Zip Code, etc. etc.
相反,每一位数据都有一个表格.也就是说,一个单独的表格用于姓名、地址、电子邮件、邮政编码等.
Instead, there is a table for each bit of data. That is, a separate table for Name, for Address, for Email, for Zip Code, etc. etc.
从逻辑的角度来看,这似乎非常低效.例如,当组织页面加载时,为该组织加载的每一位数据都从不同的表中调用并聚合,而不是通过调用单个表的方式,所有数据从一行中提取.
That seems, from a logical standpoint, amazingly inefficient. E.g., when an Organization page loads, each bit of data that loads for that org is called from a different table and aggregated, rather than by way of a call to a single table, and all data pulled from one row.
我是不是一无所知(是的,但是...)还是这是 Drupal 独有的一些数据库结构特性?
Am I clueless (yes but...) or is this some db structure peculiarity unique to Drupal?
推荐答案
是的.Drupal 将字段内容存储在单独的表中,以便它具有最大的灵活性(例如,如果您以后想在除组织"之外的其他内容类型上重用这些字段),它已经在一个多连接表中.权衡是性能,Drupal 通过缓存等方式弥补了这一点(例如,当加载该组织节点时,它会缓存它,以便如果在该页面请求中再次加载它,则不需要再次从这些表中读取,例如例子).由于它是一个功能强大的 CMS,可让您构建、重新构建和重新组织存储内容和字段的方式,因此它可以更灵活地存储数据.
Yes. Drupal stores field content in individual tables so that it will be maximally flexible (for example, if you wanted to re-use those fields on other content types besides "organization" later), it is already in a multi-join table. The tradeoff is performance, which Drupal makes up for with caching and such (for example when that Organization node is loaded, it caches it so that if it's loaded again in that page request it doesn't need to read from those tables again, for example). Since it's a powerful CMS that lets you build and re-build and reorganize how you store your content and fields, it stores the data more flexibly.
相关文章