Archive for February 13th, 2008

What is Database Index in MySql?

If in a Database Table there are no index exist like primary or unique key then when you write a query for search anything from this table of course the search time cost will higher then when you use index in this table.

Cause in without index table the search perform must in entire table if in this table huge amount of record exist then you may find it is slow cause entire table searching.

Where if you use column index then searching cost will minimize from previous time cost. Cause when you use index it it will perform the search operation only on indexed row.

Indexed default row

1) primary key field

2) unique key field

Use of Index :

If you use this kinds of query then it is by default search first

$sql = “select *from table where primary_key_id = 40015″;

or

$sql = “select *from table where unique_key_name = ‘Jewel’”;

You can also add another indexed column for searching first

Alter a column which are indexed

$sql = “ALTER TABLE table ADD INDEX (‘lastname’) “;

in this query lastname field are indexed altered.

Now you can write sql for first search like this

$sql=”select * from table where lastname=’Ahmed’”;

this query will faster. Because The use of index.

Reference Site LInk : http://www.databasejournal.com/features/mysql/article.php/1382791

How to index practical image draw are given below Just follow the image.
What is Database Index in MySql?

Add comment February 13, 2008



Jewel Ahmed's Facebook profile
Jewel Ahmed's Facebook profile

Pages

Categories

 

February 2008
M T W T F S S
    Mar »
 123
45678910
11121314151617
18192021222324
2526272829  

Blogroll

Recent Comments

Wardell on MySql Type Casting
Ahsan on Other to FLV file conversion i…
mySql Type Casting t… on MySql Type Casting
bibomedia on About

Recent Posts

Archives