Presentation is loading. Please wait.

Presentation is loading. Please wait.

Indexing strategies and good physical designs for performance tuning Kenneth Ureña /SpanishPASSVC.

Similar presentations


Presentation on theme: "Indexing strategies and good physical designs for performance tuning Kenneth Ureña /SpanishPASSVC."— Presentation transcript:

1 Indexing strategies and good physical designs for performance tuning Kenneth Ureña http://www.sqlcr.com @sqlcr /SpanishPASSVC

2 Agenda  The journey of a transaction  Performance degradation factors  Physical Designs  Indexing  Coding best practices

3 THE JOURNEY OF A TRANSACTION

4 Actual empty Virtual Log File Truncated -Sequential Access -Just 1 file Active -Recommended Raid 1 ó 1 + 0 -Commit, backup log trigger I/O Log File -Random Access -Multiple datafiles Active -Recommended Raid 1/1+0 5+0 / 5 -Checkpoint, backup, load / unload Cache FullEmpty FullEmpty Full EmptyFull Data Files Cache fail Loads page Update page Commit Lazy Writter / Checkpoint

5 PERFORMANCE DEGRADATION FACTORS

6 HardwareSoftware DB Performance Degradation life cycle Overload Degraded Performance CPU / Memory Storage Peripheral Database Data Algorithm

7 Sata, SAS, SSD (Types of Hard Drives) Big performance difference between Sequential IO vs Random IO IOPS (In Out Per Second) IOPS Estimated = 1 / ((seek time / 1000) + (latency / 1000)) Storage Reference http://www.cloudbyte.com/docs/Whitepaper_CloudByte_Measuring-Storage-Performance.pdf

8 Average read seek time: 3.4 ms Average write seek time: 3.9 ms Average latency: 2.0 ms Seek time = ( Average read seek time + Average write seek time) / 2 = (3.4 + 3.9) / 2 = 3.65 ms IOPS Estimated = 1 / ((seek time / 1000) + (latency / 1000)) = 1 / ((3.65/1000) + (2.0 / 1000) = 176.9911 ~ 175 IOPS SAS - 600GB 15K - Seagate Reference http://www.seagate.com/www/en-us/products/enterprise-hard-drives/cheetah-15k#tTabContentSpecifications

9 Raids Raid 0 Raid 1 Raid 5 Raid 1 + 0

10 Raid 0 (Stripping)  Logical Drive Characteristics  IOPS = #Disk * IOPS Estimated  S ize = #Disks * Size disk  Pros  High performance  Low cost  Cons  Fault tolerance

11 Raid 1 (Mirroring)  Logical Drive Characteristics  IOPS = (#Disk / 2) * IOPS Estimated  S ize = (#Disk / 2) * Size disk  Pros  Fault tolerance  Cons  Higher cost

12 Raid 5  Logical Drive Characteristics  IOPS = (#Disk - 1) * IOPS Estimated  S ize = (#Disk - 1) * Size disk  Pros  Fault tolerance  Cost Effective  Cons  Recalculation on raid failure  Parity calculation

13 Raid 1 + 0  Logical Drive Characteristics  IOPS = (#Disk /2) * IOPS Estimated  S ize = (#Disk / 2) * Size disk  Pros  Fault tolerance  Cons  Cost

14 Database Files Random Access Multiple Actives Data File Sequential Access One Active Log File

15 PHYSICAL DESIGNS

16 Physical Designs Choosing the right Raid for the Database File Split the files in order to get the expected Access behavior

17 Scenario #1 1 User Database High OLTP Traffic High TempDB consumption 16 Cores Server

18 Scenario #1 (Proposal 1) Raid 1+0 Drive SAS TempDB UserDB Raid 5 Drive SAS Raid 1+0 Drive SAS LOG File Data File

19 Scenario #1 (Proposal 2) Raid 1+0 Drive SAS TempDB UserDB Raid 1+0 Drive SAS Raid 1+0 Drive SAS LOG File Data File

20 Scenario #1 (Proposal 3) TempDB UserDB Raid 1+0 Drive SSD Raid 1+0 Drive SAS LOG, Data File LOG File Data File

21 Scenario #2 multiple User Database High OLTP Traffic High TempDB consumption multiple Cores Server

22 Scenario #2 (Proposal 1) Raid 1+0 Drive SAS TempDB Raid 1+0 Drive SAS Raid 1+0 Drive SAS LOG File Data File UserDBN Raid 1+0 Drive SAS Data File Raid 1 Drive SSD UserDB1 LOG File

23 INDEXING

24 Indexes and Organization Table structure Image from SQL server 2008 books online

25 Indexes and Organization Heap Table Image from: SQL server 2008 books online

26 Indexes and Organization Clustered Table Image from: SQL server 2008 books online

27 Clustered (example) Image from: http://www.sqlservercentral.com/images/4695.jpg

28 Indexes and Organization NonClustered Index Image from: SQL server 2008 books online

29 Column Index Image from http://magenic.com/

30 Data access patters  Seek  Scan  Bookmark Lookup

31 Data access patters DEMO

32 CODING BEST PRACTICES

33 Coding Best Practices  Maximize coverage  Avoid conversions (implicit/explicit)  Avoid row by row access (cursor pattern)  Avoid unnecessary sorting  Choose the right index for the expected data pattern access method

34 Q&A Thank you Kenneth Ureña http://www.sqlcr.com @sqlcr /SpanishPASSVC


Download ppt "Indexing strategies and good physical designs for performance tuning Kenneth Ureña /SpanishPASSVC."

Similar presentations


Ads by Google