0% found this document useful (0 votes)
6 views3 pages

SQLSERVER-CLASS14(INDEXES)

Uploaded by

hanuman sqlboy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views3 pages

SQLSERVER-CLASS14(INDEXES)

Uploaded by

hanuman sqlboy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Indexes

How data is stored under a database:

Sql server store data in it under data pages where a datapage is a minuta for storing of
information.a datapage will be having a size of 8kb and all data pages are stored under
a logical container.

How will database engine retrives the information from table:

Whenever database engine want to retrive the information from table.it will

Adopt to different mechanism for searching data.

1. Full page scan: In this first case sql servere will search for requiered
information in each and every page to collect the information so if the table
has more rows it will be taking lot of time for scanning.
2. Index scan : In this second case sql server without searching into each and
every datapage for retrive data it will make use of an index for retrive
information,where an index is a pointer to the information what we are retrive
which can reduce disk I/O operations and saving time but we want to use
index scan for searching the database first the index has to created.

Syntax:

Create [unique] [ cluster / non cluster] index <index name> on <tn>(col1,col2,


…………..);

Note: whenever an index is created on a column / columns of a table internally


an index table gets created maintaining the information of column on which the
index is created as well as address(pointer to the row corresponding to a column.
Clustered index: In this case the arrangement of the data in the index table will be
same as arrangement of the data of actual table.

Ex: The index we find in the start of book.

Non – clustered index: In this case the arrangement of the data in the index table will
be not same as arrangement of the data of actual table.

Ex: The index we find in the end of book.

Working with indexes tables. Indexes can be created to increase the


performance of data retrieval. Just as the index in this manual helps you quickly locate
specific information, an Oracle index provides

 Index is a schema object,which a pointer locates the physical address of data.

 Index used by the sql server to speed up the retrival ,manipulate of rows.

Specification of an index:-

Index can be created explicitly or automatically.

• We will be creating indexes explicitly to speed up SQL statement


execution on a table.

• It is automatically activated when index column is used in “where” clause.

• Indexes can be created on a single column or a group of columns.


• When an index is created, it first sorts the data and then it assigns a
ROWID for each row.

• When there are thousands of records in a table, retrieving information will


have performance issue. Therefore indexes are created on columns which
are accessed frequently, so that the information can be retrieved quickly.

• Index necessity of disk I/O by using an indexed path to locate data


quickly.

• When you drop a table ,corresponding indexes are also dropped.

Synatax to drop an index:

Drop index <table name>.<index name>;

You might also like