Jan 13, 2016
Microsoft SQL Server 2008 Nine Months Post-Release: Best Practices and Lessons Learned Amit Shukla, Michael Wang
SQL Server Engineering TeamMicrosoftSession Code: DAT201
Agenda
Best practicesConnect with SQL Server product teamSQL Server Futures
Part I: Building great solutions using an increasingly feature rich product is hard!
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
Turn on Data Compression
Row Page
Compression white paper
The general guideline is to use “ROW” compression for OLTP
2% - 5% CPU
20% Compression
Compression white paper
The general guideline is to use “PAGE” compression for Data Warehousing
10% - 15% CPU
60% - 70% Compression
Compression white paper Data Warehousing white paper
Backup compression
Backup Size Backup Time Restore Time0
1
2
3
4
5
6
No CompressionCompression
Backup Compression
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
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
Predictable Performance and Concurrency
Lock EscalationPlan FreezingAd hoc workloads
Details of lock escalation
Partition level lock escalation
Use improved Plan Freezing mechanisms
Understanding plan guides
Use improved Plan Freezing mechanisms
Understanding plan guides
Use improved Plan Freezing mechanisms
Understanding plan guides
Optimize SQL Server 2008 for ad hoc workloads
Use Sparse Columns to store data efficiently
Optimize NULLs
White paper
Use Filtered Indexes to improve query performance by indexing efficiently
White paper
Use TVP to perform large data set loading
White paper
Batching
Some resources that will help you make informed decisions
Use the best practices site to learn how to take advantage of new features
http://technet.microsoft.com/en-us/sqlserver/bb331794.aspx
The site contains whitepapers
More white papers at:http://www.microsoft.com/sqlserver/2008/en/us/white-papers.aspxhttp://sqlcat.com/whitepapers/default.aspx
Part II: How can I get SQL Server to help me?
The product team seems to operate in isolation
Tell us what you want in the product
Use some of the large variety of ways to communicate with the product team
Enhancements to the OVER clause are popular
Use Other Feedback Channels
TLC is the feedback mechanism at TechEd
Ask your questions using MSDN Forums
Use Formal Feedback Channels
Visit our customer lab
Get invited to a System Design Review
Sign up for our TAP program
Our automated data gathering identifies feature usage and bugs
You can opt-in for anonymous & automated gathering of feature usage
Some 2008 feature usage collected: Editions and hardware configuration
SQL Server 2008: Data type usage
Increasing usage
Sparse
Time
Geometry
Geography
Date
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)
You can opt-in to report crashes and unexpected errors
Bugs are automatically filed by Watson and tracked by bucket and IP address
Bugs appear in Product team’s bug database automatically
In SQL Server 2008 we took some of your feedback to heart
We incorporated some developer delighters that weren’t even in the plan!
You can now declare and set a variableOLD
DECLARE @v INT;SET @v = 5;
NEWDECLARE @v INT = 5;
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 *, -, /
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');
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;
Part III: Give you a glimpse into what is coming up in SQL Server 2008 R2
2008 R2 will have support for 256 logical processors
2008 R2 will support Unicode compression
Compress
Themes That Remain Unchanged From Release to Release
Enterprise data platform
Dynamic development
Beyond Relational
Pervasive Insight
Summary
Best practicesConnect with SQL Server product teamSQL Server Futures
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!
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
question & answer
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.
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
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
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
Complete an evaluation on CommNet and enter to win!
© 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.