I have a table containing production information that your users query frequently, They specifically use this 
query most often (that is only use name to search in the where condition):
SELECT Name,Description,Vendor,Instock,Price FROM Products where Name='Jerry'--(查询时where后面只有Name这个条件)Have a nonclustered index on this table on the Name column,but your users are complaining the query is still too slow,what can you do to speed it up?A、modify the index to include the Description,vendor,Instock, and price columns as nonkey columns.
B、Create a new nonclustered index on the Description,vendor,Instock, and price as nonkey columns.
C、Create a new clustered index on the Description,vendor,Instock, and price as nonkey columns.
D、You can't do anything to speed up this query.数据库是SQL SERVER,请问哪个答案是对的,请给出理由,谢谢。

解决方案 »

  1.   

    B、Create a new nonclustered index on the Description,vendor,Instock, and price as nonkey columns. 
      

  2.   

    对于2005+,索引include需要查询的字段是能提高速度的
      

  3.   

    Have a nonclustered index on this table on the Name column
    --------
    a
      

  4.   

    http://gogoyoyo.javaeye.com/blog/308821
      

  5.   

    A 可以直接在索引页上得到这些数据..不用根据索引的Book到数据页中找那些列的数据..
    学习梁哥
      

  6.   

    我有一个表包含产品信息,您的用户的查询频繁,他们专门使用这种最常见的查询(即只使用名搜索在WHERE条件): 选择名称,描述,供应商的inStock,价格从产品在名称='Jerry' - (查询时在后面只有名字这个条件) 在此表上有一个非聚集索引的名称列,但您的用户抱怨查询仍然过于缓慢,您可以做什么办法可以加快? a,修改该指数将包括说明,供应商的inStock,以及非键列价格列。 b,上创建一个描述,供应商的inStock,以及非键列价格的新的非聚集索引。  C上,创建了关于说明,供应商的inStock,以及非键列价格的新聚集索引。  D,您不能做任何事情,以加快此查询。
    a
      

  7.   

    sorry, i don't speak english! please say chinese! ths!
      

  8.   

    这道题目出得有点问题:
    1.如果在2000下,没有在索引页中增加非键值列一说,因此,最好的方法,创建一聚集索引,同时在name上增加一个索引,使用indexs seek +book 查找方式,我认为是最快的,(引用的字段过多,不宜做复合索引).然而当该表的name字段存在重复值,且重复的记录数/总数值*100>60%.个人认为indexs+book的IO开销与clustered scan的开销应该是差不多的.
    所以在2000下,该题无合适答案.
    2.在2005下,
    A好像是最好的,但如果仍存在I/0开销严重的话,即存在大量的重复值的,就算做了include.查询结果未必就快了.