SlideShare a Scribd company logo
R2
Sql server lesson13
 Using the Database Engine Tuning Advisor
 The Database Engine Tuning Advisor (DTA) is designed to evaluate
your queries against the rules in the Query Optimizer to make
suggestions that can improve performance.
 The one thing you need before you can run the DTA is a workload.
 DTA works in conjunction with SQL Trace output.
 Trace is captured that contains the queries that you want DTA to
analyze.
 The trace output is read and evaluated by DTA against a
database.
 The recommendations that DTA can make are:
 Adding indexes.
 Dropping indexes.
 Partitioning tables.
 Storage aligning tables.
 Using the Database Engine Tuning Advisor
 The source of a DTA workload can be :
 A trace file.
 Transact-SQL (T-SQL) script.
 A table that contains T-SQL commands.
 The only events that DTA is concerned about are:
 RPC:Starting
 RPC:Completed
 SQL:Batch Starting
 SQL:Batch Completed
 Using the Database Engine Tuning Advisor
 An analysis is accomplished with four steps:
1. Generate a workload for analysis.
2. Start DTA and connect to a server running SQ Server that
contains a database to analyze the workload against.
3. Select the workload to use.
4. Specify tuning options
 Analysis within DTA is performed in a session.
 Each session must have a name and is saved so that you can review
the results at a later date.
 The most common way of performing an analysis is with a file which either
contains the output of a trace or contains one or more T-SQL commands.
 Using the Database Engine Tuning Advisor
 Creating a DTA analysis session
 Using the Database Engine Tuning Advisor
 DTA is the graphical utility with which you interact
 Analysis within DTA is performed in a session.
 Each session must have a name and is saved so that you can
review the results at a later date
 DTA analyzes the cost of a specified query against each possible
recommendation.
 Query cost is generated by the query optimizer based on
distribution statistics.
 DTA can analyze queries and stored procedures that are stored
in either a file or a table. The most common tuning source for DTA
is a trace output file.
 Using the Database Engine Tuning Advisor
 There are four groups of tuning options:
 Time limitations and online actions
 Existing structures in the database
 Partitioning options
 Whether to retain existing structures in the database
 Working With Resource Governor
 The Resource Governor is a new feature in the Microsoft® SQL Server®
2008 Enterprise.
 Resource Governor is a feature that you can use to manage SQL Server
workload and system resource consumption.
 Resource Governor enables you to limit the amount of CPU and memory that
incoming application requests can use.
 The resources that can be managed by Resource Governor are CPU and
memory.
 Resource Governor works with three components:
 Resource pools.
 Workload groups.
 Classification functions.
 A Resource pool defines the minimum and maximum CPU, memory, or both
allocated to a resource pool.
 By default, there are two resource pools: Internal and Default. You cannot
alter the internal pool in any way, and it has priority over all other pools, But
you can alter the default pool.
 Workload groups are a set of requests you define, so that Resource
Governor can assign the connection to the appropriate Resource pool.
 Working With Resource Governor
 A Classification Function is a function that you create in the master
database. Only ONE classification function can be active for
Resource Governor at a time.
 The classification function cannot have any input parameters and is
required to return a scalar value.
 The value that is returned is the name of the workload group that the
session should be classified into.
 The classification function can contain any code that is valid for a
function, but you should minimize the amount of code in any
classification function.
 Because the classification function executes after authentication but
before a connection handle is returned to the user’s application.
 the classification function is executed for every new connection to
your instance.
 How Does Resource Governor Work?
 Using Dynamic Management Views and Functions
 Dynamic Management Views (DMV) and Dynamic Management
Functions (DMF) provide the instrumentation infrastructure that
allows database administrators to retrieve system information as well
as monitor, diagnose, and fix problems.
 DMV Categories
 DMVs are all stored in the Sysschema
DMV Prefix General Purpose
dm_db_* General database space and index utilization
dm_exec_* Statistics for queries that are executing, as well as
queries that have completed and still have plans in the
query cache
dm_io_* Disk subsystem statistics
dm_os_* Statistics related to the use of hardware resources
Most important DMV categories that are used for performance tuning.
 Using Dynamic Management Views and Functions
 Database Statistics
The most common DMVs used to gather database statistics are:
 sys.dm_db_index_usage_stats
 sys.dm_db_index_operational_stats
 sys.dm_db_index_physical_stats
 sys.dm_db_missing_index_groups
 sys.dm_db_missing_index_group_stats
 sys.dm_db_missing_index_details
 Indexes are created to improve performance of specific queries. But
Having an insufficient number of indexes can cause performance
problems.
 The sys.dm_db_index_usage_stats view contains the number of times
(and the last time) each index was used to satisfy a seek, scan, or lookup,
as well as the number of times and the last time an update was performed
to each index.
 Using Dynamic Management Views and Functions
 Database Statistics
 Sys.dm_db_index_operational_stats
(database_id, object_id, index_id, partition_id)
This function returns locking, latching, and access statistics for each index that can
help you determine how heavily an index is being used. This function also helps you
diagnose contention issues due to locking and latching.
 Sys.dm_db_index_physical_stats
