Top Banner
65

Amit Shukla, Michael Wang SQL Server Engineering Team Microsoft Session Code: DAT201.

Jan 13, 2016

Download

Documents

Evan Owen
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Amit Shukla, Michael Wang SQL Server Engineering Team Microsoft Session Code: DAT201.
Page 2: Amit Shukla, Michael Wang SQL Server Engineering Team Microsoft Session Code: DAT201.

Microsoft SQL Server 2008 Nine Months Post-Release: Best Practices and Lessons Learned Amit Shukla, Michael Wang

SQL Server Engineering TeamMicrosoftSession Code: DAT201

Page 3: Amit Shukla, Michael Wang SQL Server Engineering Team Microsoft Session Code: DAT201.

Agenda

Best practicesConnect with SQL Server product teamSQL Server Futures

Page 4: Amit Shukla, Michael Wang SQL Server Engineering Team Microsoft Session Code: DAT201.

Part I: Building great solutions using an increasingly feature rich product is hard!

Page 5: Amit Shukla, Michael Wang SQL Server Engineering Team Microsoft Session Code: DAT201.

You are looking for guidance on how to best architect your applications

difficult to pick the right technologies for your applicationLearn how to better integrate SQL Server 2008 features into common scenarios

Page 6: Amit Shukla, Michael Wang SQL Server Engineering Team Microsoft Session Code: DAT201.

Turn on Data Compression

Row Page

Compression white paper

Page 7: Amit Shukla, Michael Wang SQL Server Engineering Team Microsoft Session Code: DAT201.

The general guideline is to use “ROW” compression for OLTP

2% - 5% CPU

20% Compression

Compression white paper

Page 8: Amit Shukla, Michael Wang SQL Server Engineering Team Microsoft Session Code: DAT201.

The general guideline is to use “PAGE” compression for Data Warehousing

10% - 15% CPU

60% - 70% Compression

Compression white paper Data Warehousing white paper

Page 9: Amit Shukla, Michael Wang SQL Server Engineering Team Microsoft Session Code: DAT201.

Backup compression

Backup Size Backup Time Restore Time0

1

2

3

4

5

6

No CompressionCompression

Backup Compression

Page 10: Amit Shukla, Michael Wang SQL Server Engineering Team Microsoft Session Code: DAT201.

Use Resource Governor to prevent runaway queries

Resource Governor by Example

Backup

Admin Tasks

OLTP Activity

High

Admin Workload OLTP Workload

Min Memory 10%Max Memory 20%

Max CPU 20%

Max CPU 90%

Admin Pool Application Pool

Page 11: Amit Shukla, Michael Wang SQL Server Engineering Team Microsoft Session Code: DAT201.

Use MERGE for ETL

SQL Server 2005 SQL Server 2008MERGE StockTable stUSING TradesTable ttON st.stock = tt.stockWHEN MATCHED THEN UPDATE SET st.quantity += tt.quantityWHEN NOT MATCHED THEN INSERT (stock, quantity) VALUES (tt.stock, tt.quantity);

IF StockTable contains stock UPDATE quantity from TradesTableELSE INSERT row into StockTable

How to use MERGE

Page 12: Amit Shukla, Michael Wang SQL Server Engineering Team Microsoft Session Code: DAT201.

Predictable Performance and Concurrency

Lock EscalationPlan FreezingAd hoc workloads

Page 13: Amit Shukla, Michael Wang SQL Server Engineering Team Microsoft Session Code: DAT201.

Details of lock escalation

Partition level lock escalation

Page 14: Amit Shukla, Michael Wang SQL Server Engineering Team Microsoft Session Code: DAT201.

Use improved Plan Freezing mechanisms

Understanding plan guides

Page 15: Amit Shukla, Michael Wang SQL Server Engineering Team Microsoft Session Code: DAT201.

Use improved Plan Freezing mechanisms

Understanding plan guides

Page 16: Amit Shukla, Michael Wang SQL Server Engineering Team Microsoft Session Code: DAT201.

Use improved Plan Freezing mechanisms

Understanding plan guides

Page 17: Amit Shukla, Michael Wang SQL Server Engineering Team Microsoft Session Code: DAT201.

Optimize SQL Server 2008 for ad hoc workloads

