Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chap 5. Disk IO Distribution Chap 6. Index Architecture Written by Yong-soon Kwon Summerized By Sungchan IDS Lab. 2008-07-11.

Similar presentations


Presentation on theme: "Chap 5. Disk IO Distribution Chap 6. Index Architecture Written by Yong-soon Kwon Summerized By Sungchan IDS Lab. 2008-07-11."— Presentation transcript:

1 Chap 5. Disk IO Distribution Chap 6. Index Architecture Written by Yong-soon Kwon Summerized By Sungchan Park @ IDS Lab. 2008-07-11

2 Copyright  2008 by CEBT Overview  Chap 5. Disk IO Distribution Oracle Storage Architecture Tuning by Disk IO Distribution  Chap 6. Index Architecture Introduction to Index – B+-Tree Index – Bitmap Index – Reverse Key Index – Function Base Index Random Access Tuning Center for E-Business Technology

3 Chap 5. Disk IO Distribution

4 Copyright  2008 by CEBT Disk IO Distribution  Pros Improving Performance  Cons Probability of error increase – Problem on one disk affects whole table Hard to manage Center for E-Business Technology

5 Copyright  2008 by CEBT Disk IO Distribution Rule  Disk IO Distribution Rule We should increase the probability that all disks are accessed. – Data in each table should be distributed to all disks  How to satisfy the rule? 1.Optimizing Disk Organization 2.Segment Extent Striping 3.Applying Table Archtecture – Partition table, IOT table Center for E-Business Technology

6 Copyright  2008 by CEBT Optimizing Disk Organization: Volume Group  Volume Groups(VG) Groups of Physical Disks One physical disk cannot belong to multiple VG  Checking VG(HP UX) “vgdisplay –v vg01”  Important Info “Cur PV : 4” : This VG consists of four physical disks “Act PV : 4” : Four physical disks are active in this VG Center for E-Business Technology

7 Copyright  2008 by CEBT Optimizing Disk Organization: Logical Volume  Concept of Logical Volume Space for file system in VG  Logical Volume Usage File System Raw Device Center for E-Business Technology

8 Copyright  2008 by CEBT Optimizing Disk Organization: Logical Volume Striping  Logical Volume Striping Center for E-Business Technology

9 Copyright  2008 by CEBT Optimizing Disk Organization: Logical Volume Striping  Good Point of Logical Volume Striping Achieve Disk IO distribution rule for each VG  Checking Logical Volume “ldisplay –v /dev/vg01/lvol1”  Important Info “Stripes 4” : This logical volume is striped with 4 disks “Stripe Size(Kbytes) 64” : The striping size is 64KB Center for E-Business Technology

10 Copyright  2008 by CEBT Oracle Storage Architecture Center for E-Business Technology

11 Copyright  2008 by CEBT Oracle Storage Architecture  OS Block OS Level IO unit  DB Block n OS Block. DB IO unit  Extent Contiguous DB Blocks. Building unit of Segment  Segment Group of Extents(table, index)  Tablespace Group of Segments  Database Group of Tablespaces  Datafile Stores Segments. n Datafile make one Tablespace Center for E-Business Technology

12 Copyright  2008 by CEBT Segment Extent Striping: Create Tablespace Center for E-Business Technology

13 Copyright  2008 by CEBT Segment Extent Striping: Create Table on Tablespace Center for E-Business Technology

14 Copyright  2008 by CEBT Segment Extent Striping: Create Table on Tablespace Center for E-Business Technology

15 Copyright  2008 by CEBT Segment Extent Striping  Good Points Storing data evenly over all disks for all tables Disk IO distribution rule optimization  Checking Exntent Striping Center for E-Business Technology

16 Copyright  2008 by CEBT Partition Table  Example Data about 20~30 year old people is frequently accessed If we just store all data in a table, there can be some disks which do not contain any data about 20~30s – Data are not properly distributed!  Partition table  Create partition w.r.t. age! Center for E-Business Technology

17 Copyright  2008 by CEBT Partition Table: Example Center for E-Business Technology  Result Data about 20~30s are distributed to all 96 disks!