(database_id, object_id, index_id, partition_id, and mode)
The function returns size and fragmentation statistics for each index and should be
the primary source for determining when an index needs to be defragmented.
 Using Dynamic Management Views and Functions
 Query Statistics
 Return information related to connection to the instance, as well as query execution.
 Sys.dm_exec_connections : contains one row for each connection to the
instance.
 Sys.dm_exec_sessions : contains a row for each currently authenticated
session, also returns the accumulated reads, writes, CPU, and query execution
duration for the session.
 Sys.dm_exec_requests : contains one row for each currently executing request
in the instance, also you can retrieve the database and command being
executed.
 sys.dm_exec_query_stats : contains detailed statistics on the performance and
resources consumed for every query in the query cache
 SQL Server stores the query plan and text of each query executed in the
query cache, identified by a unique value called the handle.
 sys.dm_exec_sql_text : returns the text of the SQL statement associated to the
handle that was passed in.
 sys.dm_exec_query_plan : accepts a plan handle and returns the corresponding
XML showplan.
 Using Dynamic Management Views and Functions
 Query Statistics
SELECT * FROM
(SELECT user_seeks * avg_total_user_cost * (avg_user_impact
* 0.01) AS index_advantage, migs.* FROM
sys.dm_db_missing_index_group_stats migs) AS
migs_adv INNER JOIN sys.dm_db_missing_index_groups AS mig
ON migs_adv.group_handle = mig.index_group_handle
INNER JOIN sys.dm_db_missing_index_details AS mid
ON mig.index_handle = mid.index_handle
)
ORDER BY migs_adv.index_advantage
 Determining which indexes to create
 The query that you can use to calculate a “usefulness factor” is :
 Using Dynamic Management Views and Functions
 Query Statistics
 To return the query and XML show plan for all currently executing queries, you could
use the following statement:
SELECT * FROM sys.dm_exec_requests CROSS APPLY
sys.dm_exec_query_plan(plan_handle)
CROSS APPLY sys.dm_exec_sql_text(sql_handle)
 To return the SQL statement and XML show plan for every query that is cached in
the query cache:
SELECT * FROM sys.dm_exec_query_stats CROSS APPLY
sys.dm_exec_query_plan(plan_handle)
CROSS APPLY sys.dm_exec_sql_text(sql_handle)
 Using Dynamic Management Views and Functions
 Disk Subsystem Statistics
 sys.dm_io_virtual_file_stats
Returns statistics about the reads and writes for everydatabase file.
 sys.dm_io_pending_requests
Contains a row for each request that is waiting forthe disk
subsystem to complete an I/O request
1. What types of workloads can DTA use for analysis? (Choose all that apply.)
A. A T-SQL script
B. A trace file containing Extensible Markup Language (XML) showplans
C. A trace file containing RPC:Completedevents
D. A trace file containing SP:StmtCompletedevents
2. You are the database administrator at Coho Vineyards. Following the
consolidation of all the wineries’ inventory, customer, and order databases, the
marketing group wants to be able to run ad hoc queries for analysis purposes.
Users are allowed to execute any query that they can construct, regardless of
the impact it might have on the performance of the database. Unfortunately, the
same databases are being used to create and process customer orders.
Management does not want to restrict the queries that marketing can execute,
but it wants you to ensure that customer orders can be created and processed
in a timely fashion. What can be used to limit the impact of marketing queries to
ensure customer orders are processed?
A. Configure the max degree of parallelism option.
B. Implement Resource Governor.
C. Configure the query governor cost threshold.
D. Limit the memory utilization for marketing users
Sql server lesson13
Ad

More Related Content

What's hot (9)

Performance Tuning With Oracle ASH and AWR. Part 1 How And What
Performance Tuning With Oracle ASH and AWR. Part 1 How And WhatPerformance Tuning With Oracle ASH and AWR. Part 1 How And What
Performance Tuning With Oracle ASH and AWR. Part 1 How And What
udaymoogala
 
Analyzing and Interpreting AWR
Analyzing and Interpreting AWRAnalyzing and Interpreting AWR
Analyzing and Interpreting AWR
pasalapudi
 
Database Performance Tuning
Database Performance Tuning Database Performance Tuning
Database Performance Tuning
Arno Huetter
 
Oracle database performance tuning
Oracle database performance tuningOracle database performance tuning
Oracle database performance tuning
Yogiji Creations
 
Performance tuning in sql server
Performance tuning in sql serverPerformance tuning in sql server
Performance tuning in sql server
Antonios Chatzipavlis
 
R12 d49656 gc10-apps dba 07
R12 d49656 gc10-apps dba 07R12 d49656 gc10-apps dba 07
R12 d49656 gc10-apps dba 07
zeesniper
 
Oracle Oracle Performance Tuning
Oracle Oracle Performance Tuning Oracle Oracle Performance Tuning
Oracle Oracle Performance Tuning
Kernel Training
 
Query Evaluation Techniques for Large Databases.pdf
Query Evaluation Techniques for Large Databases.pdfQuery Evaluation Techniques for Large Databases.pdf
Query Evaluation Techniques for Large Databases.pdf
RayWill4
 
