TOP 10 Thinks you shouldn’t do with/in your database

Slides:



Advertisements
Similar presentations
TempDB: Performance and Manageability
Advertisements

SAP Memory Management (an Overview)
Acknowledgments Byron Bush, Scott S. Hilpert and Lee, JeongKyu
15 Copyright © 2004, Oracle. All rights reserved. Monitoring and Managing Memory.
Dos and don’ts of Columnstore indexes The basis of xVelocity in-memory technology What’s it all about The compression methods (RLE / Dictionary encoding)
SharePoint and SQL Server integration Demo: SQL Server Optimizing Configurations SQL Server 2014 for SharePoint 2013 Avoiding ginormous transaction.
1 - Oracle Server Architecture Overview
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 11 Database Performance Tuning and Query Optimization.
External Sorting 198:541. Why Sort?  A classic problem in computer science!  Data requested in sorted order e.g., find students in increasing gpa order.
Tempdb Parasites Jason Hall-Dir. of Client SQL Sentry Blog-jasonhall.blogs.sqlsentry.net.
Chapter 9 Overview  Reasons to monitor SQL Server  Performance Monitoring and Tuning  Tools for Monitoring SQL Server  Common Monitoring and Tuning.
Module 8: Monitoring SQL Server for Performance. Overview Why to Monitor SQL Server Performance Monitoring and Tuning Tools for Monitoring SQL Server.
Transaction log grows unexpectedly
SQL Server 2005 SP2 Israeli SQL Server User Group March 2005 Ami Levin
Russ Houberg Senior Technical Architect, MCM KnowledgeLake, Inc.
SQL Server memory architecture and debugging memory Issues
XVII Encontro – 29/11/2011. Virgílio Esteves ID&T – Research & Founder of NetPonto Coimbra C# / WPF / Silverlight / XNA / Azure.
Oracle Memory Configuration on Windows Server Configuring Large Memory for Oracle on 32-bit and 64-bit Windows.
Administration etc.. What is this ? This section is devoted to those bits that I could not find another home for… Again these may be useless, but humour.
Module 8: Server Management. Overview Server-level and instance-level resources such as memory and processes Database-level resources such as logical.
Windows 2000 Memory Management Computing Department, Lancaster University, UK.
Troubleshooting SQL Server Enterprise Geodatabase Performance Issues
Database Systems: Design, Implementation, and Management Tenth Edition Chapter 11 Database Performance Tuning and Query Optimization.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 10 Database Performance Tuning and Query Optimization.
Chapter Oracle Server An Oracle Server consists of an Oracle database (stored data, control and log files.) The Server will support SQL to define.
Module 3: Managing Database Files. Overview Introduction to Data Structures Creating Databases Managing Databases Placing Database Files and Logs Optimizing.
Copyright ®xSpring Pte Ltd, All rights reserved Versions DateVersionDescriptionAuthor May First version. Modified from Enterprise edition.NBL.
Physical Database Design & Performance. Optimizing for Query Performance For DBs with high retrieval traffic as compared to maintenance traffic, optimizing.
TEMPDB Capacity Planning. Indexing Advantages – Increases performance – SQL server do not have to search all the rows. – Performance, Concurrency, Required.
Database Management 9. course. Execution of queries.
Architecture Rajesh. Components of Database Engine.
1 Oracle Architectural Components. 1-2 Objectives Listing the structures involved in connecting a user to an Oracle server Listing the stages in processing.
13 Copyright © 2006, Oracle. All rights reserved. Tuning PGA and Temporary Space.
Module 5: Upgrading to SQL Server 7.0. Overview Planning an Upgrade Preparing to Upgrade Verifying the Upgrade Setting a Compatibility Level.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 External Sorting Chapter 13.
© 2008 Quest Software, Inc. ALL RIGHTS RESERVED. Perfmon and Profiler 101.
Parallel Execution Plans Joe Chang
Database structure and space Management. Database Structure An ORACLE database has both a physical and logical structure. By separating physical and logical.
ESRI User Conference 2004 ArcSDE. Some Nuggets Setup Performance Distribution Geodatabase History.
Process Architecture Process Architecture - A portion of a program that can run independently of and concurrently with other portions of the program. Some.
SQL Server Memory Architecture Sumit Sarabhai Microsoft Corp.
Connect with life Nauzad Kapadia Quartz Systems
MISSION CRITICAL COMPUTING Siebel Database Considerations.
Database Systems, 8 th Edition SQL Performance Tuning Evaluated from client perspective –Most current relational DBMSs perform automatic query optimization.
October 15-18, 2013 Charlotte, NC Accelerating Database Performance Using Compression Joseph D’Antoni, Solutions Architect Anexinet.
What Should a DBMS Do? Store large amounts of data Process queries efficiently Allow multiple users to access the database concurrently and safely. Provide.
Diving into Query Execution Plans ED POLLACK AUTOTASK CORPORATION DATABASE OPTIMIZATION ENGINEER.
Configuring SQL Server for a successful SharePoint Server Deployment Haaron Gonzalez Solution Architect & Consultant Microsoft MVP SharePoint Server
A deep dive into SQL Server Plan Cache Management.
No more waiting. Sponsors About me  Database Technology Specialist  MVP  Blogger  Author 3
Indexing strategies and good physical designs for performance tuning Kenneth Ureña /SpanishPASSVC.
Hitting the SQL Server “Go Faster” Button Rob Douglas #509 | Brisbane 2016.
Get the Most out of SQL Server Standard Edition
SharePoint Solutions Architect, Protiviti
Hitting the SQL Server “Go Faster” Button
SQL Server Internals Overview
Informatica PowerCenter Performance Tuning Tips
Database Performance Tuning and Query Optimization
The Top 5 SQL Server Mistakes
Dynamics AX Performance
Hitting the SQL Server “Go Faster” Button
Configuring SQL Server
Wellington, SQLSaturday#706
Turbo-Charged Transaction Logs
TEMPDB – INTERNALS AND USAGE
Configuring SQL Server
Oracle Memory Configuration on Windows Server
It’s TEMPDB Why Should You Care?
Chapter 11 Database Performance Tuning and Query Optimization
Presentation transcript:

