如何在表中查找索引列 [英] How to find index column in a table

查看:482
本文介绍了如何在表中查找索引列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的朋友,

如何在表中查找索引列.
制作多个索引的用途是什么.

问候,
AP

Dear Friends,

How to find index column in a table.
What is use of making multiple index.

Regards,
AP

推荐答案

以下是从公司"数据库的员工"表中获取多个索引列的示例代码.
Here is the sample code to fetch the multiple index columns from ''Employee'' table of ''Company'' database.

USE Company;
GO
EXEC sp_helpindex 'Employee'
GO


如何在表中查找索引列.
获取索引的信息表和索引列 [如何获取涉及列名称的所有索引列表 [^ ]

建立多个索引的用途是什么.
该优化器只能在一个查询中使用一个索引,因此,如果创建五个索引,优化器将选择要使用的最佳索引,而忽略其余的索引.
如果您创建一个包含五个字段的索引,它将使用尽可能多的索引.如果您限制索引的第一个字段,它将仅使用索引的该部分.如果您限制前三个字段,它将使用全部三个部分,而不是仅在第一个字段上添加索引,从而获得更好的性能.
How to find index column in a table.
Get Information of Index of Tables and Indexed Columns[^]
How to Get All Indexes List With Involved Columns Name[^]

What is use of making multiple index.
The optimizer can only use only one index in a query, so if you create five indexes, the optimizer will pick the best one to use, and disregard the rest.
If you create one index with five fields, it will use as much of the index as it can. If you restrict on the first field of the index, it will use only that part of the index. If you restrict on the first three fields, it will use all three parts, resulting in better performance than just having an index on the first field.


这篇关于如何在表中查找索引列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