Data warehousing labs maunal
Data warehousing labs maunalData warehousing labs maunal
Data warehousing labs maunal
Education
 
Performance Tuning With Oracle ASH and AWR. Part 1 How And What
Performance Tuning With Oracle ASH and AWR. Part 1 How And WhatPerformance Tuning With Oracle ASH and AWR. Part 1 How And What
Performance Tuning With Oracle ASH and AWR. Part 1 How And What
udaymoogala
 
Analyzing and Interpreting AWR
Analyzing and Interpreting AWRAnalyzing and Interpreting AWR
Analyzing and Interpreting AWR
pasalapudi
 
Database Performance Tuning
Database Performance Tuning Database Performance Tuning
Database Performance Tuning
Arno Huetter
 
Oracle database performance tuning
Oracle database performance tuningOracle database performance tuning
Oracle database performance tuning
Yogiji Creations
 
R12 d49656 gc10-apps dba 07
R12 d49656 gc10-apps dba 07R12 d49656 gc10-apps dba 07
R12 d49656 gc10-apps dba 07
zeesniper
 
Oracle Oracle Performance Tuning
Oracle Oracle Performance Tuning Oracle Oracle Performance Tuning
Oracle Oracle Performance Tuning
Kernel Training
 
Query Evaluation Techniques for Large Databases.pdf
Query Evaluation Techniques for Large Databases.pdfQuery Evaluation Techniques for Large Databases.pdf
Query Evaluation Techniques for Large Databases.pdf
RayWill4
 
Data warehousing labs maunal
Data warehousing labs maunalData warehousing labs maunal
Data warehousing labs maunal
Education
 

Similar to Sql server lesson13 (20)

Sql Server
Sql ServerSql Server
Sql Server
SandyShin
 
SQL Server Admin Best Practices with DMV's
SQL Server Admin Best Practices with DMV'sSQL Server Admin Best Practices with DMV's
SQL Server Admin Best Practices with DMV's
Sparkhound Inc.
 
SQL Server and System Center Advisor
SQL Server and System Center AdvisorSQL Server and System Center Advisor
SQL Server and System Center Advisor
Eduardo Castro
 
Novidades do SQL Server 2016
Novidades do SQL Server 2016Novidades do SQL Server 2016
Novidades do SQL Server 2016
Marcos Freccia
 
Dmv's & Performance Monitor in SQL Server
Dmv's & Performance Monitor in SQL ServerDmv's & Performance Monitor in SQL Server
Dmv's & Performance Monitor in SQL Server
Zeba Ansari
 
Saying goodbye to SQL Server 2000
Saying goodbye to SQL Server 2000Saying goodbye to SQL Server 2000
Saying goodbye to SQL Server 2000
ukdpe
 
Ms sql server architecture
Ms sql server architectureMs sql server architecture
Ms sql server architecture
Ajeet Singh
 
DBA, LEVEL III TTLM Monitoring and Administering Database.docx
DBA, LEVEL III TTLM Monitoring and Administering Database.docxDBA, LEVEL III TTLM Monitoring and Administering Database.docx
DBA, LEVEL III TTLM Monitoring and Administering Database.docx
seifusisay06
 
Performance Tuning
Performance TuningPerformance Tuning
Performance Tuning
Ligaya Turmelle
 
05_DP_300T00A_Optimize.pptx
05_DP_300T00A_Optimize.pptx05_DP_300T00A_Optimize.pptx
05_DP_300T00A_Optimize.pptx
KareemBullard1
 
dd presentation.pdf
dd presentation.pdfdd presentation.pdf
dd presentation.pdf
AnSHiKa187943
 
Sql server performance tuning
Sql server performance tuningSql server performance tuning
Sql server performance tuning
Jugal Shah
 
SQL Server 2000 Research Series - Architecture Overview
SQL Server 2000 Research Series - Architecture OverviewSQL Server 2000 Research Series - Architecture Overview
SQL Server 2000 Research Series - Architecture Overview
Jerry Yang
 
Troubleshooting sql server
Troubleshooting sql serverTroubleshooting sql server
Troubleshooting sql server
Antonios Chatzipavlis
 
What's new in Autonomous Database - OCYatra2023 - Sandesh Rao.pdf
What's new in Autonomous Database - OCYatra2023 - Sandesh Rao.pdfWhat's new in Autonomous Database - OCYatra2023 - Sandesh Rao.pdf
What's new in Autonomous Database - OCYatra2023 - Sandesh Rao.pdf
Sandesh Rao
 
What's new in the world of the Autonomous Database in 2023
What's new in the world of the Autonomous Database in 2023What's new in the world of the Autonomous Database in 2023
What's new in the world of the Autonomous Database in 2023
Sandesh Rao
 
Msbi Architecture
Msbi ArchitectureMsbi Architecture
Msbi Architecture
Rajinder Singh, PRINCE2® Practitioner
 
Sql Server 2008 Enhancements
Sql Server 2008 EnhancementsSql Server 2008 Enhancements
Sql Server 2008 Enhancements
kobico10
 
Sql server basics
Sql server basicsSql server basics
Sql server basics
Dilfaroz Khan
 
