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

        <bdo id='DVt6I'></bdo><ul id='DVt6I'></ul>

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

      <tfoot id='DVt6I'></tfoot>

      <legend id='DVt6I'><style id='DVt6I'><dir id='DVt6I'><q id='DVt6I'></q></dir></style></legend>
      1. SQL Server:索引列用在什么地方?

        时间:2023-10-10
      2. <legend id='VwIEN'><style id='VwIEN'><dir id='VwIEN'><q id='VwIEN'></q></dir></style></legend>

              1. <small id='VwIEN'></small><noframes id='VwIEN'>

                <i id='VwIEN'><tr id='VwIEN'><dt id='VwIEN'><q id='VwIEN'><span id='VwIEN'><b id='VwIEN'><form id='VwIEN'><ins id='VwIEN'></ins><ul id='VwIEN'></ul><sub id='VwIEN'></sub></form><legend id='VwIEN'></legend><bdo id='VwIEN'><pre id='VwIEN'><center id='VwIEN'></center></pre></bdo></b><th id='VwIEN'></th></span></q></dt></tr></i><div id='VwIEN'><tfoot id='VwIEN'></tfoot><dl id='VwIEN'><fieldset id='VwIEN'></fieldset></dl></div>
                <tfoot id='VwIEN'></tfoot>
                  <bdo id='VwIEN'></bdo><ul id='VwIEN'></ul>
                    <tbody id='VwIEN'></tbody>
                • 本文介绍了SQL Server:索引列用在什么地方?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  索引仅在 LIKE 操作中使用的 varchar 列是个好主意吗?根据我从查询分析中读取的信息,我从以下查询中获得:

                  Is it a good idea to index varchar columns only used in LIKE opertations? From what I can read from query analytics I get from the following query:

                  SELECT * FROM ClientUsers WHERE Email LIKE '%niels@bosmainter%'
                  

                  我得到的估计子树成本"为 0.38,没有任何索引,0.14 有索引.如果已使用索引优化查询,这是用于分析的好指标吗?

                  I get an "Estimated subtree cost" of 0.38 without any index and 0.14 with an index. Is this a good metric to use for anlayzing if a query has been optimized with an index?

                  推荐答案

                  给定数据 'abcdefg'

                  Given the data 'abcdefg'

                  WHERE Column1 LIKE '%cde%'  --can't use an index
                  
                  WHERE Column1 LIKE 'abc%' --can use an index
                  
                  WHERE Column1 Like '%defg' --can't use an index, but see note below
                  

                  注意:如果您有需要 '%defg' 的重要查询,您可以使用持久计算列,您可以在其中 REVERSE() 列,然后对其进行索引.然后您可以查询:

                  Note: If you have important queries that require '%defg', you could use a persistent computed column where you REVERSE() the column and then index it. Your can then query on:

                  WHERE Column1Reverse Like REVERSE('defg')+'%' --can use the persistent computed column's index
                  

                  这篇关于SQL Server:索引列用在什么地方?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:逗号分隔值与 SQL 查询 下一篇:根据 SQL Server 中的条件进行计数

                  相关文章

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

                    <legend id='5JFhv'><style id='5JFhv'><dir id='5JFhv'><q id='5JFhv'></q></dir></style></legend>

                  1. <small id='5JFhv'></small><noframes id='5JFhv'>