Indexing The Mysql 5.1: Performance Enhancement
Indexing The Mysql 5.1: Performance Enhancement
1
Performance Enhancement
HoaND - NamNV
MySQL Architecture
Agenda
1.
2.
3.
4.
5.
6.
7.
What is Index?
Why is index?
How is index ?
When using index or not ?
Type of index
Where add index
Choosing indexes
1.What is Index?
2.Why is index ?
3.How is index ?
3.How is index ?
EMPLOYEE
ID
FIRSTNAM
E
LASTNAME AGE
SALARY
GENDER
001
Ashish
Kataria
25
10000
002
Rony
Felix
28
20000
003
Namita
Misra
24
10000
004
Ankur
Aeran
30
25000
005
Priyanka
Jain
30
20000
006
Pradeep
Pandey
31
30000
007
Pankaj
Gupta
25
12000
008
Ankit
Garg
30
15000
Hash Index
Hash index supported only by
Memory Storage Engine.
B-Tree Index
B-Tree Index
00
1
00
2
00
3
00
6
00
4
00
5
00
8
00
7
AG
E
SALAR
Y
GENDER
001
Ashish
Kataria
25
10000
002
Rony
Felix
28
20000
003
Namita
Misra
24
10000
004
Ankur
Aeran
30
25000
005
Priyanka
Jain
30
20000
006
Pradeep
Pandey
31
30000
007
Pankaj
Gupta
25
12000
008
Ankit
Garg
30
15000
B-Tree Index
Full-text Index
R-Tree Index
Spacial index is supported by only
MyISAM storage engine. Its just like
B-tree but the index follow any order
not just left to right. This index used
for only specific purpose. (I.e MySQL
GIS functions)
3.How is index?
http://www.mysqlperformanceblog.com/2009/09/12/3-waysmysql-uses-indexes/
5.Type of index?
http://dev.mysql.com/doc/refman/5.0/en/column-indexes.html
5.Type Concatenated
Index
http://dev.mysql.com/doc/refman/5.0/en/multiple-columnindexes.html
http://www.mysqlperformanceblog.com/2006/11/23/coveringindex-and-prefix-indexes/
http://ronaldbradford.com/blog/tag/partial-index/
5.Type Clusteredvs.Non
clustered
http://rajeshstutorials.blogspot.com/2012/02/clustered-indexesvs-non-clustered.html
6.Where - MyISAM
Fortablesareusedmoreoften Key
Cache can be used to optimize read
of those tables
hot_cache.key_buffer_size=128K
Assigntablestocaches
CACHEINDEX table1,TOhot_cache;
CACHEINDEXtable2TOcold_cache;
7.Choosing Indexes
7.Choosing Indexes