Difference between clustered and Non-Clustered Indexes in Oracle Sql PLSQL Interview Question and Answer.
"It is an important question which is asked in an interview as indexing topic."
INTRODUCTION:
In the SQL server, primary key constraint automatically builds the clustered index on the column. There will be only one clustered index per table. It is used to sort the data of the table alphabetically as like dictionary structure. Single table can contain multiple non-clustered indexes. It collects the data and record at one place simultaneously.
CLUSTERED INDEX:
NON-CLUSTERED INDEX:
DIFFERENCE:
Clustered
Index |
Non-clustered
Index |
It is faster
than non-clustered index. |
It is slower
than the clustered index. |
Less memory
is required to execute the operation. |
More memory
is required to execute the operation. |
Ability to
store the data on the disk naturally. |
It does not
have the data to store on the disk naturally. |
Data sheets
are stored in the leaf nodes. |
Data sheets
are not stored in the leaf nodes. |
It is the
main data. |
Index is the
main data. |
Leaf nodes
are itself actual data. |
Leaf nodes
are not itself actual data. Instead, it contains the multiple columns. |
Clustered key
will define the order of the data within the table. |
Index key
will define the order of the table within the index. |
By default,
primary key of the table is said to be clustered index. |
Composite key
used with the unique constraint of the table act as the non-clustered index. |
It is more
prefer for static data environments. |
It is more
prefer for dynamic data environments. |
It contains an
index id which is equal to zero. |
It contains an
index id which is greater than zero. |
Comments
Post a Comment