0% found this document useful (0 votes)
9 views7 pages

Lecture 33 INDEX

Uploaded by

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

Lecture 33 INDEX

Uploaded by

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

INDEX

An index is a performance-tuning method of allowing faster retrieval of records. An index creates an entry for each
value that appears in the indexed columns.

CREATE [UNIQUE] INDEX index_name


ON table_name
(index_col1 [ASC | DESC],
Syntax index_col2 [ASC | DESC],
...
index_col_n [ASC | DESC]);

A simple index is an index on a single column, while a composite index is an


index on two or more columns.

Start-Tech Academy
CREATE INDEX
An index is a performance-tuning method of allowing faster retrieval of records. An index creates an entry for each
value that appears in the indexed columns.

CREATE INDEX mon_idx


Example ON month_values(MM);

Start-Tech Academy
DROP or RENAME INDEX
An index is a performance-tuning method of allowing faster retrieval of records. An index creates an entry for each
value that appears in the indexed columns.

DROP INDEX [IF EXISTS] index_name


[ CASCADE | RESTRICT ];

Syntax ALTER INDEX [IF EXISTS] index_name,


RENAME TO new_index_name;

Start-Tech Academy
DROP INDEX
An index is a performance-tuning method of allowing faster retrieval of records. An index creates an entry for each
value that appears in the indexed columns.

Example DROP INDEX mon_idx;

Start-Tech Academy
INDEX
An index is a performance-tuning method of allowing faster retrieval of records. An index creates an entry for each
value that appears in the indexed columns.

1. Build index on columns of integer type

2. Keep index as narrow as possible

GOOD 3. Column order is important

PRACTICES 4. Make sure the column you are building an index for is declared NOT NULL

5. Build an index only when necessary

Start-Tech Academy
INDEX
An index is a performance-tuning method of allowing faster retrieval of records. An index creates an entry for each
value that appears in the indexed columns.

The following guidelines indicate when the use of an index should be


reconsidered.

• Indexes should not be used on small tables.

GOOD • Tables that have frequent, large batch updates or insert operations.

PRACTICES • Indexes should not be used on columns that contain a high number of NULL
values.

• Columns that are frequently manipulated should not be indexed.

Start-Tech Academy

You might also like