Page 18: Amit Shukla, Michael Wang SQL Server Engineering Team Microsoft Session Code: DAT201.

Use Sparse Columns to store data efficiently

Optimize NULLs

White paper

Page 19: Amit Shukla, Michael Wang SQL Server Engineering Team Microsoft Session Code: DAT201.

Use Filtered Indexes to improve query performance by indexing efficiently

White paper

Page 20: Amit Shukla, Michael Wang SQL Server Engineering Team Microsoft Session Code: DAT201.

Use TVP to perform large data set loading

White paper

Batching

Page 21: Amit Shukla, Michael Wang SQL Server Engineering Team Microsoft Session Code: DAT201.

Some resources that will help you make informed decisions

Page 22: Amit Shukla, Michael Wang SQL Server Engineering Team Microsoft Session Code: DAT201.

Use the best practices site to learn how to take advantage of new features

http://technet.microsoft.com/en-us/sqlserver/bb331794.aspx

Page 23: Amit Shukla, Michael Wang SQL Server Engineering Team Microsoft Session Code: DAT201.

The site contains whitepapers

More white papers at:http://www.microsoft.com/sqlserver/2008/en/us/white-papers.aspxhttp://sqlcat.com/whitepapers/default.aspx

Page 24: Amit Shukla, Michael Wang SQL Server Engineering Team Microsoft Session Code: DAT201.
Page 25: Amit Shukla, Michael Wang SQL Server Engineering Team Microsoft Session Code: DAT201.

Part II: How can I get SQL Server to help me?

Page 26: Amit Shukla, Michael Wang SQL Server Engineering Team Microsoft Session Code: DAT201.

The product team seems to operate in isolation

Page 27: Amit Shukla, Michael Wang SQL Server Engineering Team Microsoft Session Code: DAT201.

Tell us what you want in the product

Use some of the large variety of ways to communicate with the product team

Page 28: Amit Shukla, Michael Wang SQL Server Engineering Team Microsoft Session Code: DAT201.
Page 29: Amit Shukla, Michael Wang SQL Server Engineering Team Microsoft Session Code: DAT201.

Enhancements to the OVER clause are popular

Page 30: Amit Shukla, Michael Wang SQL Server Engineering Team Microsoft Session Code: DAT201.
Page 31: Amit Shukla, Michael Wang SQL Server Engineering Team Microsoft Session Code: DAT201.

Use Other Feedback Channels

Page 32: Amit Shukla, Michael Wang SQL Server Engineering Team Microsoft Session Code: DAT201.

TLC is the feedback mechanism at TechEd

Page 33: Amit Shukla, Michael Wang SQL Server Engineering Team Microsoft Session Code: DAT201.

Ask your questions using MSDN Forums

Page 34: Amit Shukla, Michael Wang SQL Server Engineering Team Microsoft Session Code: DAT201.

Use Formal Feedback Channels

Page 35: Amit Shukla, Michael Wang SQL Server Engineering Team Microsoft Session Code: DAT201.

Visit our customer lab

Page 36: Amit Shukla, Michael Wang SQL Server Engineering Team Microsoft Session Code: DAT201.

Get invited to a System Design Review

Page 37: Amit Shukla, Michael Wang SQL Server Engineering Team Microsoft Session Code: DAT201.

Sign up for our TAP program

Page 38: Amit Shukla, Michael Wang SQL Server Engineering Team Microsoft Session Code: DAT201.

Our automated data gathering identifies feature usage and bugs

Page 39: Amit Shukla, Michael Wang SQL Server Engineering Team Microsoft Session Code: DAT201.

You can opt-in for anonymous & automated gathering of feature usage

Page 40: Amit Shukla, Michael Wang SQL Server Engineering Team Microsoft Session Code: DAT201.

Some 2008 feature usage collected: Editions and hardware configuration

Page 41: Amit Shukla, Michael Wang SQL Server Engineering Team Microsoft Session Code: DAT201.

SQL Server 2008: Data type usage

Increasing usage

Sparse

Time

Geometry

Geography

Date

Page 42: Amit Shukla, Michael Wang SQL Server Engineering Team Microsoft Session Code: DAT201.

SQL Server 2008: Objects per database

SQL S

tored-Pro

cedure

Table (Use

r-defined)

