Presentation is loading. Please wait.

Presentation is loading. Please wait.

The Top 5 SQL Server Mistakes

Similar presentations


Presentation on theme: "The Top 5 SQL Server Mistakes"— Presentation transcript:

1 The Top 5 SQL Server Mistakes
Kathi Kellenberger

2 Who am I? Data Platform MVP Author Trainer Database Consultant

3 Agenda Physical resources Configuration Maintenance Plan
Index Strategy Queries

4 Physical Resources: Memory
Memory is the air that SQL Server breaths

5 Data must be in memory to be used by SQL Server
Data Cache

6 What happens if not enough RAM for the next query?
Data Cache

7 What if we need the first table again?
Data Cache

8 How do you know if memory is adequate?
Page Life Expectancy *The number of seconds a page is expected to live in memory

9 PLE Published value is 300. Inadequate for today’s servers.
Jonathan Keyhaias’ recommendation for minimum RAM/4 * 300 16 GB = 1,200 minimum Watch for sustained low values Use perfmon to measure \SQLServer:Buffer Manager\Page life expectancy

10 PLE Example

11 Configuration: Tempdb
Tempdb is the work horse of SQL Server

12 When is Tempdb Used? Temp tables and table variables live there
Sorting Index maintenance (sort in tempdb option) Work tables DBCC CHECKDB Snapshot isolation Others…

13 Default Tempdb Configuration (pre-2016)

14 What Happens? Restart Temp tables Temp tables Sorting Sorting DBCC
And more… Restart Temp tables Sorting DBCC And more…

15 How to Fix? ALTER DATABASE [tempdb] MODIFY FILE ( NAME = N'tempdev', SIZE = 8192MB ); --8GB. ALTER DATABASE [tempdb] MODIFY FILE ( NAME = N'templog', SIZE = 1024MB ); --1GB

16 Option: Turn Off Or Modify File Growth
ALTER DATABASE [tempdb] MODIFY FILE ( NAME = N'tempdev', SIZE = 8192MB, FILEGROWTH = 0 ); -- Turn off ALTER DATABASE [tempdb] MODIFY FILE ( NAME = N'templog', SIZE = 1024MB, FILEGRWOTH = 50MB ); -- Set at 50 MB

17 Ultimate Tempdb Configuration
Create one tempdb data file for each core up to 8 of equal size and growth characteristics Place files on separate drives Place files on fastest storage Startup trace flags 1117 and 1118 (pre-2016)

18 Maintenance Plan: Shrinking Files
Why is it even an option???

19 The Maintenance Plan Wizard

20 What Happens? Transactions Maintenance Transactions

21 How to Fix? Step 1

22 How to Fix? Step 2 Shrinking

23 Index Strategy Don’t blindly follow SQL Server’s indexing advice

24 Missing Index Information

25 Database Engine Tuning Advisor

26 Database Engine Tuning Advisor

27 How to Fix?

28 Queries: Sargability Don’t misuse a perfectly good index

29 Functions on Columns Cause Scans 1

30 Functions on Columns Cause Scans 2

31 How to Fix?

32 How to Fix?


Download ppt "The Top 5 SQL Server Mistakes"

Similar presentations


Ads by Google