0

我有一个外键 (IdForign),并且总是在 where 子句中使用它。我有三个领域:

Id
Name
IdForign

如何为名称字段创建索引?(IdForign, Name) 还是只有一个用于 IdForign 而其他用于 Name?

谢谢!!

4

2 回答 2

0

If I undertand correctly your question, you need to create an Index only for IdForign, because it's the one you use in the where


UPDATE
As per your comment, if you are using both fields I suggest you to use an index with Name and IdForign

Read this. It should give you some tips on indexing with Sql Server

于 2012-05-28T15:55:50.423 回答
0

您所要求的基本系统税似乎是:

CREATE INDEX yourIndexName ON yourTableName (yourFieldName);

这也是假设您的意思是 Microsoft SQL Server。有关MSDN 文档,请参见此处。

我希望这有帮助。

于 2012-05-28T15:38:08.430 回答