<bdo id='8DOme'></bdo><ul id='8DOme'></ul>

      1. <small id='8DOme'></small><noframes id='8DOme'>

        <i id='8DOme'><tr id='8DOme'><dt id='8DOme'><q id='8DOme'><span id='8DOme'><b id='8DOme'><form id='8DOme'><ins id='8DOme'></ins><ul id='8DOme'></ul><sub id='8DOme'></sub></form><legend id='8DOme'></legend><bdo id='8DOme'><pre id='8DOme'><center id='8DOme'></center></pre></bdo></b><th id='8DOme'></th></span></q></dt></tr></i><div id='8DOme'><tfoot id='8DOme'></tfoot><dl id='8DOme'><fieldset id='8DOme'></fieldset></dl></div>
        <tfoot id='8DOme'></tfoot>
        <legend id='8DOme'><style id='8DOme'><dir id='8DOme'><q id='8DOme'></q></dir></style></legend>

        多少数据库索引太多了?

        时间:2023-11-28
        • <bdo id='m3HI6'></bdo><ul id='m3HI6'></ul>
            • <i id='m3HI6'><tr id='m3HI6'><dt id='m3HI6'><q id='m3HI6'><span id='m3HI6'><b id='m3HI6'><form id='m3HI6'><ins id='m3HI6'></ins><ul id='m3HI6'></ul><sub id='m3HI6'></sub></form><legend id='m3HI6'></legend><bdo id='m3HI6'><pre id='m3HI6'><center id='m3HI6'></center></pre></bdo></b><th id='m3HI6'></th></span></q></dt></tr></i><div id='m3HI6'><tfoot id='m3HI6'></tfoot><dl id='m3HI6'><fieldset id='m3HI6'></fieldset></dl></div>

                <small id='m3HI6'></small><noframes id='m3HI6'>

                  <tbody id='m3HI6'></tbody>
                <legend id='m3HI6'><style id='m3HI6'><dir id='m3HI6'><q id='m3HI6'></q></dir></style></legend>

                  <tfoot id='m3HI6'></tfoot>

                  本文介绍了多少数据库索引太多了?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在处理一个具有相当大 Oracle 数据库的项目(尽管我的问题同样适用于其他数据库).我们有一个网络界面,允许用户搜索几乎所有可能的字段组合.

                  I'm working on a project with a rather large Oracle database (although my question applies equally well to other databases). We have a web interface which allows users to search on almost any possible combination of fields.

                  为了加快这些搜索的速度,我们为我们认为用户通常会搜索的字段和字段组合添加了索引.但是,由于我们并不真正了解客户将如何使用该软件,因此很难确定要创建哪些索引.

                  To make these searches go fast, we're adding indexes to the fields and combinations of fields on which we believe users will commonly search. However, since we don't really know how our customers will use this software, it's hard to tell which indexes to create.

                  空间不是问题;我们有一个 4 TB 的 RAID 驱动器,我们只使用了其中的一小部分.但是,我担心索引过多可能会导致性能下降.因为每次添加、删除或修改行时都需要更新这些索引,所以我想在一个表上有几十个索引是个坏主意.

                  Space isn't a concern; we have a 4 terabyte RAID drive of which we are using only a small fraction. However, I'm worried about the possible performance penalties of having too many indexes. Because those indexes need to be updated every time a row is added, deleted, or modified, I imagine it'd be a bad idea to have dozens of indexes on a single table.

                  那么多少索引才算太多?10?25?50?或者我应该只涵盖真正、真正常见和明显的情况,而忽略其他一切?

                  So how many indexes is considered too many? 10? 25? 50? Or should I just cover the really, really common and obvious cases and ignore everything else?

                  推荐答案

                  这取决于表上发生的操作.

                  It depends on the operations that occur on the table.

                  如果有很多 SELECT 和很少的变化,索引所有你喜欢的......这些将(可能)加速 SELECT 语句.

                  If there's lots of SELECTs and very few changes, index all you like.... these will (potentially) speed the SELECT statements up.

                  如果表受到 UPDATE、INSERTs + DELETEs 的严重影响......这些将非常慢,因为有很多索引,因为每次发生这些操作之一时都需要修改它们

                  If the table is heavily hit by UPDATEs, INSERTs + DELETEs ... these will be very slow with lots of indexes since they all need to be modified each time one of these operations takes place

                  话虽如此,您显然可以将许多毫无意义的索引添加到一个不会做任何事情的表中.将 B 树索引添加到具有 2 个不同值的列将毫无意义,因为它在查找数据方面没有添加任何内容.列中的值越独特,它就越能从索引中受益.

                  Having said that, you can clearly add a lot of pointless indexes to a table that won't do anything. Adding B-Tree indexes to a column with 2 distinct values will be pointless since it doesn't add anything in terms of looking the data up. The more unique the values in a column, the more it will benefit from an index.

                  这篇关于多少数据库索引太多了?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:添加检查单独(链接)表的值的约束 下一篇:将信用卡信息存储到数据库中的最佳实践

                  相关文章

                1. <tfoot id='sy1pb'></tfoot>

                  <small id='sy1pb'></small><noframes id='sy1pb'>

                2. <legend id='sy1pb'><style id='sy1pb'><dir id='sy1pb'><q id='sy1pb'></q></dir></style></legend>

                      <bdo id='sy1pb'></bdo><ul id='sy1pb'></ul>
                    <i id='sy1pb'><tr id='sy1pb'><dt id='sy1pb'><q id='sy1pb'><span id='sy1pb'><b id='sy1pb'><form id='sy1pb'><ins id='sy1pb'></ins><ul id='sy1pb'></ul><sub id='sy1pb'></sub></form><legend id='sy1pb'></legend><bdo id='sy1pb'><pre id='sy1pb'><center id='sy1pb'></center></pre></bdo></b><th id='sy1pb'></th></span></q></dt></tr></i><div id='sy1pb'><tfoot id='sy1pb'></tfoot><dl id='sy1pb'><fieldset id='sy1pb'></fieldset></dl></div>