Inside the Database Engine

Slides:



Advertisements
Similar presentations
Acknowledgments Byron Bush, Scott S. Hilpert and Lee, JeongKyu
Advertisements

Oracle Architecture. Instances and Databases (1/2)
© 2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 10 Slide 1 IT390 Business Database Administration Unit 10:
1 - Oracle Server Architecture Overview
Working with SQL and PL/SQL/ Session 1 / 1 of 27 SQL Server Architecture.
Chapter 9 Overview  Reasons to monitor SQL Server  Performance Monitoring and Tuning  Tools for Monitoring SQL Server  Common Monitoring and Tuning.
Module 8: Monitoring SQL Server for Performance. Overview Why to Monitor SQL Server Performance Monitoring and Tuning Tools for Monitoring SQL Server.
Transaction log grows unexpectedly
SQL Server memory architecture and debugging memory Issues
Module 15: Monitoring. Overview Formulate requirements and identify resources to monitor in a database environment Types of monitoring that can be carried.
© 2011 IBM Corporation 11 April 2011 IDS Architecture.
Module 8: Server Management. Overview Server-level and instance-level resources such as memory and processes Database-level resources such as logical.
Chapter Oracle Server An Oracle Server consists of an Oracle database (stored data, control and log files.) The Server will support SQL to define.
Architecture Rajesh. Components of Database Engine.
IT 456 Seminar 5 Dr Jeffrey A Robinson. Overview of Course Week 1 – Introduction Week 2 – Installation of SQL and management Tools Week 3 - Creating and.
Computers Operating System Essentials. Operating Systems PROGRAM HARDWARE OPERATING SYSTEM.
Process Architecture Process Architecture - A portion of a program that can run independently of and concurrently with other portions of the program. Some.
ECGR-6185 µC/OS II Nayana Rao University of North Carolina at Charlotte.
Presented by Vishy Grandhi.  Lesson 1: AX Overview  Lesson 2: Role based security  Lesson 3: Monitoring  Troubleshooting.
MINIX Presented by: Clinton Morse, Joseph Paetz, Theresa Sullivan, and Angela Volk.
Diagnosing Performance with Wait Statistics Robert L Davis Principal Database
No more waiting. Sponsors About me  Database Technology Specialist  MVP  Blogger  Author 3
Oracle Database Architectural Components
SQL Server Internals & Architecture Naomi Williams, SQL DBA LinkedIn
CS 540 Database Management Systems
An introduction to Wait Statistics
Processes and threads.
What Is a Latch? …and Why Do I Care? Eddie Wuerch, mcm
Troubleshooting SQL Server high CPU usage
The Basics of Data Manipulation
What Is a Latch? …and Why Do I Care? Eddie Wuerch, mcm
Topics Covered What is Real Time Operating System (RTOS)
SQL Server Internals Overview
SQL Server Monitoring Overview
Chapter Overview Understanding the Database Architecture
CSI 400/500 Operating Systems Spring 2009
Software Architecture in Practice
Hustle and Bustle of SQL Pages
Troubleshooting SQL Server Basics
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 PROCESS of Queries John Deardurff
Chapter 2: The Linux System Part 3
TDC 311 Process Scheduling.
Microsoft SQL Server 2014 for Oracle DBAs Module 2
The PROCESS of Queries John Deardurff Website: ThatAwesomeTrainer.com
මොඩියුල විශ්ලේෂණය SQL Server Waits. Tables රැසක් එකට එකතු කිරීම.
Oracle Memory Internals
The PROCESS of Queries John Deardurff
Batches, Transactions, & Errors
The Vocabulary of Performance Tuning
Статистика ожиданий или как найти место "где болит"
PROCESSES & THREADS ADINA-CLAUDIA STOICA.
A Beginners Guide to Transactions
A Beginners Guide to Transactions
The PROCESS of Queries John Deardurff August 8, 2015
A Beginners Guide to Transactions
A Beginners Guide to Transactions
The Vocabulary of Performance Tuning
Using wait stats to determine why my server is slow
A Beginners Guide to Transactions
Inside the Database Engine
Developing Microsoft SQL Server Databases
Inside the Database Engine
Chapter 13: I/O Systems “The two main jobs of a computer are I/O and [CPU] processing. In many cases, the main job is I/O, and the [CPU] processing is.
Presentation transcript:

Inside the Database Engine SQL Saturday - Memphis Inside the Database Engine John Deardurff Website: SQLMCT.com Twitter: @SQLMCT Email: John@Deardurff.com October 5th, 2019

What does this session cover? What is the Database Engine? A Closer look at SQLOS Waits and Threads The Relational Engine The PROCESS of a Query The Storage Engine How Data is Accessed

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

Transaction Management SQLOS Provides Many Functions Thread Scheduling Memory Management Transaction Management Exception Handling Locking Framework Deadlock Detection

Preemptive vs. Non-Preemptive Scheduling 10987B 1: SQL Server Architecture, Scheduling, and Waits Preemptive vs. Non-Preemptive Scheduling Is driven by the view of prioritized computation Means that a low-priority process is pre-empted out of the processor by a high-priority process Windows uses Preemptive scheduling Means that the priority of a process doesn’t matter Is where a process is not preempted, and executes until it explicitly yields the processor SQL Server uses Non-Preemptive scheduling Try not to spend too much time here. Content in later slides is more important. Technically, Resource Governor enables some processes to be treated preemptively and take priority over a process that is running in a lower-priority resource group. However, discussing this at this point is unlikely to be helpful to students who are new to the topic. Students who have some experience of Resource Governor might raise the point.

Thread States and Queues 10987B 1: SQL Server Architecture, Scheduling, and Waits Thread States and Queues Runnable: The thread is currently in the Runnable Queue waiting to execute. (First In, First Out). Running: One active thread executing on a processor. Suspended: Placed on a Waiter List waiting for a resource other than a processor. (No specific order).  

SQL Server Execution Model 10987B SQL Server Execution Model 1: SQL Server Architecture, Scheduling, and Waits Start End CPU available Quantum exhausted Resource available Resource blocked Complete Runnable List Status: runnable CPU Status: running Waiter List Status: suspended It’s worth spending some time on this slide to make sure that the students grasp these concepts because an understanding of them is critical for the rest of this course. Try to avoid discussing wait types here because the next lesson covers the topic in detail.

Dynamic Management Objects for Waits Active wait duration and type: sys.dm_os_waiting_tasks Session CPU time and memory usage: sys.dm_exec_sessions Status and session owner of request: sys.dm_exec_requests Actual query text of waiting task: sys.dm_exec_sql_text

Dynamic Management Objects for Waits 1: SQL Server Architecture, Scheduling, and Waits Dynamic Management Objects for Waits  

Troubleshooting Wait Types 1: SQL Server Architecture, Scheduling, and Waits Troubleshooting Wait Types Aaron Bertrand – Top Wait Types https://sqlperformance.com/2018/10/sql-performance/top-wait-stats Paul Randal – SQL Skills Wait Types Library https://www.sqlskills.com/help/waits/  

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

Parse Resolve Optimize Compile Compile Execute Execute Execute Execute Ad Hoc Query Stored Procedure First Execution or Recompile 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

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 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. Primary Data File (.mdf) Secondary Data File (.ndf)

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

DBCC IND

DBCC PAGE