<tfoot id='KIWhG'></tfoot>

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

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

      1. <legend id='KIWhG'><style id='KIWhG'><dir id='KIWhG'><q id='KIWhG'></q></dir></style></legend>
        • <bdo id='KIWhG'></bdo><ul id='KIWhG'></ul>

        唯一约束与唯一索引

        Unique Constraint vs Unique Index(唯一约束与唯一索引)
      2. <tfoot id='Bd5Qj'></tfoot>

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

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

                <tbody id='Bd5Qj'></tbody>
                  <bdo id='Bd5Qj'></bdo><ul id='Bd5Qj'></ul>
                  本文介绍了唯一约束与唯一索引的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有兴趣了解开发人员更喜欢使用哪种技术来强制 SQL Server 中的唯一性:UNIQUE CONSTRAINT 或 UNIQUE INDEX.鉴于每个的物理实现几乎没有区别,您如何决定哪个最好?

                  I’m interested in learning which technique developers prefer to use to enforce uniqueness in SQL Server: UNIQUE CONSTRAINT or UNIQUE INDEX. Given that there is little difference in the physical implementation of each, how do you decide which is best?

                  除了性能之外还有其他原因可以评估最佳解决方案吗?

                  Are there reasons other than performance to evaluate the best solution?

                  其中一个有数据库管理优势吗?

                  Are there database management advantages to one or the other?

                  推荐答案

                  这篇比较两者的 MSDN 文章适用于 SQL Server 2000:http://msdn.microsoft.com/en-us/library/aa224827(SQL.80).aspx

                  This MSDN article comparing the two is for SQL Server 2000: http://msdn.microsoft.com/en-us/library/aa224827(SQL.80).aspx

                  对于大多数用途,没有区别 - 约束是作为索引实现的.尽管可以禁用约束,但它实际上在 SQL Server 中不起作用.

                  For most purposes, there's no difference - the constraint is implemented as an index under the covers. And though there's the ability to disable the constraint, it doesn't actually work in SQL Server.

                  仅当您想调整 FILLFACTOR 等内容以实现独特约束的方式时才重要.

                  It only matters if you want to tweak things like FILLFACTOR, etc for which way you want to implement the unique constraint.

                  SQL Server 2008+ 添加了 INCLUDE 以提供更有效的覆盖索引.过滤索引 = 对行子集的唯一约束/忽略多个空值等

                  SQL Server 2008+ added INCLUDE to provide more efficient covering indexes. Filtered indexes = unique constraint over a subset of rows/ignore multiple null etc.

                  这篇关于唯一约束与唯一索引的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  SQL query to group by day(按天分组的 SQL 查询)
                  Include missing months in Group By query(在 Group By 查询中包含缺失的月份)
                  sql group by versus distinct(sql group by 与不同)
                  How to return a incremental group number per group in SQL(如何在SQL中返回每个组的增量组号)
                  Count number of records returned by group by(统计分组返回的记录数)
                  SQL GROUP BY CASE statement with aggregate function(带聚合函数的 SQL GROUP BY CASE 语句)
                  <i id='kWtwz'><tr id='kWtwz'><dt id='kWtwz'><q id='kWtwz'><span id='kWtwz'><b id='kWtwz'><form id='kWtwz'><ins id='kWtwz'></ins><ul id='kWtwz'></ul><sub id='kWtwz'></sub></form><legend id='kWtwz'></legend><bdo id='kWtwz'><pre id='kWtwz'><center id='kWtwz'></center></pre></bdo></b><th id='kWtwz'></th></span></q></dt></tr></i><div id='kWtwz'><tfoot id='kWtwz'></tfoot><dl id='kWtwz'><fieldset id='kWtwz'></fieldset></dl></div>

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

                    <tbody id='kWtwz'></tbody>

                  1. <legend id='kWtwz'><style id='kWtwz'><dir id='kWtwz'><q id='kWtwz'></q></dir></style></legend>

                      <tfoot id='kWtwz'></tfoot>
                        • <bdo id='kWtwz'></bdo><ul id='kWtwz'></ul>