Practical SQL query monitoring and optimization
Practical SQL query monitoring and optimizationPractical SQL query monitoring and optimization
Practical SQL query monitoring and optimization
Ivo Andreev
 
SQL Server Admin Best Practices with DMV's
SQL Server Admin Best Practices with DMV'sSQL Server Admin Best Practices with DMV's
SQL Server Admin Best Practices with DMV's
Sparkhound Inc.
 
SQL Server and System Center Advisor
SQL Server and System Center AdvisorSQL Server and System Center Advisor
SQL Server and System Center Advisor
Eduardo Castro
 
Novidades do SQL Server 2016
Novidades do SQL Server 2016Novidades do SQL Server 2016
Novidades do SQL Server 2016
Marcos Freccia
 
Dmv's & Performance Monitor in SQL Server
Dmv's & Performance Monitor in SQL ServerDmv's & Performance Monitor in SQL Server
Dmv's & Performance Monitor in SQL Server
Zeba Ansari
 
Saying goodbye to SQL Server 2000
Saying goodbye to SQL Server 2000Saying goodbye to SQL Server 2000
Saying goodbye to SQL Server 2000
ukdpe
 
Ms sql server architecture
Ms sql server architectureMs sql server architecture
Ms sql server architecture
Ajeet Singh
 
DBA, LEVEL III TTLM Monitoring and Administering Database.docx
DBA, LEVEL III TTLM Monitoring and Administering Database.docxDBA, LEVEL III TTLM Monitoring and Administering Database.docx
DBA, LEVEL III TTLM Monitoring and Administering Database.docx
seifusisay06
 
05_DP_300T00A_Optimize.pptx
05_DP_300T00A_Optimize.pptx05_DP_300T00A_Optimize.pptx
05_DP_300T00A_Optimize.pptx
KareemBullard1
 
Sql server performance tuning
Sql server performance tuningSql server performance tuning
Sql server performance tuning
Jugal Shah
 
SQL Server 2000 Research Series - Architecture Overview
SQL Server 2000 Research Series - Architecture OverviewSQL Server 2000 Research Series - Architecture Overview
SQL Server 2000 Research Series - Architecture Overview
Jerry Yang
 
What's new in Autonomous Database - OCYatra2023 - Sandesh Rao.pdf
What's new in Autonomous Database - OCYatra2023 - Sandesh Rao.pdfWhat's new in Autonomous Database - OCYatra2023 - Sandesh Rao.pdf
What's new in Autonomous Database - OCYatra2023 - Sandesh Rao.pdf
Sandesh Rao
 
What's new in the world of the Autonomous Database in 2023
What's new in the world of the Autonomous Database in 2023What's new in the world of the Autonomous Database in 2023
What's new in the world of the Autonomous Database in 2023
Sandesh Rao
 
Sql Server 2008 Enhancements
Sql Server 2008 EnhancementsSql Server 2008 Enhancements
Sql Server 2008 Enhancements
kobico10
 
Practical SQL query monitoring and optimization
Practical SQL query monitoring and optimizationPractical SQL query monitoring and optimization
Practical SQL query monitoring and optimization
Ivo Andreev
 
Ad

More from Ala Qunaibi (14)

Sql server lesson11
Sql server lesson11Sql server lesson11
Sql server lesson11
Ala Qunaibi
 
Sql server lesson9
Sql server lesson9Sql server lesson9
Sql server lesson9
Ala Qunaibi
 
Sql server lesson8
Sql server lesson8Sql server lesson8
Sql server lesson8
Ala Qunaibi
 
Sql server lesson7
Sql server lesson7Sql server lesson7
Sql server lesson7
Ala Qunaibi
 
Sql server lesson6
Sql server lesson6Sql server lesson6
Sql server lesson6
Ala Qunaibi
 
Sql server lesson5
Sql server lesson5Sql server lesson5
Sql server lesson5
Ala Qunaibi
 
Sql server lesson4_v2
Sql server lesson4_v2Sql server lesson4_v2
Sql server lesson4_v2
Ala Qunaibi
 
Sql server lesson3
Sql server lesson3Sql server lesson3
Sql server lesson3
Ala Qunaibi
 
Sql server lesson4
Sql server lesson4Sql server lesson4
Sql server lesson4
Ala Qunaibi
 
Sql server lesson2
Sql server lesson2Sql server lesson2
Sql server lesson2
Ala Qunaibi
 
الفروقات الفردية بين الطلاب كيف نفهمها
الفروقات الفردية بين الطلاب  كيف نفهمهاالفروقات الفردية بين الطلاب  كيف نفهمها
الفروقات الفردية بين الطلاب كيف نفهمها
Ala Qunaibi
 
صور
صورصور
صور
Ala Qunaibi
 
حوادث السير
حوادث السير حوادث السير
حوادث السير
Ala Qunaibi
 
المجموعة الشمسية
المجموعة الشمسيةالمجموعة الشمسية
المجموعة الشمسية
Ala Qunaibi
 
Sql server lesson11
Sql server lesson11Sql server lesson11
Sql server lesson11
Ala Qunaibi
 
Sql server lesson9
Sql server lesson9Sql server lesson9
Sql server lesson9
Ala Qunaibi
 