Primary-

key c

onstraint

Fore

ign-key c

onstraint

CLR Trig

ger (only

DML)

CLR Sc

alar-Functi

on

CLR St

ored-Pro

cedure

CLR Aggre

gate Functi

on

CLR Table-va

lued Functi

on0

50

100

150

200

250

Number of objects per database(Enterprise edition servers, with >10GB of data)

Page 43: Amit Shukla, Michael Wang SQL Server Engineering Team Microsoft Session Code: DAT201.

You can opt-in to report crashes and unexpected errors

Page 44: Amit Shukla, Michael Wang SQL Server Engineering Team Microsoft Session Code: DAT201.

Bugs are automatically filed by Watson and tracked by bucket and IP address

Page 45: Amit Shukla, Michael Wang SQL Server Engineering Team Microsoft Session Code: DAT201.

Bugs appear in Product team’s bug database automatically

Page 46: Amit Shukla, Michael Wang SQL Server Engineering Team Microsoft Session Code: DAT201.

In SQL Server 2008 we took some of your feedback to heart

Page 47: Amit Shukla, Michael Wang SQL Server Engineering Team Microsoft Session Code: DAT201.

We incorporated some developer delighters that weren’t even in the plan!

Page 48: Amit Shukla, Michael Wang SQL Server Engineering Team Microsoft Session Code: DAT201.

You can now declare and set a variableOLD

DECLARE @v INT;SET @v = 5;

NEWDECLARE @v INT = 5;

Page 49: Amit Shukla, Michael Wang SQL Server Engineering Team Microsoft Session Code: DAT201.

You now have to type fewer characters when adding a variable to itself

OLD

UPDATE TblSET c1 = c1 + 5WHERE c1 < 10;

NEW

UPDATE TblSET c1 += 5WHERE c1 < 10;

This also works for *, -, /

Page 50: Amit Shukla, Michael Wang SQL Server Engineering Team Microsoft Session Code: DAT201.

We made inserting multiple rows into a table much easierOLDINSERT INTO @customers (custid,name) VALUES (1, 'cust 1');INSERT INTO @customers (custid,name) VALUES (2, 'cust 2');INSERT INTO @customers (custid,name) VALUES (3, 'cust 3');INSERT INTO @customers (custid,name) VALUES (4, 'cust 4');INSERT INTO @customers (custid,name) VALUES (5, 'cust 5'); 

NEWINSERT INTO @customers (custid, name) VALUES (1, 'cust 1'), (2, 'cust 2'), (3, 'cust 3'), (4, 'cust 4'), (5, 'cust 5');

Page 51: Amit Shukla, Michael Wang SQL Server Engineering Team Microsoft Session Code: DAT201.

We made using a constant table super easy as well!OLD NEW

SELECT *FROM ( VALUES (1, 'cust 1'), (2, 'cust 2'), (3, 'cust 3'), (4, 'cust 4'), (5, 'cust 5') ) MyCustomers(custid, name);

DECLARE @customers TABLE (custid INT, name VARCHAR(20)) INSERT INTO @customers (custid,name) VALUES (1, 'cust 1');INSERT INTO @customers (custid,name) VALUES (2, 'cust 2');INSERT INTO @customers (custid,name) VALUES (3, 'cust 3');INSERT INTO @customers (custid,name) VALUES (4, 'cust 4');INSERT INTO @customers (custid,name) VALUES (5, 'cust 5'); SELECT *FROM @customers;

Page 52: Amit Shukla, Michael Wang SQL Server Engineering Team Microsoft Session Code: DAT201.

Part III: Give you a glimpse into what is coming up in SQL Server 2008 R2

Page 53: Amit Shukla, Michael Wang SQL Server Engineering Team Microsoft Session Code: DAT201.

2008 R2 will have support for 256 logical processors

Page 54: Amit Shukla, Michael Wang SQL Server Engineering Team Microsoft Session Code: DAT201.

2008 R2 will support Unicode compression

Compress

Page 55: Amit Shukla, Michael Wang SQL Server Engineering Team Microsoft Session Code: DAT201.

Themes That Remain Unchanged From Release to Release

Enterprise data platform

Dynamic development

Beyond Relational

Pervasive Insight

