Graeme Malcolm | Data Technology Specialist, Content Master

Slides:



Advertisements
Similar presentations
Module 13: Performance Tuning. Overview Performance tuning methodologies Instance level Database level Application level Overview of tools and techniques.
Advertisements

new database engine component fully integrated into SQL Server 2014 optimized for OLTP workloads accessing memory resident data achive improvements.
Project “Hekaton” adds in-memory technology to boost performance of OLTP workloads in SQL Server.
Dandy Weyn Sr. Technical Product Mkt.
Fundamentals, Design, and Implementation, 9/e Chapter 11 Managing Databases with SQL Server 2000.
Brian Alderman | MCT, CEO / Founder of MicroTechPoint Pete Harris | Microsoft Senior Content Publisher.
A Guide to MySQL 3. 2 Objectives Start MySQL and learn how to use the MySQL Reference Manual Create a database Change (activate) a database Create tables.
Chapter Oracle Server An Oracle Server consists of an Oracle database (stored data, control and log files.) The Server will support SQL to define.
DBSQL 14-1 Copyright © Genetic Computer School 2009 Chapter 14 Microsoft SQL Server.
Course Topics Administering SQL Server 2012 Jump Start 01 | Install and Configure SQL Server04 | Manage Data 02 | Maintain Instances and Databases05 |
Chokchai Junchey Microsoft Product Specialist Certified Technical Training Center.
Graeme Malcolm | Senior Content Developer, Microsoft Geoff Allix | Principal Technologist, Content Master.
Applications hitting a wall today with SQL Server Locking/Latching Scale-up Throughput or latency SLA Applications which do not use SQL Server.
SQL Server 2014 adds in-memory technology to boost performance of OLTP workloads.
IN-MEMORY OLTP By Manohar Punna SQL Server Geeks – Regional Mentor, Hyderabad Blogger, Speaker.
Meet Kevin Liu Principal Lead Program Manager Kevin Liu has been with Microsoft and the SQL Server engine team for 7 years, working on key projects like.
Connect with life Vinod Kumar Technology Evangelist - Microsoft
A Guide to SQL, Eighth Edition Chapter Six Updating Data.
Vedran Kesegić. About me  M.Sc., FER, Zagreb  HRPro d.o.o. Before: Vipnet, FER  13+ years with SQL Server (since SQL 2000)  Microsoft Certified.
Doing fast! Optimizing Query performance with ColumnStore Indexes in SQL Server 2012 Margarita Naumova | SQL Master Academy.
Best Practices for Columnstore Indexes Warner Chaves SQL MCM / MVP SQLTurbo.com Pythian.com.
Introducing Hekaton The next step in SQL Server OLTP performance Mladen Prajdić
Memory-Optimized Tables Querying at the speed of light.
3 A Guide to MySQL.
Standard/Express edition
In-Memory Capabilities
Temporal Databases Microsoft SQL Server 2016
System Center Marketing
Introduction to Tabular Data Models
Using DML to Modify Data
Operational Analytics in SQL Server 2016 and Azure SQL Database
20761A Querying Data with Transact-SQL.
Temporal Databases Microsoft SQL Server 2016
6/16/2018 © 2014 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks.
6/19/2018 © 2014 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks.
UFC #1433 In-Memory tables 2014 vs 2016
What’s New in SQL Server 2016 Master Data Services
A Technical Overview of Microsoft® SQL Server™ 2005 High Availability Beta 2 Matthew Stephen IT Pro Evangelist (SQL Server)
Deploying and Configuring SSIS Packages
20761A 10: Using Subqueries Module 10   Using Subqueries.
9/11/2018 © 2014 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks.
SQL Server In-Memory Internals
Introduction to SQL Server Management for the Non-DBA
Automating SQL Server Management
Database Performance Tuning and Query Optimization
Designing Database Solutions for SQL Server
SQL Server 2014 In-Memory Overview
A developers guide to Azure SQL Data Warehouse
මොඩියුල විශ්ලේෂණය Buffer Pool Extension භාවිතය.
SQL Server Optimizing Query Plans
07 | Analyzing Big Data with Excel
Super Scaling The LMAX Queue Pattern.
Migrating a Disk-based Table to a Memory-optimized one in SQL Server
20761B 12: Using Set Operators Module 12   Using Set Operators.
In-Memory OLTP (IMOLTP) What Can It Do For Me?
Real world In-Memory OLTP
SQL 2014 In-Memory OLTP What, Why, and How
TechEd /23/ :44 AM © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered.
A developers guide to Azure SQL Data Warehouse
TechEd /24/2018 6:19 AM © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered.
Module 12: Implementing an Analysis Services Tabular Data Model
Microsoft Virtual Academy
Microsoft SQL Server 2014 for Oracle DBAs Module 7
Statistics for beginners – In-Memory OLTP
In-Memory OLTP for Database Developers
Chapter 11 Database Performance Tuning and Query Optimization
Chapter 11 Managing Databases with SQL Server 2000
04 | Always On High Availability
05 | Processing Big Data with Hive
06 | SQL Server and the Cloud
Presentation transcript:

