The Vocabulary of Performance Tuning

Slides:



Advertisements
Similar presentations
The Architecture of Oracle
Advertisements

Module 2: Database Architecture
TRANSACTION PROCESSING SYSTEM ROHIT KHOKHER. TRANSACTION RECOVERY TRANSACTION RECOVERY TRANSACTION STATES SERIALIZABILITY CONFLICT SERIALIZABILITY VIEW.
Acknowledgments Byron Bush, Scott S. Hilpert and Lee, JeongKyu
A HEAP OF CLUSTERS A look into heaps vs. clustered tables Ami Levin CTO, DBSophic X.
1 - Oracle Server Architecture Overview
Chapter 8 : Transaction Management. u Function and importance of transactions. u Properties of transactions. u Concurrency Control – Meaning of serializability.
Transaction Management WXES 2103 Database. Content What is transaction Transaction properties Transaction management with SQL Transaction log DBMS Transaction.
Working with SQL and PL/SQL/ Session 1 / 1 of 27 SQL Server Architecture.
Transactions and Locks Lesson 22. Skills Matrix Transaction A transaction is a series of steps that perform a logical unit of work. Transactions must.
Managing Transaction and Lock Vu Tuyet Trinh Hanoi University of Technology 1.
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.
Agenda for Today Chapter 5 –Skip Lesson 2 Review questions Midterm Chapter 6 Review questions.
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.
IN-MEMORY OLTP By Manohar Punna SQL Server Geeks – Regional Mentor, Hyderabad Blogger, Speaker.
Introduction to Database Systems1. 2 Basic Definitions Mini-world Some part of the real world about which data is stored in a database. Data Known facts.
Database structure and space Management. Database Structure An ORACLE database has both a physical and logical structure. By separating physical and logical.
Module 11 Creating Highly Concurrent SQL Server® 2008 R2 Applications.
Transactions and Locks A Quick Reference and Summary BIT 275.
Database structure and space Management. Segments The level of logical database storage above an extent is called a segment. A segment is a set of extents.
Session 1 Module 1: Introduction to Data Integrity
Module 11: Managing Transactions and Locks
Backup and Recovery - II - Checkpoint - Transaction log – active portion - Database Recovery.
SQL Basics Review Reviewing what we’ve learned so far…….
Oracle Database Architectural Components
Data Integrity & Indexes / Session 1/ 1 of 37 Session 1 Module 1: Introduction to Data Integrity Module 2: Introduction to Indexes.
SQL Server Storage Inside. About Hemantgiri S. Goswami Hemantgiri S. Goswami is a Lead Database Consultant for Pythian, a company head quartered in Ottawa,

Inside transaction logging
Module 11: File Structure
A Day in the Life of a Row Eddie Wuerch, mcm
The Basics of Data Manipulation
SQL Server Internals Overview
UFC #1433 In-Memory tables 2014 vs 2016
Database Applications (15-415) DBMS Internals- Part XIII Lecture 22, November 15, 2016 Mohammad Hammoud.
Chapter Overview Understanding the Database Architecture
Hustle and Bustle of SQL Pages
මොඩියුල විශ්ලේෂණය Buffer Pool Extension භාවිතය.
The Vocabulary of Performance Tuning
The Vocabulary of Performance Tuning
SQL 2014 In-Memory OLTP What, Why, and How
What Is a Latch? …and Why Do I Care? Eddie Wuerch, mcm
The Vocabulary of Performance Tuning
Batches, Transactions, & Errors
The Basics of Data Manipulation
Transactions, Locking and Query Optimisation
Inside transaction logging
Database Applications (15-415) DBMS Internals- Part XIII Lecture 25, April 15, 2018 Mohammad Hammoud.
TEMPDB – INTERNALS AND USAGE
The PROCESS of Queries John Deardurff
The PROCESS of Queries John Deardurff Website: ThatAwesomeTrainer.com
Statistics for beginners – In-Memory OLTP
The PROCESS of Queries John Deardurff
Batches, Transactions, & Errors
The Vocabulary of Performance Tuning
Physical Storage Structures
A Beginners Guide to Transactions
A Beginners Guide to Transactions
The PROCESS of Queries John Deardurff August 8, 2015
Database Applications (15-415) DBMS Internals- Part XIII Lecture 24, April 14, 2016 Mohammad Hammoud.
A Beginners Guide to Transactions
A Beginners Guide to Transactions
About Wolf DBA for over 19 years At RDX for nearly 9
A Beginners Guide to Transactions
Inside the Database Engine
Inside the Database Engine
Inside the Database Engine
Presentation transcript:

The Vocabulary of Performance Tuning SQL Saturday - Columbus The Vocabulary of Performance Tuning John Deardurff Website: ThatAwesomeTrainer.com Twitter: @John_Deardurff Email: John@Deardurff.com

The Vocabulary of Performance Tuning Database Engine Tables Structures Execution Plans Query Processing

Sends Code to the Processor Modifies Data and Objects in the Database Batches vs Transactions Batches Transactions VS Sends Code to the Processor Modifies Data and Objects in the Database

Relational Engine SQLOS Storage Engine Query Process Relational Engine Resource Access SQLOS Storage Engine Data Access The Database Engine

