开发者

Oracle Table Index creation

开发者 https://www.devze.com 2023-02-04 23:09 出处:网络
I created a table named STUDENT.It has the following columns: 开发者_如何转开发 Id Name Surname DateOfBirth

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

精彩评论

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