18 Copyright  2008 by CEBT Wrong IO Distrubution #1 Center for E-Business Technology

19 Copyright  2008 by CEBT Wrong IO Distribution #2  Incrementally adding datafile to tablespace Center for E-Business Technology

20 Chap 6. Index Architecture

21 Copyright  2008 by CEBT Pros. and Cons. of Indexing  Pros. Improving Retrieving Performance  Cons. Degrading Data Manipulation Performance – Insert, Delete, … Storage Center for E-Business Technology

22 Copyright  2008 by CEBT ROWID  ROWID ID given to all rows in database Center for E-Business Technology

23 Copyright  2008 by CEBT Example of ROWID Center for E-Business Technology

24 Copyright  2008 by CEBT Usage of ROWID  Index Creation  Data Access  SQL Tuning Center for E-Business Technology

25 Copyright  2008 by CEBT Index  B+-Tree Index  Bitmap Index  Reverse Key Index  Function Based Index Center for E-Business Technology

26 Copyright  2008 by CEBT B+-Tree Index  B+-Tree Index Support efficient search, delete, and insert Center for E-Business Technology

27 Copyright  2008 by CEBT B+-Tree Index Access Center for E-Business Technology

28 Copyright  2008 by CEBT B+-Tree Index: Pros. and Cons.  Pros. Balanced Range scan using linked list Good for OLTP small number row access  Cons. Bad for column with low cardinality – Index scanning 3%~5%of Table row: Worse than table full scan Possibility of full scan on OR operation Center for E-Business Technology

29 Copyright  2008 by CEBT Bitmap Index  Bitmap Index Good for column with low cardinality Center for E-Business Technology

30 Copyright  2008 by CEBT Bitmap Index structure Center for E-Business Technology

31 Copyright  2008 by CEBT Bitmap Index: Pros. and Cons.  Pros. Small space Good for column with low cardinality  Cons. Bad for table with frequent DML – Bitmap is need to be decompressed before DML operation – Need block level lock Bad for column with high cardinality Center for E-Business Technology

32 Copyright  2008 by CEBT Reversed Key Index  Reversed Key Index B+-Tree is bad for sequentially increasing index key column – All insert operation need to access left block – Competetion for left block occur! Reversed Key Index using reversed key to avoid above situation Center for E-Business Technology

33 Copyright  2008 by CEBT Reversed Key Index: Pros. and Cons.  Pros. Avoid competetion on left block  Cons. Range scan is impossible Center for E-Business Technology

34 Copyright  2008 by CEBT Function Based Index  Function Based Index Index for transformed value Example – SELECT employee_id, ceil(salary/12)*(grade-5) FROM emp WHERE mod(grade, 10)*1.2 > 10  Creating Function Based Index – SQL> CREATE INDEX bonus_index on emp(mod(grade, 10)*1.2); Center for E-Business Technology

35 Copyright  2008 by CEBT Function Based Index: Pros. and Cons.  Pros. Index scan for transformed value is possible  Cons. DML overhead Flexibility of index is low – Only used for where cluases in predefined form Center for E-Business Technology

36 Copyright  2008 by CEBT Random Access  Random Access IO single Block Should be reduced  Table Full Scan Multi Block IO – Not Random Access  Index Scan Random Access occurs Center for E-Business Technology

37 Copyright  2008 by CEBT Reducing Random Access  Reducing Random Access Optimizing Cluster Factor Using Optimized Index – Ex)SELECT name, date, item FROM trans WHERE id = ‘10’ AND date BETWEEN ‘200401’ AND ‘20040406’ Center for E-Business Technology

38 Copyright  2008 by CEBT Random Access and Index Scan  Random Access and Index Scan Table Access via Index Scan is Random Access Index Scan itself is NOT Random Access Index Scan below 3% of data in table is effective – Over 3%, Full table Scan is effective Center for E-Business Technology


Download ppt "Chap 5. Disk IO Distribution Chap 6. Index Architecture Written by Yong-soon Kwon Summerized By Sungchan IDS Lab. 2008-07-11."

Similar presentations


Ads by Google