Sql server lesson8
Sql server lesson8Sql server lesson8
Sql server lesson8
Ala Qunaibi
 
Sql server lesson7
Sql server lesson7Sql server lesson7
Sql server lesson7
Ala Qunaibi
 
Sql server lesson6
Sql server lesson6Sql server lesson6
Sql server lesson6
Ala Qunaibi
 
Sql server lesson5
Sql server lesson5Sql server lesson5
Sql server lesson5
Ala Qunaibi
 
Sql server lesson4_v2
Sql server lesson4_v2Sql server lesson4_v2
Sql server lesson4_v2
Ala Qunaibi
 
Sql server lesson3
Sql server lesson3Sql server lesson3
Sql server lesson3
Ala Qunaibi
 
Sql server lesson4
Sql server lesson4Sql server lesson4
Sql server lesson4
Ala Qunaibi
 
Sql server lesson2
Sql server lesson2Sql server lesson2
Sql server lesson2
Ala Qunaibi
 
الفروقات الفردية بين الطلاب كيف نفهمها
الفروقات الفردية بين الطلاب  كيف نفهمهاالفروقات الفردية بين الطلاب  كيف نفهمها
الفروقات الفردية بين الطلاب كيف نفهمها
Ala Qunaibi
 
حوادث السير
حوادث السير حوادث السير
حوادث السير
Ala Qunaibi
 
المجموعة الشمسية
المجموعة الشمسيةالمجموعة الشمسية
المجموعة الشمسية
Ala Qunaibi
 
Ad

Recently uploaded (20)

How to Clean Your Contacts Using the Deduplication Menu in Odoo 18
How to Clean Your Contacts Using the Deduplication Menu in Odoo 18How to Clean Your Contacts Using the Deduplication Menu in Odoo 18
How to Clean Your Contacts Using the Deduplication Menu in Odoo 18
Celine George
 
antiquity of writing in ancient India- literary & archaeological evidence
antiquity of writing in ancient India- literary & archaeological evidenceantiquity of writing in ancient India- literary & archaeological evidence
antiquity of writing in ancient India- literary & archaeological evidence
PrachiSontakke5
 
Transform tomorrow: Master benefits analysis with Gen AI today webinar, 30 A...
Transform tomorrow: Master benefits analysis with Gen AI today webinar,  30 A...Transform tomorrow: Master benefits analysis with Gen AI today webinar,  30 A...
Transform tomorrow: Master benefits analysis with Gen AI today webinar, 30 A...
Association for Project Management
 
Pope Leo XIV, the first Pope from North America.pptx
Pope Leo XIV, the first Pope from North America.pptxPope Leo XIV, the first Pope from North America.pptx
Pope Leo XIV, the first Pope from North America.pptx
Martin M Flynn
 
