0

I have a database that has many tables. In this database, there are a subset of tables that store information for similar (but distinct) rows of data, and one table that contains common search attributes that can be applied to each table.

There are 18 columns of searchable variables, and I'm not sure which is the best way to set up the indexes. Do I create a single Index for all the pertinent columns, or one Index for each one?

4

1 回答 1

0

因为你不能使用 SOLR 或类似的。
您需要使用 MySQL 来模拟这一点。
为此,您创建一个表,您将所有其他表反规范化到其中。请注意,此表不会替换其他表。把它当作一个视图。
举个简单的例子。我有一个产品,该产品可以有多种颜色代码。
规范化要求我有 3 个表。一张用于产品,一张用于颜色(名称|代码),一张用于链接它们的表格。

将其非规范化为一张表:产品代码(pk)|名称| 颜色代码 1|颜色名称 1| 颜色代码 2 | 颜色名称 2 ..... 不,我相信您很容易决定索引什么(实际上基于您在该表上执行的查询)。

显然它不是最佳的,但是,你需要玩你拥有的玩具。

其他需要考虑的非常相似的东西是使用星型模式

于 2012-12-14T14:04:29.210 回答