开发者

Oracle Table Index creation

I created a table named STUDENT. It has the following columns:

This table have following primary key:

  • Id
  • Name
  • Surname
  • DateOfAdmission

Do I need to create an index another index of column Id, Name if want to query this table providing input just Id and Name?


An index isn't necessary for queries.
An index has the potential to speed up queries if the index can be used, but will slow down INSERT/UPDATE/DELETE statements.

I'm not clear when Oracle started, but Oracle 10g+ will automatically create an index when a primary key is defined for a table. That index will match the column(s) that make up the primary key. Being that the id and name columns are part of the primary key, the pair is guaranteed to be unique and I don't see the need to create an additional covering index.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