How Data Is Stored in SQL Server 20462C 3: Working with Databases and Storage How Data Is Stored in SQL Server Data Row Free Space Extent: Eight contiguous 8kb pages Primary Data File (.mdf) Secondary Data File (.ndf) Provide an overview of how the data is stored on SQL Server. Describe each of the three data file types and the basic internal layout of the data files. Stress that the file extension .mdf is not mandatory to use but is highly recommended. Describe the difference between uniform and mixed extents. Note that continued support for mixed extents adds complexity to the database engine for no real benefit. The size of an extent (64 KB) is so small that the original benefit from the mixed extent design is now irrelevant. Briefly explain that all transactions are written to the log file using the WAL mechanism to ensure the integrity of the database in case of a failure and to support rollbacks of transactions. Explain that data changes occur in the buffer pool and are not written immediately to the data files. Avoid discussing filegroups at this point, as they will be covered later.

Rows stored in Data Pages Page Header (96 bytes) Data Row 1 Data Row 2 Data Row 3 Row Offest Array Free Space Header contains Page Information such a Page Number and Page Type 8060 bytes for Data Rows or Free Space Displays how far from beginning of page each row is located.

How Data Is Modified in SQL Server 20462C 3: Working with Databases and Storage How Data Is Modified in SQL Server 3. Modification is written to transaction log. Provide an overview of how the data is stored on SQL Server. Describe each of the three data file types and the basic internal layout of the data files. Stress that the file extension .mdf is not mandatory to use but is highly recommended. Describe the difference between uniform and mixed extents. Note that continued support for mixed extents adds complexity to the database engine for no real benefit. The size of an extent (64 KB) is so small that the original benefit from the mixed extent design is now irrelevant. Briefly explain that all transactions are written to the log file using the WAL mechanism to ensure the integrity of the database in case of a failure and to support rollbacks of transactions. Explain that data changes occur in the buffer pool and are not written immediately to the data files. Avoid discussing filegroups at this point, as they will be covered later. 3 1. Data modification is sent to buffer cache in memory. 1 4. Checkpoint looks for committed transactions. 4 2 5. Write dirty pages to database file. 2. Data pages are located or read into the buffer cache and then modified. 5

Working with Batches

Inserting Records into an IDENTITY field

How Data is Stored in Data Pages Heap Data stored in a Heap is not stored in any order and normally does not have a Primary Key. Data Row 8 Data Row 2 Data Row 7 Data Row 6 Data Row 5 Data Row 4 Data Row 1 Data Row 3 Data Row 9 Clustered Index Clustered Index data is stored in sorted order by the Clustering key. In many cases, this is the same value as the Primary Key. Data Row 1 Data Row 4 Data Row 7 Data Row 2 Data Row 5 Data Row 8 Data Row 3 Data Row 6 Data Row 9

Execution Plans Data stored in a Heap is not stored in any order and normally does not have a Primary Key. Clustered Index data is stored in sorted order by the Clustering key. In many cases, this is the same value as the Primary Key. Using a WHERE statement could possibly have the Execution Plan seek the Clustered Index instead of scan.

WHERE State = ‘IN’ Non–Clustered Index Clustered Index Or Heap ROOT CA 3 FL 4 GA 10 IL 7 IN 1 IN 5 IN 12 KS 8 MT 11 NV 2 TX 6 VA 9 AZ -IL IN - ND OH - WA Non–Clustered Index Clustered Index Or Heap ROOT 1-7 8-12 1 John IN 2 Sharon NV 3 Armando CA 4 Heather FL 5 Enrique IN 6 Rachel TX 7 Gary IL 10 Ed GA 8 Bob KS 11 Leann MT 9 Sidney VA 12 Linda IN

Parse Resolve Optimize Compile Compile Execute Execute Execute Execute Ad Hoc Query First Time Stored Procedure Syntax Parse Execution Context Resolve (Binding) Estimated Compile Optimize Execution Plan Procedure Cache Compile Compile Actual Run Time Execute Execute Execute Execute SQL SQL Sets Sets

DEMONSTRATION

DBCC IND

DBCC PAGE

Index Allocation Map Pages Each Allocation Unit has at least one IAM Page Shows Uniform Extents and Mixed Extents IAM is an 8000 byte map or 64000 bits which covers 4GB of extents in a file. (GAM Interval)

Transactions must pass the ACID test Atomicity – All or Nothing Consistent – Only valid data Isolated – No interference Durable – Data is recoverable

Transaction Log Recovery Transaction Recovery Action Required 1 None 2 Roll forward 3 Roll back 4 Roll forward 5 Roll back Checkpoint System Failure

What is a Lock? Transaction 1 Transaction 2 TSQL2012.mdf

Auto-Commit Transactions without Error Handling TSQL2012.ldf Checkpoint TSQL2012.mdf John, don’t forget to demonstrate SET XACT_ABORT ON

Explicit Transactions without Error Handling TSQL2012.ldf Checkpoint TSQL2012.mdf

Explicit Transactions with Error Handling TSQL2012.ldf TSQL2012.mdf Checkpoint

Creating Stored Procedures