Thursday, 28 April 2016

What is INDEXING and its Advantage & Disadvantage


Indexing

It is a data structure that improves the speed of search in database. We add the indexing on columns of table. We can one or more indexing on table.

Advantage of Indexing
It improve the speed of search. If we add indexing on any column, It will search faster.

Disadvantage of Indexing

INSERT and UPDATE statements take little more time on tables.


Column Index: In this type, we add indexing on single column

   
ALTER TABLE table_name ADD INDEX (field_name);
 

Concatenated Index: In this type, we add indexing on two OR more columns. 

ALTER TABLE table_name ADD INDEX (field_name1, field_name2);

Add Indexing
alter table `cities` add index name (name)

List all the Indexing in cities table
show index from `cities`

Drop Indexing 
alter table `cities` drop index name
 

No comments:

Post a Comment