Updating your Database Management Skills to Microsoft® SQL Server® 2014 Jump Start Graeme Malcolm | Data Technology Specialist, Content Master Pete Harris | Learning Product Planner, Microsoft

Graeme Malcolm | ‏@graeme_malcolm Microsoft Data Platform Specialist Consultant, trainer, and author since SQL Server 4.2 One of the world’s first MCSEs in SQL Server 2012 BI (Fairly) regular blogger at www.contentmaster.com Longstanding partner with Microsoft Lead author for Microsoft Official Curriculum SQL Server 2014 courses Contributing author of Patterns and Practices Guide to Big Data Author of numerous training courses and Microsoft Press titles since SQL Server 7.0

Pete Harris | @SQLPete Learning Product Planner Various roles at Microsoft since 1995

Join the MVA Community! Microsoft Virtual Academy Free online learning tailored for IT Pros and Developers Over 1M registered users Up-to-date, relevant training on variety of Microsoft products

Course Topics Updating your Database Management Skills to Microsoft® SQL Server® 2014 01 | Making the Most of Memory 04 | Always On High Availability 02 | Mastering Your Data 05 | Managing Security 03 | Managing Data Quality 06 | SQL Server and the Cloud

Setting Expectations Target Audience Database professionals familiar with SQL Server 2008 Suggested Prerequisites/Supporting Material Experience managing SQL Server 2008 databases Familiarity with Transact-SQL

The Road to SQL Server 2014 SQL Server 2014 2008 2010 2012 2014 Audit Compression Change Data Capture Data Collector Resource Governor Policy-Based Management PowerShell provider Spatial Data Filestream Data SQL Server 2008 R2 Multi-Server Admin Data-Tier Applications PowerPivot Report Builder 2.0 Master Data Services Prepared Instances StreamInsight SQL Server 2012 AlwaysOn High Availability Columnstore Indexes Contained databases User-Defined Server Roles Data Quality Services SSAS Tabular Mode SSIS Catalog SSRS Power View SSRS Data Alerts Deploy to SQL Azure SQL Server 2014 Windows Server 2008 Windows Server 2012 Windows Server 2012 R2 OS Windows Server 2008 R2 System Center 2007 System Center 2012 System Center 2012 R2 SQL Database Services (REST) SQL Azure Windows Azure SQL Database Azure Marketplace Data Market SQL Server in VMs Windows Azure HDInsight Office 2007 Data Mining Add-Ins (Excel) Office 2010 PowerPivot (Excel/SP) Office 2013 Power View(Excel) O365 Power BI Office Power Query Power Map Shared Queries Q&A MDS Add-in (Excel)

01 | Making the Most of Memory Graeme Malcolm | Data Technology Specialist, Content Master Pete Harris | Learning Product Planner, Microsoft

Module Overview The Buffer Pool Extension Columnstore Indexes Memory-Optimized Tables

Buffer Pool Extension Extends buffer cache to non- volatile storage Improves performance for read- heavy OLTP workloads SSD devices are often more cost- effective than adding physical memory Simple configuration with no changes to existing applications. Data files (Disk) Buffer cache (RAM) Buffer pool extension (SSD) Pages Clean Pages

Demo: The Buffer Pool Extension In this demonstration, you will see how to: Enable the Buffer Pool Extension Verify Buffer Pool Extension Configuration Disable the Buffer Pool Extension

Columnstore Indexes In-memory, compressed data in pages based on columns instead of rows Row Store Column Store ProductID OrderDate Cost 310 20010701 2171.29 311 1912.15 312 20010702 313 413.14 ProductID 310 311 312 313 314 315 316 317 318 319 320 321 OrderDate 20010701 … 20010702 20010703 20010704 Cost 2171.29 1912.15 413.14 333.42 1295.00 4233.14 641.22 24.95 64.32 1111.25 Data page 1000 ProductID OrderDate Cost 314 20010701 333.42 315 1295.00 316 20010702 4233.14 317 641.22 Data page 1001 Data page 2000 Data page 2001 Data page 2002

Types of Columnstore Index Clustered Columnstore Indexes SQL Server 2014 Enterprise, Developer, and Evaluation Edition Only Includes all columns in the table Only index on the table Optimizes storage for compression and performance Updatable Non-Clustered Columnstore Indexes Includes some or all columns in the table Can be combined with other indexes Read-Only

Updating Clustered Columnstores ProductID 310 311 312 313 OrderDate 20010701 20010702 Cost 2171.29 1912.15 413.14 Deltastore ProductID OrderDate Cost 314 20010701 2198.56 311 1919.10 316 20010702 403.34 Columnstore A row-based deltastore stores interim changes New rows are inserted into the deltastore until the minimum rowgroup size is reached. Deleted rows in the deltastore are physically deleted. Columnstore data is marked as deleted, and space is reclaimed when the index is rebuilt. Updated rows in the deltastore are modified. Columnstore data is marked as deleted and a new row is added to the deltastore.

Updating Nonclustered Columnstores Drop and recreate columnstore indexes Partition the table and switch in new rows Switched table must have a matching columnstore index Use Trickle Updating: Store only static data in the columnstore table Create a matching delta table for dynamic data rows Use UNION or Common Table Expressions to retrieve data Periodically move stabilized rows from the delta table to the columnstore table using one of the above techniques

Demo: Columnstore Indexes In this demonstration, you will see how to: View Logical Reads for a Query Create a Non-Clustered Columnstore Index Create a Clustered Columnstore Index View Columnstore Index Metadata View Logical Reads for a Query If you did not perform the previous demonstrations in this module, start the MIA-DC and MIA-SQL virtual machines, and log on to MIA-SQL as ADVENTUREWORKS\Student with the password XXXXXXXXXXXXX. Then in the D:\Demofiles\Mod03 folder, right-click Setup.cmd and click Run as administrator. When prompted, click Yes. If it is not already open, start SQL Server Management Studio and connect to the MIA-SQL instance of SQL Server using Windows authentication. Open DWQuery.sql from the D:\Demofiles\Mod03 folder. Note that this script performs the following actions: Runs a query so that the required data is cached for future executions. Sets statistics options on so that details of the query execution can be retrieved. Runs the query again to retrieve the statistics. Sets the statistics options off again. Execute the script, and then wait until execution is complete and two results sets are displayed. On the Messages tab, note the elapsed time in the last line of the statistics report. Create a Non-Clustered Columnstore Index Open ColumnStoreIndex.sql from the D:\Demofiles\Mod03 folder. Select the code under the comment Create a non-clustered columnstore index and click Execute. That this script creates a non-clustered columnstore index on the FactProductInventory table. Return to the DWQuery.sql tab. Then execute the script, and wait until execution is complete and two results sets are displayed. On the Messages tab, note the elapsed time in the last line of the statistics report. This should be significantly lower than the previous execution. Return to the ColumnStoreIndex.sql tab and select the code under the comment Try to insert a row. Then click Execute. Note that an error occurs because you cannot modify a table on which a non-clustered columnstore index has been created. Create a Clustered Columnstore Index Select the code under the comment Drop the non-clustered columnstore index, existing clustered index, and foreign keys, and then click Execute. This drops all of the existing indexes on the table. Select the code under the comment Create a clustered columnstore index and click Execute. This creates a clustered columnstore index on the FactProductInventory table. On the Messages tab, note the elapsed time in the last line of the statistics report. This should still be significantly lower than the first execution. Return to the ColumnStoreIndex.sql tab and select the code under the comment Insert a row. Then click Execute. Note that you can insert data into a clustered columnstore index. View Columnstore Index Metadata Select the code under the comment View row groups and click Execute. Note that this code retrieves information about the columnstore index, and shows that the row you inserted is in a deltastore rowgroup, while the previously existing rows are all compressed in the columnstore.

