数据库表设计索引外键设计_关于索引的设计决策 数据库管理系统

数据库表设计索引外键设计

Introduction:

介绍:

The attributes whose values are required inequality or range conditions and those that are keys or that participate in join conditions require access paths.

其值为必需的不等式或范围条件的属性以及作为键或参与联接条件的属性需要访问路径。

The performance of queries largely depends upon what indexes or hashing schemas exist to expedite the processing of selections and joins. On the other hand, when we do insertion, deletion, or updating operations, the existence of indexes adds to the overhead. This overhead need to be justified in terms of the increase in efficiency by expediting queries and also the transactions.

查询的性能很大程度上取决于存在哪些索引或哈希模式以加快选择和联接的处理。 另一方面,当我们执行插入,删除或更新操作时,索引的存在会增加开销。 需要通过加快查询以及事务的效率来证明这种开销。

The physical design decision for indexing falls into the following categories:

索引物理设计决策可以归为以下几类

1)是否也索引属性 (1) Whether too index an attribute)

The attribute must be a key or there must be some query that uses that attribute either in a selection condition or in a join. One factor.

该属性必须是键,或者必须存在一些在选择条件或联接中使用该属性的查询。 一个因素。

In favor of setting up many indexes is that some queries can be processed by just scanning the indexes without retrieving any data.

设置许多索引的好处是可以通过仅扫描索引而无需检索任何数据来处理某些查询。

2)要索引哪些属性或属性 (2) What attributes or attributes to index on)

An index can be constructed one or multiple attributes. If there are multiple attributes from one relation that are involved together in several queries,

索引可以构造一个或多个属性。 如果一个查询中有多个属性同时包含在多个查询中,

A multiattribute index is warranted. The ordering of attributes within a multiattribute index must correspond to the queries. For example, the above index assumes that queries would be based on an ordering of colors within a GARMENT_style_ #rather than vice-versa.

多属性索引是必要的。 多属性索引中的属性顺序必须与查询相对应。 例如,以上索引假设查询将基于GARMENT_style_#内的颜色顺序,而不是相反。

3)是否建立聚簇索引 (3) Whether to set up a clustered index)

At most, one index per table can be primary or clustering index because this implies that the file is physically ordered on that attribute. In most RDBMS this is specified by the keyword CLUSTER.

每个表最多只能有一个索引是主索引或聚簇索引,因为这意味着该文件在该属性上是物理排序的。 在大多数RDBMS中,这由关键字CLUSTER指定。

If a table requires several indexes, the decision about which one should be a clustered index depends upon whether keeping the table ordered on that attribute is needed. Range queries benefit a great deal from clustering. If several attributes require the range queries, relative benefits must be evaluated before deciding which attribute to cluster on. A clustering index may be set up as a multi-attribute index if range retrieval by that composite key is useful in report creation.

如果一个表需要多个索引,则关于哪个索引应为聚集索引的决定取决于是否需要将该表保持在该属性上。 范围查询从群集中受益匪浅。 如果几个属性需要范围查询,则必须在确定要聚类的哪个属性之前评估相对利益。 如果该复合键的范围检索在报表创建中很有用,则可以将聚类索引设置为多属性索引。

4)是否在树索引上使用哈希索引 (4) Whether to use a hash index over a tree index )

In general, RDBMS use B+ trees for indexing. However, ISAM and hash indexes are also provided in some systems.B+ trees support equality and range queries on the attribute used as the search key. Hash indexes work very well with equality conditions, to find a matching record during joins.

通常,RDBMS使用B +树进行索引。 但是,某些系统中还提供了ISAM和哈希索引.B +树支持对用作搜索关键字的属性进行相等性和范围查询。 哈希索引在相等条件下可以很好地工作,可以在联接期间找到匹配的记录。

5)是否对文件使用动态哈希 (5) Whether to use dynamic hashing for the file)

For files that are very volatile, that is those that grow and shrink continuously one of the dynamic hashing schemas would be suitable. Currently, they are not offered by commercial RDBMSs.

对于非常易失的文件,即那些不断增长和缩小的文件,动态哈希方案之一将是合适的。 当前,商业RDBMS不提供它们。

翻译自: https://www.includehelp.com/dbms/design-decision-about-indexing.aspx

数据库表设计索引外键设计

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值