TOP 10 Thinks you shouldn’t do with/in your database 30 March 2010 TOP 10 Thinks you shouldn’t do with/in your database Margarita Naumova Microsoft Thank you for this session, you were the initiators, your feedback

Top 10 … on focus today Memory Configuration Worst Practices TempDB configuration worst practices TempDB Usage worst practices

MaxServerMemory Configuration Mistakes Set MaxServerMemory to physical Maximum Do not set MaxServerMemory At All All threads/processes outside SQL Server BufferPool are slow or cannot start at all: Not enough buffers for SSIS Packages, releasing buffer waits Linked Server and distributed query issues performance or execution errors Connection/SQL Server Login Time-Outs (Errors 70x) Error "WARNING: Failed to reserve contiguous memory of Size= 65536." Results:

The way it works 0xFFFFFFFF Operating System 0xC0000000 SQL Server Buffer Pool (8KB buffers) SQL Server or OS (/3GB switch) MemToLeave area Thread stacks

The way it works 0xFFFFFFFF Operating System 0xC0000000 SQL Server or OS (/3GB switch) SQL Server MemToLeave area Thread stacks Other Locks Query Workspace. Plan Cache DB Page Cache MaxServerMemory

Recommendations Always define MaxServerMemory! Take into account MemToLeave area MemToLeave = MemReserved + (NumThreads* StackSize) MemReserved = 256 MB NumThreads = the total number of worker threads configured (table below) StackSize = (0.5MB x86, 2MB x64, 4MB IA64) Example 8Cores, 64Bit: MemToLeave=256+576*2=1,408MB

Recommendations Calculate worst case scenario Scenario Examle: 64bit, 8 cores, 32GB RAM 2GB for the OS 2 GB for MemToLeave (Linked Srvs, MultiPage Allocators AND worker threads) 1GB for backup program = 5GB Set Max Server Memory to 27GB Special Attention to MultiInstance Cluster Configuration!

-3GB/AWE configuration mistakes Set /3G when there are other Applications on the server /AWE and large buffer flushes The SQL Server needs more memory because it takes all and still works slowly. I set /3G and I set AWE switch but: The OS is hanging, the overall Server is hanging I still do not get performance benefit Results:

The way it works - /3GB 0xFFFFFFFF Operating System 0xC0000000 SQL Server or OS (/3GB switch) SQL Server MemToLeave area Thread stacks Other Locks Query Workspace. Plan Cache DB Page Cache

The way it works - AWE 0xFFFFFFFF Operating System 0xC0000000 SQL Server or OS (/3GB switch) SQL Server MemToLeave area Thread stacks Other Locks Query Workspace. Plan Cache DB Page Cache AWE Memory

Recommendations Use /3GB only in 32bit platforms and only when you have not database page buffer related memory issues Use AWE on 32-bit to increase DB Pages BufferPool Size if you have intensive BPool Page Usage Watch out Memory\Free System Page Table Entries counter (should be >10 000) /USERVA switch in Windows Server 2003 Gives less than 3GB to user mode Extra space kept in reserve for System PTEs Recommended values between 2900 and 3030 Do not use /PAE with /3GB (it increases PTE from 4K to 8K)

The LockPagesInMemory Mistakes LockPagesInMemory Not set The performance of SQL Server decreases suddenly. A computer that is running SQL Server stops responding for a short time. A time-out occurs for applications that connect to SQL Server. Problems occur when you run even simple commands or use applications on the system New message from 2005 SP2: “A significant part of sql server process memory has been paged out. This may result in a performance degradation. Duration: 646 seconds. Working set (KB): 901904, committed (KB): 2215752, memory utilization: 40%.”