Mental Health Assessment in 5th semester bsc. nursing and also used in 2nd ye...
Mental Health Assessment in 5th semester bsc. nursing and also used in 2nd ye...Mental Health Assessment in 5th semester bsc. nursing and also used in 2nd ye...
Mental Health Assessment in 5th semester bsc. nursing and also used in 2nd ye...
parmarjuli1412
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 9 THEO ĐƠN VỊ BÀI HỌC - GLOBAL SUCCESS - CẢ NĂM (TỪ...
BÀI TẬP BỔ TRỢ TIẾNG ANH 9 THEO ĐƠN VỊ BÀI HỌC - GLOBAL SUCCESS - CẢ NĂM (TỪ...BÀI TẬP BỔ TRỢ TIẾNG ANH 9 THEO ĐƠN VỊ BÀI HỌC - GLOBAL SUCCESS - CẢ NĂM (TỪ...
BÀI TẬP BỔ TRỢ TIẾNG ANH 9 THEO ĐƠN VỊ BÀI HỌC - GLOBAL SUCCESS - CẢ NĂM (TỪ...
Nguyen Thanh Tu Collection
 
Overview Well-Being and Creative Careers
Overview Well-Being and Creative CareersOverview Well-Being and Creative Careers
Overview Well-Being and Creative Careers
University of Amsterdam
 
Botany Assignment Help Guide - Academic Excellence
Botany Assignment Help Guide - Academic ExcellenceBotany Assignment Help Guide - Academic Excellence
Botany Assignment Help Guide - Academic Excellence
online college homework help
 
Final Evaluation.docx...........................
Final Evaluation.docx...........................Final Evaluation.docx...........................
Final Evaluation.docx...........................
l1bbyburrell
 
The History of Kashmir Karkota Dynasty NEP.pptx
The History of Kashmir Karkota Dynasty NEP.pptxThe History of Kashmir Karkota Dynasty NEP.pptx
The History of Kashmir Karkota Dynasty NEP.pptx
Arya Mahila P. G. College, Banaras Hindu University, Varanasi, India.
 
Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...
Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...
Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...
Leonel Morgado
 
All About the 990 Unlocking Its Mysteries and Its Power.pdf
All About the 990 Unlocking Its Mysteries and Its Power.pdfAll About the 990 Unlocking Its Mysteries and Its Power.pdf
All About the 990 Unlocking Its Mysteries and Its Power.pdf
TechSoup
 
2025 The Senior Landscape and SET plan preparations.pptx
2025 The Senior Landscape and SET plan preparations.pptx2025 The Senior Landscape and SET plan preparations.pptx
2025 The Senior Landscape and SET plan preparations.pptx
mansk2
 
TERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptx
TERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptxTERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptx
TERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptx
PoojaSen20
 
Cultivation Practice of Garlic in Nepal.pptx
Cultivation Practice of Garlic in Nepal.pptxCultivation Practice of Garlic in Nepal.pptx
Cultivation Practice of Garlic in Nepal.pptx
UmeshTimilsina1
 
Classification of mental disorder in 5th semester bsc. nursing and also used ...
Classification of mental disorder in 5th semester bsc. nursing and also used ...Classification of mental disorder in 5th semester bsc. nursing and also used ...
Classification of mental disorder in 5th semester bsc. nursing and also used ...
parmarjuli1412
 
LDMMIA Reiki News Ed3 Vol1 For Team and Guests
LDMMIA Reiki News Ed3 Vol1 For Team and GuestsLDMMIA Reiki News Ed3 Vol1 For Team and Guests
LDMMIA Reiki News Ed3 Vol1 For Team and Guests
LDM Mia eStudios
 
U3 ANTITUBERCULAR DRUGS Pharmacology 3.pptx
U3 ANTITUBERCULAR DRUGS Pharmacology 3.pptxU3 ANTITUBERCULAR DRUGS Pharmacology 3.pptx
U3 ANTITUBERCULAR DRUGS Pharmacology 3.pptx
Mayuri Chavan
 
E-Filing_of_Income_Tax.pptx and concept of form 26AS
E-Filing_of_Income_Tax.pptx and concept of form 26ASE-Filing_of_Income_Tax.pptx and concept of form 26AS
E-Filing_of_Income_Tax.pptx and concept of form 26AS
Abinash Palangdar
 
How to Clean Your Contacts Using the Deduplication Menu in Odoo 18
How to Clean Your Contacts Using the Deduplication Menu in Odoo 18How to Clean Your Contacts Using the Deduplication Menu in Odoo 18
How to Clean Your Contacts Using the Deduplication Menu in Odoo 18
Celine George
 
antiquity of writing in ancient India- literary & archaeological evidence
antiquity of writing in ancient India- literary & archaeological evidenceantiquity of writing in ancient India- literary & archaeological evidence
antiquity of writing in ancient India- literary & archaeological evidence
PrachiSontakke5
 
Transform tomorrow: Master benefits analysis with Gen AI today webinar, 30 A...
Transform tomorrow: Master benefits analysis with Gen AI today webinar,  30 A...Transform tomorrow: Master benefits analysis with Gen AI today webinar,  30 A...
Transform tomorrow: Master benefits analysis with Gen AI today webinar, 30 A...
Association for Project Management
 
Pope Leo XIV, the first Pope from North America.pptx
Pope Leo XIV, the first Pope from North America.pptxPope Leo XIV, the first Pope from North America.pptx
Pope Leo XIV, the first Pope from North America.pptx
Martin M Flynn
 
Mental Health Assessment in 5th semester bsc. nursing and also used in 2nd ye...
Mental Health Assessment in 5th semester bsc. nursing and also used in 2nd ye...Mental Health Assessment in 5th semester bsc. nursing and also used in 2nd ye...
Mental Health Assessment in 5th semester bsc. nursing and also used in 2nd ye...
parmarjuli1412
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 9 THEO ĐƠN VỊ BÀI HỌC - GLOBAL SUCCESS - CẢ NĂM (TỪ...
BÀI TẬP BỔ TRỢ TIẾNG ANH 9 THEO ĐƠN VỊ BÀI HỌC - GLOBAL SUCCESS - CẢ NĂM (TỪ...BÀI TẬP BỔ TRỢ TIẾNG ANH 9 THEO ĐƠN VỊ BÀI HỌC - GLOBAL SUCCESS - CẢ NĂM (TỪ...
BÀI TẬP BỔ TRỢ TIẾNG ANH 9 THEO ĐƠN VỊ BÀI HỌC - GLOBAL SUCCESS - CẢ NĂM (TỪ...
Nguyen Thanh Tu Collection
 
Overview Well-Being and Creative Careers
Overview Well-Being and Creative CareersOverview Well-Being and Creative Careers
Overview Well-Being and Creative Careers
University of Amsterdam
 
Botany Assignment Help Guide - Academic Excellence
Botany Assignment Help Guide - Academic ExcellenceBotany Assignment Help Guide - Academic Excellence
Botany Assignment Help Guide - Academic Excellence
online college homework help
 
Final Evaluation.docx...........................
Final Evaluation.docx...........................Final Evaluation.docx...........................
Final Evaluation.docx...........................
l1bbyburrell
 
Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...
Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...
Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...
Leonel Morgado
 
All About the 990 Unlocking Its Mysteries and Its Power.pdf
All About the 990 Unlocking Its Mysteries and Its Power.pdfAll About the 990 Unlocking Its Mysteries and Its Power.pdf
All About the 990 Unlocking Its Mysteries and Its Power.pdf
TechSoup
 
2025 The Senior Landscape and SET plan preparations.pptx
2025 The Senior Landscape and SET plan preparations.pptx2025 The Senior Landscape and SET plan preparations.pptx
2025 The Senior Landscape and SET plan preparations.pptx
mansk2
 
TERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptx
TERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptxTERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptx
TERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptx
PoojaSen20
 
Cultivation Practice of Garlic in Nepal.pptx
Cultivation Practice of Garlic in Nepal.pptxCultivation Practice of Garlic in Nepal.pptx
Cultivation Practice of Garlic in Nepal.pptx
UmeshTimilsina1
 
Classification of mental disorder in 5th semester bsc. nursing and also used ...
Classification of mental disorder in 5th semester bsc. nursing and also used ...Classification of mental disorder in 5th semester bsc. nursing and also used ...
Classification of mental disorder in 5th semester bsc. nursing and also used ...
parmarjuli1412
 
LDMMIA Reiki News Ed3 Vol1 For Team and Guests
LDMMIA Reiki News Ed3 Vol1 For Team and GuestsLDMMIA Reiki News Ed3 Vol1 For Team and Guests
LDMMIA Reiki News Ed3 Vol1 For Team and Guests
LDM Mia eStudios
 
U3 ANTITUBERCULAR DRUGS Pharmacology 3.pptx
U3 ANTITUBERCULAR DRUGS Pharmacology 3.pptxU3 ANTITUBERCULAR DRUGS Pharmacology 3.pptx
U3 ANTITUBERCULAR DRUGS Pharmacology 3.pptx
Mayuri Chavan
 
E-Filing_of_Income_Tax.pptx and concept of form 26AS
E-Filing_of_Income_Tax.pptx and concept of form 26ASE-Filing_of_Income_Tax.pptx and concept of form 26AS
E-Filing_of_Income_Tax.pptx and concept of form 26AS
Abinash Palangdar
 

Sql server lesson13

  • 1. R2
  • 3.  Using the Database Engine Tuning Advisor  The Database Engine Tuning Advisor (DTA) is designed to evaluate your queries against the rules in the Query Optimizer to make suggestions that can improve performance.  The one thing you need before you can run the DTA is a workload.  DTA works in conjunction with SQL Trace output.  Trace is captured that contains the queries that you want DTA to analyze.  The trace output is read and evaluated by DTA against a database.  The recommendations that DTA can make are:  Adding indexes.  Dropping indexes.  Partitioning tables.  Storage aligning tables.
  • 4.  Using the Database Engine Tuning Advisor  The source of a DTA workload can be :  A trace file.  Transact-SQL (T-SQL) script.  A table that contains T-SQL commands.  The only events that DTA is concerned about are:  RPC:Starting  RPC:Completed  SQL:Batch Starting  SQL:Batch Completed
  • 5.  Using the Database Engine Tuning Advisor  An analysis is accomplished with four steps: 1. Generate a workload for analysis. 2. Start DTA and connect to a server running SQ Server that contains a database to analyze the workload against. 3. Select the workload to use. 4. Specify tuning options  Analysis within DTA is performed in a session.  Each session must have a name and is saved so that you can review the results at a later date.  The most common way of performing an analysis is with a file which either contains the output of a trace or contains one or more T-SQL commands.
  • 6.  Using the Database Engine Tuning Advisor  Creating a DTA analysis session
  • 7.  Using the Database Engine Tuning Advisor  DTA is the graphical utility with which you interact  Analysis within DTA is performed in a session.  Each session must have a name and is saved so that you can review the results at a later date  DTA analyzes the cost of a specified query against each possible recommendation.  Query cost is generated by the query optimizer based on distribution statistics.  DTA can analyze queries and stored procedures that are stored in either a file or a table. The most common tuning source for DTA is a trace output file.
  • 8.  Using the Database Engine Tuning Advisor  There are four groups of tuning options:  Time limitations and online actions  Existing structures in the database  Partitioning options  Whether to retain existing structures in the database
  • 9.  Working With Resource Governor  The Resource Governor is a new feature in the Microsoft® SQL Server® 2008 Enterprise.  Resource Governor is a feature that you can use to manage SQL Server workload and system resource consumption.  Resource Governor enables you to limit the amount of CPU and memory that incoming application requests can use.  The resources that can be managed by Resource Governor are CPU and memory.  Resource Governor works with three components:  Resource pools.  Workload groups.  Classification functions.  A Resource pool defines the minimum and maximum CPU, memory, or both allocated to a resource pool.  By default, there are two resource pools: Internal and Default. You cannot alter the internal pool in any way, and it has priority over all other pools, But you can alter the default pool.  Workload groups are a set of requests you define, so that Resource Governor can assign the connection to the appropriate Resource pool.
  • 10.  Working With Resource Governor  A Classification Function is a function that you create in the master database. Only ONE classification function can be active for Resource Governor at a time.  The classification function cannot have any input parameters and is required to return a scalar value.  The value that is returned is the name of the workload group that the session should be classified into.  The classification function can contain any code that is valid for a function, but you should minimize the amount of code in any classification function.  Because the classification function executes after authentication but before a connection handle is returned to the user’s application.  the classification function is executed for every new connection to your instance.
  • 11.  How Does Resource Governor Work?
  • 12.  Using Dynamic Management Views and Functions  Dynamic Management Views (DMV) and Dynamic Management Functions (DMF) provide the instrumentation infrastructure that allows database administrators to retrieve system information as well as monitor, diagnose, and fix problems.  DMV Categories  DMVs are all stored in the Sysschema DMV Prefix General Purpose dm_db_* General database space and index utilization dm_exec_* Statistics for queries that are executing, as well as queries that have completed and still have plans in the query cache dm_io_* Disk subsystem statistics dm_os_* Statistics related to the use of hardware resources Most important DMV categories that are used for performance tuning.
  • 13.  Using Dynamic Management Views and Functions  Database Statistics The most common DMVs used to gather database statistics are:  sys.dm_db_index_usage_stats  sys.dm_db_index_operational_stats  sys.dm_db_index_physical_stats  sys.dm_db_missing_index_groups  sys.dm_db_missing_index_group_stats  sys.dm_db_missing_index_details  Indexes are created to improve performance of specific queries. But Having an insufficient number of indexes can cause performance problems.  The sys.dm_db_index_usage_stats view contains the number of times (and the last time) each index was used to satisfy a seek, scan, or lookup, as well as the number of times and the last time an update was performed to each index.
  • 14.  Using Dynamic Management Views and Functions  Database Statistics  Sys.dm_db_index_operational_stats (database_id, object_id, index_id, partition_id) This function returns locking, latching, and access statistics for each index that can help you determine how heavily an index is being used. This function also helps you diagnose contention issues due to locking and latching.  Sys.dm_db_index_physical_stats (database_id, object_id, index_id, partition_id, and mode) The function returns size and fragmentation statistics for each index and should be the primary source for determining when an index needs to be defragmented.
  • 15.  Using Dynamic Management Views and Functions  Query Statistics  Return information related to connection to the instance, as well as query execution.  Sys.dm_exec_connections : contains one row for each connection to the instance.  Sys.dm_exec_sessions : contains a row for each currently authenticated session, also returns the accumulated reads, writes, CPU, and query execution duration for the session.  Sys.dm_exec_requests : contains one row for each currently executing request in the instance, also you can retrieve the database and command being executed.  sys.dm_exec_query_stats : contains detailed statistics on the performance and resources consumed for every query in the query cache  SQL Server stores the query plan and text of each query executed in the query cache, identified by a unique value called the handle.  sys.dm_exec_sql_text : returns the text of the SQL statement associated to the handle that was passed in.  sys.dm_exec_query_plan : accepts a plan handle and returns the corresponding XML showplan.
  • 16.  Using Dynamic Management Views and Functions  Query Statistics SELECT * FROM (SELECT user_seeks * avg_total_user_cost * (avg_user_impact * 0.01) AS index_advantage, migs.* FROM sys.dm_db_missing_index_group_stats migs) AS migs_adv INNER JOIN sys.dm_db_missing_index_groups AS mig ON migs_adv.group_handle = mig.index_group_handle INNER JOIN sys.dm_db_missing_index_details AS mid ON mig.index_handle = mid.index_handle ) ORDER BY migs_adv.index_advantage  Determining which indexes to create  The query that you can use to calculate a “usefulness factor” is :
  • 17.  Using Dynamic Management Views and Functions  Query Statistics  To return the query and XML show plan for all currently executing queries, you could use the following statement: SELECT * FROM sys.dm_exec_requests CROSS APPLY sys.dm_exec_query_plan(plan_handle) CROSS APPLY sys.dm_exec_sql_text(sql_handle)  To return the SQL statement and XML show plan for every query that is cached in the query cache: SELECT * FROM sys.dm_exec_query_stats CROSS APPLY sys.dm_exec_query_plan(plan_handle) CROSS APPLY sys.dm_exec_sql_text(sql_handle)
  • 18.  Using Dynamic Management Views and Functions  Disk Subsystem Statistics  sys.dm_io_virtual_file_stats Returns statistics about the reads and writes for everydatabase file.  sys.dm_io_pending_requests Contains a row for each request that is waiting forthe disk subsystem to complete an I/O request
  • 19. 1. What types of workloads can DTA use for analysis? (Choose all that apply.) A. A T-SQL script B. A trace file containing Extensible Markup Language (XML) showplans C. A trace file containing RPC:Completedevents D. A trace file containing SP:StmtCompletedevents
  • 20. 2. You are the database administrator at Coho Vineyards. Following the consolidation of all the wineries’ inventory, customer, and order databases, the marketing group wants to be able to run ad hoc queries for analysis purposes. Users are allowed to execute any query that they can construct, regardless of the impact it might have on the performance of the database. Unfortunately, the same databases are being used to create and process customer orders. Management does not want to restrict the queries that marketing can execute, but it wants you to ensure that customer orders can be created and processed in a timely fashion. What can be used to limit the impact of marketing queries to ensure customer orders are processed? A. Configure the max degree of parallelism option. B. Implement Resource Governor. C. Configure the query governor cost threshold. D. Limit the memory utilization for marketing users
  翻译: