Working with Very Large Tables Like a Pro in SQL Server 2017

Slides:



Advertisements
Similar presentations
new database engine component fully integrated into SQL Server 2014 optimized for OLTP workloads accessing memory resident data achive improvements.
Advertisements

IDA / ADIT Lecture 10: Database recovery Jose M. Peña
CSCI 3140 Module 8 – Database Recovery Theodore Chiasson Dalhousie University.
FlareCo Ltd ALTER DATABASE AdventureWorks SET PARTNER FORCE_SERVICE_ALLOW_DATA_LOSS Slide 1.
SQL Server 2005 features for VLDBs. SQL Server 2005 features for VLDBs aka (it’s fixed in the next release)
Meanwhile RAM cost continues to drop Moore’s Law on total CPU processing power holds but in parallel processing… CPU clock rate stalled… Because.
Backup and Recovery Part 1.
Kevin Kline, SQL Sentry Director of Engineering Services, Microsoft SQL Server MVP since 2003 Twitter, Facebook, KEKline.
XVII Encontro – 29/11/2011. Virgílio Esteves ID&T – Research & Founder of NetPonto Coimbra C# / WPF / Silverlight / XNA / Azure.
Chapter 10 : Designing a SQL Server 2005 Solution for High Availability MCITP Administrator: Microsoft SQL Server 2005 Database Server Infrastructure Design.
Managing Multi-User Databases AIMS 3710 R. Nakatsu.
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.
DBMS Transactions and Rollback Recovery Helia / Martti Laiho.
By Lecturer / Aisha Dawood 1.  You can control the number of dispatcher processes in the instance. Unlike the number of shared servers, the number of.
Database Management System Module 5 DeSiaMorewww.desiamore.com/ifm1.
1 Moshe Shadmon ScaleDB Scaling MySQL in the Cloud.
Oracle Advanced Compression – Reduce Storage, Reduce Costs, Increase Performance Session: S Gregg Christman -- Senior Product Manager Vineet Marwah.
7202ICT – Database Administration
SQL Server 2014: Overview Phil ssistalk.com.
1 Chapter Overview Performing Configuration Tasks Setting Up Additional Features Performing Maintenance Tasks.
IN-MEMORY OLTP By Manohar Punna SQL Server Geeks – Regional Mentor, Hyderabad Blogger, Speaker.
Transactions and Locks A Quick Reference and Summary BIT 275.
Srik Raghavan Principal Lead Program Manager Kevin Cox Principal Program Manager SESSION CODE: DAT206.
SQL School is strongly committed to provide COMPLETE PRACTICAL REALTIME Trainings on SQL Server Technologies – Dev, SQL DBA, MSBI (SSIS, SSAS, SSRS) and.
How to Use Parameters Like a Pro …and Boost Performance Guy Glantser, CEO, Madeira.
Transactions, Roles & Privileges Oracle and ANSI Standard SQL Lecture 11.
6 Copyright © 2007, Oracle. All rights reserved. Performing User-Managed Backup and Recovery.
7 Copyright © Oracle Corporation, All rights reserved. Instance and Media Recovery Structures.
October 15-18, 2013 Charlotte, NC Accelerating Database Performance Using Compression Joseph D’Antoni, Solutions Architect Anexinet.
3 Copyright © 2004, Oracle. All rights reserved. Database Architecture Comparison.
SQL Server 2014, more than just in-memory Eric Zierdt.
Putting Your Head in the Cloud Working with SQL Azure David Postlethwaite 19/09/2015David Postlethwaite.
Does the Optimistic Concurrency resolve your blocking problems Margarita Naumova, SQL Master Academy.
SQL Server 2016 – New Features Tilahun Endihnew March 12, 2016.
Making a Difference with Azure Storage Solutions Dudu Sinai.
4 Copyright © 2004, Oracle. All rights reserved. Managing the Oracle Instance.
SQL Server Magic Buttons! What are Trace Flags and why should I care? Steinar Andersen, SQL Service Nordic AB Thanks to Thomas Kejser for peer-reviewing.
SQLintersection Locks, Blocks, and Deadlocks Oh My! Randy Knight Wednesday, 2:15-3:15.
Introducing Hekaton The next step in SQL Server OLTP performance Mladen Prajdić
SQL Server Internals & Architecture Naomi Williams, SQL DBA LinkedIn
Memory-Optimized Tables Querying at the speed of light.
Backups for Azure SQL Databases and SQL Server instances running on Azure Virtual Machines Session on backup to Azure feature (manual and managed) in SQL.

SQL Server Statistics and its relationship with Query Optimizer
In-Memory Capabilities
Curacao SQL Saturday June 11, 2016
Managing Multi-User Databases
Thank You! #sqlsatdnipro Denis
Antonio Abalos Castillo
Hitting the SQL Server “Go Faster” Button
Example of a page header
Chapter Overview Understanding the Database Architecture
Hustle and Bustle of SQL Pages
Working with Very Large Tables Like a Pro in SQL Server 2014
SQL Server 2017 has more cool features than just running on Linux
SQL 2014 In-Memory OLTP What, Why, and How
On transactions, and Atomic Operations
Hidden Gems of SQL Server 2014
The PROCESS of Queries John Deardurff
The 5 Hidden Performance Gems
How to Use Parameters Like a Pro
On transactions, and Atomic Operations
The PROCESS of Queries John Deardurff
Hidden Gems of SQL Server 2014
Hidden Gems of SQL Server 2014
The Complete Guide to Temporary Tables and Table Variables
Using wait stats to determine why my server is slow
The Complete Guide to Temporary Tables and Table Variables
Analyzing Execution Plans
Presentation transcript:

Working with Very Large Tables Like a Pro in SQL Server 2017 Guy Glantser Image courtesy of marin / FreeDigitalPhotos.net

Copyright © 2019 Madeira Ltd All Rights Reserved Full rights, including copyrights, belong exclusively to Madeira Ltd No use of the materials, in any form, is allowed, unless receiving a prior written permission from Madeira Ltd

A Few Words about Me… Name: Guy Glantser Email Address: guy@madeiradata.com Twitter: @guy_glantser Blog: www.linkedin.com/in/glantser/detail/recent-activity/posts Podcast: www.sqlserverradio.com Image courtesy of Mister GC / FreeDigitalPhotos.net

SPONSORS Loyalty Sponsors Gold Sponsors Silver Sponsors Bronze Sponsors

http://bit.ly/2Q9t3ku http://bit.ly/2QePNzE Evaluations EVENT EVALUATION LINK SESSIONS EVALUATION LINK Evaluations http://bit.ly/2Q9t3ku http://bit.ly/2QePNzE

Working with Very Large Tables Like a Pro in SQL Server 2017 Agenda Working with Very Large Tables Like a Pro in SQL Server 2017 Image courtesy of marin / FreeDigitalPhotos.net

Working with Very Large Tables Like a Pro in SQL Server 2017 Agenda Working with Very Large Tables Like a Pro in SQL Server 2017 Image courtesy of marin / FreeDigitalPhotos.net

Working with Very Large Tables Like a Pro in SQL Server 2017 Agenda Working with Very Large Tables Like a Pro in SQL Server 2017 Image courtesy of marin / FreeDigitalPhotos.net

Working with Very Large Tables Like a Pro in SQL Server 2017 Agenda Working with Very Large Tables Like a Pro in SQL Server 2017 Image courtesy of marin / FreeDigitalPhotos.net

Working with Very Large Tables Like a Pro in SQL Server 2017 Agenda Working with Very Large Tables Like a Pro in SQL Server 2017 Image courtesy of marin / FreeDigitalPhotos.net

So What is a Very Large Table? 5GB 5TB Images courtesy of satit_srihin & John Kasawa / FreeDigitalPhotos.net

So What is a Very Large Table? It depends… Image courtesy of David Castillo Dominici / FreeDigitalPhotos.net

So What is a Very Large Table? is One that Requires Special Care Image courtesy of stockimages / FreeDigitalPhotos.net

So What is a Very Large Table? File.Events Web.PageViews Audit.Messages Monitor.Measures Billing.Transactions

So What is a Very Large Table? Web.PageViews

Working with Very Large Tables

Working with Very Large Tables Manage the Table Image courtesy of xedos4 / FreeDigitalPhotos.net

Working with Very Large Tables Manage the Table Query the Table Image courtesy of Master isolated images / FreeDigitalPhotos.net

Working with Very Large Tables Manage the Table Query the Table Update the Table Image courtesy of Stuart Miles / FreeDigitalPhotos.net

Working with Very Large Tables Manage the Table Query the Table Update the Table Maintain the Table Image courtesy of Stuart Miles / FreeDigitalPhotos.net

How do We Manage the Table? Image courtesy of xedos4 / FreeDigitalPhotos.net

Table Partitioning Facilitates Data Archiving Scenarios Optionally, Spread Partitions Between Storage Tiers Improves Table Maintenance (More of That Later…) Does not Necessarily Improve Query Performance Image courtesy of xedos4 / FreeDigitalPhotos.net

Stretching the Table to the Cloud

Stretching the Table to the Cloud Run the Data Migration Assistant Enable Remote Data Archive at the Instance Level Choose/Create an Azure Server Create a Firewall Rule for Your On-Prem SQL Server

Stretching the Table to the Cloud Create a Database Master Key Create a Database Scoped Credential Enable Remote Data Archive at the Database Level Optionally Create a Filter Function Enable Remote Data Archive at the Table Level

Now Let’s Query the Table… Image courtesy of Master isolated images / FreeDigitalPhotos.net

The Ascending Key Problem Image courtesy of suphakit73 / FreeDigitalPhotos.net

Problem #1 – Solutions Update Statistics Manually Trace Flag 2371 New Cardinality Estimator Filtered Statistics Incremental Statistics Image courtesy of suphakit73 / FreeDigitalPhotos.net

What about the Data Load? Image courtesy of Stuart Miles / FreeDigitalPhotos.net

Problem #2 The WRITELOG Wait Type Image courtesy of stockimages / FreeDigitalPhotos.net

Problem #2 – Solution Delayed Durability Image courtesy of stockimages / FreeDigitalPhotos.net

Delayed Durability Transaction Properties (ACID): Atomicity Consistency Isolation Durability

Fully-Durable Transactions Delayed Durability Data File Buffer Pool Commit Checkpoint Request Transaction Log Buffer Log File WRITELOG

Delayed Durability Transactions Data File Buffer Pool Commit Checkpoint Request Transaction Log Buffer Log File

Delayed Durability The log buffer is flushed to disk when: A fully durable transaction in the same database makes a change in the database and successfully commits Image courtesy of Keerati / FreeDigitalPhotos.net

Delayed Durability The log buffer is flushed to disk when: The user executes the system stored procedure “sys.sp_flush_log” successfully Image courtesy of Keerati / FreeDigitalPhotos.net

Delayed Durability The log buffer is flushed to disk when: The in-memory transaction log buffer fills up and automatically flushes to disk Image courtesy of Keerati / FreeDigitalPhotos.net

Delayed Durability The log buffer is flushed to disk when: Every few milliseconds Image courtesy of Keerati / FreeDigitalPhotos.net

Delayed Durability Can be controlled by: Database (Disabled | Allowed | Forced) Transaction (Commit) Atomic Block (Natively Compiled Procedure) Image courtesy of digitalart / FreeDigitalPhotos.net

Delayed Durability The following transactions are always fully durable: Transactions that perform write operations against tables that are enabled for either Change Tracking or Change Data Capture Image courtesy of Iamnee / FreeDigitalPhotos.net

Delayed Durability The following transactions are always fully durable: Cross-database transactions or distributed transactions Image courtesy of Iamnee / FreeDigitalPhotos.net

Delayed Durability The following features apply only to transactions that have been made durable: Transaction Replication – Transactions are only replicated after they have been made durable Image courtesy of Stuart Miles / FreeDigitalPhotos.net

Delayed Durability The following features apply only to transactions that have been made durable: Log Backup – Only transactions that have been made durable are included in the backup Image courtesy of Stuart Miles / FreeDigitalPhotos.net

Delayed Durability The following features apply only to transactions that have been made durable: Log Shipping – Only transactions that have been made durable are shipped to the secondaries Image courtesy of Stuart Miles / FreeDigitalPhotos.net

Delayed Durability What are the benefits? Less roundtrips to the log file on disk Less WRITELOG waits Shorter transactions Locks are released earlier Better throughput Image courtesy of Ambro / FreeDigitalPhotos.net

Delayed Durability But remember that you might lose data!

Finally, Let’s Talk about Maintenance… Image courtesy of xedos4 / FreeDigitalPhotos.net

Problem #3 Index Rebuild Image courtesy of suphakit73 / FreeDigitalPhotos.net