Page 56: Amit Shukla, Michael Wang SQL Server Engineering Team Microsoft Session Code: DAT201.

Summary

Best practicesConnect with SQL Server product teamSQL Server Futures

Page 57: Amit Shukla, Michael Wang SQL Server Engineering Team Microsoft Session Code: DAT201.

Call to Action

Get in touch with the SQL Development TeamLeverage the mechanisms available to provide feedback to MicrosoftParticipate in the Customer Experience Improvement Program, Error ReportingVisit TLC – we want to hear from you!

Leverage the “Delighters” in SQL Server 2008

Help us make SQL Server even better.Help us make SQL Server work for you!

Page 58: Amit Shukla, Michael Wang SQL Server Engineering Team Microsoft Session Code: DAT201.

SQL Server Word of the Day

POLICY-BASEDMANAGEMENT

Monday, May 11

*Game cards may be picked up at the SQL Server booths in the TLC

Page 59: Amit Shukla, Michael Wang SQL Server Engineering Team Microsoft Session Code: DAT201.

question & answer

Page 60: Amit Shukla, Michael Wang SQL Server Engineering Team Microsoft Session Code: DAT201.

SQL Server Community Resources

Become a FREE PASS Member: www.sqlpass.org/RegisterforSQLPASS.aspxLearn more about the PASS organization www.sqlpass.org/

Additional Community ResourcesSQL Server Community Center www.microsoft.com/sqlserver/2008/en/us/community-center.aspxTechNet Community for IT Professionalshttp://technet.microsoft.com/en-us/sqlserver/bb671048.aspxDeveloper Center http://msdn.microsoft.com/en-us/sqlserver/bb671064.aspxSQL Server 2008 Learning Portalhttp://www.microsoft.com/learning/sql/2008/default.mspx

• Connect: Local Chapters, Special Interest Groups, Online Community• Share: PASSPort Social Networking, Community Connection Event• Learn: PASS Summit Annual Conference, Technical Articles, Webcasts

• More about the PASS organization www.sqlpass.org/

The Professional Association for SQL Server (PASS) is an independent, not-for-profit association, dedicated to supporting, educating, and promoting the Microsoft SQL Server community.

Page 61: Amit Shukla, Michael Wang SQL Server Engineering Team Microsoft Session Code: DAT201.

Additional ResourcesExternal Resources

http://sqlcat.comhttp://blogs.msdn.com/sqlcathttp://blogs.msdn.com/mssqlisvhttp://technet.microsoft.com/en-us/sqlserver/bb331794.aspxwww.sqlserverinternals.com/books.html

SQL Server 2008 Business Value Calculator: www.moresqlserver.com

Page 62: Amit Shukla, Michael Wang SQL Server Engineering Team Microsoft Session Code: DAT201.

Related ContentDAT320-Breakout: Optimizing Microsoft SQL Server 2008 Applications Using Table Valued Parameters, XML, and MERGE

DAT04-TLC: Using the HIERARCHYID Datatype in Microsoft SQL Server 2008 to Maintain and Query Hierarchies

DAT313-Breakout: Inside T-SQL: 2008 Enhancements, Techniques, Tips & Tricks

DAT304-Breakout: Auditing in Microsoft SQL Server 2008

DAT321-Breakout: Taking Your Database beyond Relations with Microsoft SQL Server 2008

DAT302-Breakout: All You Need to Know about Microsoft SQL Server 2008 Failover Clusters

DAT317-Breakout: Microsoft SQL Server 2008 Data Warehousing by Demonstration

Page 63: Amit Shukla, Michael Wang SQL Server Engineering Team Microsoft Session Code: DAT201.

www.microsoft.com/teched

Sessions On-Demand & Community

http://microsoft.com/technet

Resources for IT Professionals

http://microsoft.com/msdn

Resources for Developers

www.microsoft.com/learningMicrosoft Certification and Training Resources

www.microsoft.com/learning

Microsoft Certification & Training Resources

Resources

Page 64: Amit Shukla, Michael Wang SQL Server Engineering Team Microsoft Session Code: DAT201.

Complete an evaluation on CommNet and enter to win!

Page 65: Amit Shukla, Michael Wang SQL Server Engineering Team Microsoft Session Code: DAT201.

© 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS,

IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.