Memory-Optimized Tables Defined as C structs, compiled into DLLs, and loaded into memory Can be persisted as filestreams, or non-durable Do not apply any locking semantics Can be indexed using hash indexes Can co-exist with disk-based tables Can be queried using Transact-SQL Cannot include some data types, including text, image, and nvarchar(max) Do not support identity columns or foreign key constraints

Memory-Optimized Table Scenarios Optimistic concurrency optimizes latch-bound workloads: Multiple concurrent transactions modify large numbers of rows A table contains “hot” pages Applications should handle conflict errors: Write conflicts Repeatable read validation failures Serializable validation failures Commit dependency failures

Creating Memory-Optimized Tables Add a filegroup for memory-optimized data Create a memory-optimized table ALTER DATABASE MyDB ADD FILEGROUP mem_data CONTAINS MEMORY_OPTIMIZED_DATA; GO ADD FILE (NAME = 'MemData' FILENAME = 'D:\Data\MyDB_MemData.ndf') TO FILEGROUP mem_data; CREATE TABLE dbo.MemoryTable (OrderId INTEGER NOT NULL PRIMARY KEY NONCLUSTERED HASH WITH (BUCKET_COUNT = 1000), OrderDate DATETIME NOT NULL, ProductCode INTEGER NULL, Quantity INTEGER NULL) WITH (MEMORY_OPTIMIZED = ON, DURABILITY = SCHEMA_AND_DATA);

Memory-Optimized Indexes Hash Indexes Rows assigned to buckets based on hashed key Multiple rows in the same bucket form a linked list Effective for equality predicates Query results are not sorted Range Indexes Latch free, in-memory B-Tree structure Effective for range scans, equality predicates, and inequality predicates CREATE TABLE tab1 (col1 INT NOT NULL INDEX h_idx NONCLUSTERED HASH WITH (BUCKET_COUNT = 100)) WITH (MEMORY_OPTIMIZED = ON, DURABILITY = SCHEMA_ONLY) CREATE TABLE tab2 (col1 INT NOT NULL INDEX r_idx NONCLUSTERED) WITH (MEMORY_OPTIMIZED = ON, DURABILITY = SCHEMA_ONLY)

Querying Memory-Optimized Tables Query Interop Interpreted Transact-SQL Enables queries that combine memory-optimized and disk- based tables Native Compilation Stored procedure converted to C and compiled Access to memory-optimized tables only Native Compilation CREATE PROCEDURE… #define __in HRESULT hkp_(… 0110101101 Transact-SQL SELECT t1.col1, t3.col2 FROM Tab1 t1 JOIN Tab2 t2 ON t1.Col1 = t2.col1; Translate to C Compile to DLL Query Interop Memory-Optimized Tables Disk-Based Tables Tab1 Tab2 Tab3 Tab4

Creating Native Stored Procedures Use the CREATE PROCEDURE statement NATIVE_COMPILATION option SCHEMABINDING option EXECUTE AS option BEGIN ATOMIC clause (isolation level and language) CREATE PROCEDURE dbo.DeleteCustomer @CustomerID INT WITH NATIVE_COMPILATION, SCHEMABINDING, EXECUTE AS OWNER AS BEGIN ATOMIC WITH (TRANSACTION ISOLATION LEVEL = SNAPSHOT; LANGUAGE = 'us_English') DELETE dbo.OpenOrders WHERE CustomerID = @CustomerID DELETE dbo.Customer WHERE CustomerID = @CustomerID END;

Demo: Memory-Optimized Tables In this demonstration, you will see how to: Enable Memory-Optimized Tables in a Database Create a Memory-Optimized Table Query Memory-Optimized Tables Create a Natively Compiled Stored Procedure View Memory-Optimized Table Statistics

Module Summary Make the most of memory Use solid state storage to extend the buffer pool Use columnstore indexes for data warehouse workloads Use memory-optimized tables and native stored procedures for latch- bound workloads