Index Rebuild Before SQL Server 2014 we could: Rebuild all partitions offline Rebuild all partitions online Rebuild a specific partition offline Image courtesy of David Castillo Dominici / FreeDigitalPhotos.net

Index Rebuild Since SQL Server 2014 we can: Rebuild a specific partition online Wait at low priority when: Rebuilding an index online Switching partitions Image courtesy of David Castillo Dominici / FreeDigitalPhotos.net

Index Rebuild Since SQL Server 2017 we can: Rebuild an index online and also pause and resume it Image courtesy of David Castillo Dominici / FreeDigitalPhotos.net

Wait at Low Priority Wait in a separate low priority queue Wait for a specified number of minutes Image courtesy of ddpavumba / FreeDigitalPhotos.net

Wait at Low Priority After that, choose one of 3 options: Continue to wait at normal priority Abort the operation Kill all blockers and start the operation Image courtesy of ddpavumba / FreeDigitalPhotos.net

Wait at Normal Priority Queue Insert Insert Online Index Rebuild Running Image courtesy of artur84 / FreeDigitalPhotos.net

Wait at Low Priority “Normal” Queue Insert Insert Online Index Rebuild Running Low Priority Queue Image courtesy of artur84 / FreeDigitalPhotos.net

Working with Very Large Tables Like a Pro in SQL Server 2017 Summary Working with Very Large Tables Like a Pro in SQL Server 2017 Image courtesy of marin / FreeDigitalPhotos.net

Working with Very Large Tables Like a Pro in SQL Server 2017 Summary Working with Very Large Tables Like a Pro in SQL Server 2017 Image courtesy of marin / FreeDigitalPhotos.net

Summary A Very Large Table is One that Requires Special Care Image courtesy of stockimages / FreeDigitalPhotos.net

Working with Very Large Tables Like a Pro in SQL Server 2017 Summary Working with Very Large Tables Like a Pro in SQL Server 2017 Image courtesy of marin / FreeDigitalPhotos.net

Summary Manage the Table Query the Table Update the Table Maintain the Table Image courtesy of Master isolated images, Stuart Miles & xedos4 / FreeDigitalPhotos.net

Working with Very Large Tables Like a Pro in SQL Server 2017 Summary Working with Very Large Tables Like a Pro in SQL Server 2017 Image courtesy of marin / FreeDigitalPhotos.net

Summary Solving the Ascending Key problem Update Statistics Manually Trace Flag 2371 New Cardinality Estimator Filtered Statistics Incremental Statistics Image courtesy of suphakit73 / FreeDigitalPhotos.net

Summary Solving the WRITELOG problem with Delayed Durability Less roundtrips to the log file on disk Less WRITELOG waits Shorter transactions & Locks Better throughput Image courtesy of Ambro / FreeDigitalPhotos.net

Summary Solving the Index Rebuild problem Rebuild a specific partition online Resumable online index rebuild Wait at low priority Image courtesy of suphakit73 / FreeDigitalPhotos.net

Working with Very Large Tables Like a Pro in SQL Server 2017 Summary Working with Very Large Tables Like a Pro in SQL Server 2017 Image courtesy of marin / FreeDigitalPhotos.net

Summary New Features Since SQL Server 2014 Stretch Database New Cardinality Estimator Incremental Statistics Delayed Durability Online Indexing Enhancements

Additional Things to Explore Compress the Data Optimize Parallelism Use a Lower Isolation Level Leverage Columnstore Indexes Intelligent Query Processing Image courtesy of kdshutterman / FreeDigitalPhotos.net

Keep In Touch… Name: Guy Glantser Email Address: guy@madeiradata.com Twitter: @guy_glantser Blog: www.linkedin.com/in/glantser/detail/recent-activity/posts Podcast: www.sqlserverradio.com Image courtesy of Nuttapong / FreeDigitalPhotos.net

http://bit.ly/2Q9t3ku http://bit.ly/2QePNzE Evaluations EVENT EVALUATION LINK SESSIONS EVALUATION LINK Evaluations http://bit.ly/2Q9t3ku http://bit.ly/2QePNzE

SPONSORS Loyalty Sponsors Gold Sponsors Silver Sponsors Bronze Sponsors

Image courtesy of David Castillo Dominici / FreeDigitalPhotos.net