The way it works - LockPagesInMemory Prevent OS paging of Buffer Pool by Locking Pages in Memory Automatic if SQL Server Service Account has Lock Pages in Memory privilege Enterprise and Standard Edition Feature Set using gpedit.msc: http://msdn2.microsoft.com/en-us/library/aa198229(SQL.80).aspx Note: Other parts of SQL may still be paged, along with other applications

Recommendations On 64bit configuration always set LockPagesInMemory Use with MaxServerMemory SQL Server 2008 SP1 CU2 and SQL Server 2005 SP3 CU 4 for Standard Editions For the LocalSystem account it is set automatically Note For 64-bit editions of SQL Server, only SQL Server Enterprise Edition can use the Lock pages in memory user right. This is applicable for SQL Server 2005 [RTM, SP1, SP2, SP3] and for SQL Server 2008 [RTM and SP1]. SQL Server 2008 SP1 Cumulative Update 2 and SQL Server 2005 SP3 Cumulative Update 4 introduce support for SQL Server Standard editions to use the Lock pages in memory user right

DEMO: Get the Memory Statistics Observer Memory Usage DBCC MEMORYSTATUS Query Memory Objects Small Query Memory Objects sys.dm_os_wait_stats RESOURCE_SEMAPHORE http://support.microsoft.com/kb/907877 http://blogs.msdn.com/slavao/archive/2005/02/14/372309.aspx --Obtain memory Info select * from sys.dm_os_sys_info DBCC MemoryStatus select * from sys.dm_os_memory_clerks select * from sys.dm_os_performance_counters --Target v/s Total --Woru memory

The TempDB configuration mistakes Usage  Wrong DB File Sizing Contention  Wrong Number of DB Files Placement  Wrong Drive Issues: Slow Execution of procedures Slow execution on large queries Disruption/Prevent procedure from completion 1101- insufficient space for session 1105 – insufficient space for session 3959 – version store is full 3967 – version store forced to shrink 3958 – transaction cannot find required version record … Too much or too less (1) TempDB Database File Confuse TempDB Performance and contention Extreme TempDB usage for large temp objects, and object generating volumes TempDB Size left default Temp Tables v/s temp variables v/s … huge user temp objects

Contention defined On TempTables Creation latching tempdb PFS SGAM 4 GB latching

DEMO: TempDB Contention

User Objects User-defined tables and indexes System tables and indexes Global temporary tables and indexes Local temporary tables and indexes Table variables Tables returned in table-valued functions Scoped to session or stored procedure

Temp Tables v/s temp Variables Common myth that table variables are memory-based only Both end up hitting tempdb Temp Tables Can be indexed Can have statistics Colmodctr can cause recompiles Table Variables No indexes or statistics No recompile threshold

Internal Objects Not logged Work tables for cursor operations Work tables for spool operations Temporary large object storage Work files for hash join or hash aggregate operations Intermediate sort results for creating/rebuilding indexes (if SORT_IN_TEMPDB) or some GROUP BY, ORDER BY or UNION queries

Sort Warnings Reason: large sort operation within a query (ORDER BY) Sort Operation cannot be done into memory and has to be divided into more steps Sort takes multiple passes to TempDB to get the sorted output

Hash Warnings Hash Occursion/hash bailout has occurred during hash operation Hash Join or Hash aggregate has run out of memory and been force to split to disk during execution Slower query perf and space consumtion increase in TempDB

DEMO: TempTables/TempVariables

Recommendations Minimize use of temporary tables Avoid Static Cursors usage Watch out usage of LOB, Index to avoid worktables/workfiles Set the size appropriately for production Enable autogrow Use Instant File Initialization Set Number of files to ½ to ¼ CPUs but <=8 Set equal file sizes Place separately Separate drive for Files and Log Fast IOPS drive

Recommendations (cont) Minimize large sort operations trough: Reducing the sort inputs Reducing the fields in ORDER BY clause Creating appropriate index Minimize Hash Joins Make sure that statistics exist on the columns that are involved in the hashing operation Try updating them Try using different type of JOIN (nested loop, merge)

Top 10 thinks you should do with/in your database (server) Session Summary Don’t miss MaxServerMemory Don’t use /3GB and /AWE for 32bit platforms just because you guess that SQL server needs more Memory Don’t miss the LockPagesInMemory on 64bit platform Don’t confuse TempDB performance with contention Don’t use too much/few TempDB Data Files Don’t leave TempDB File Size default. Size properly Don’t just use TempTables or TempVariables. Choose properly Don’t use Static Cursors Don’t do large ORDER BY Avoid Large Inputs, groupings causing hash operations

Please Complete The Evaluations! Your Feedback and comments COUNT! Thank you! Contact me further: 31 March 2010, 16:15 – 17:15, SQL Server Unplugged Or any time at: e-mail: Margarita.Naumova@microsoft.com Magi_Naumova@hotmail.com Please Complete The Evaluations! Your Feedback and comments COUNT!

Community Booth Become part of our technological communities Network with colleagues and experts Ask the Experts sessions Exhibition Area Level -1 Photo (cc-by-sa) Chris Radcliff @ Flickr