SlideShare a Scribd company logo
1 of 21
By Raluca Marcu
Performance
Tuning And
Optimization
Microsoft SQL
Database
About me…
Education & Certifications
Experience - MSSQL DBA & Dev - 6+ years
Contact
Performance Issues
Logical Optimization
Administrative Optimization
 System Configurations
 Capacity Planning
 Monitoring & Maintenance – Indexes & Statistics Maintenance
 DB Architecture
 DB Design
 Coding – Refactoring TSQL
 Common Symptoms
 Common Causes
 Tools to use
Performance Issues - Common Symptoms
CPU bottlenecks
– Identify occasional peaks in processor vs. processor is
constantly under pressure
Memory bottlenecks
– Can result in slow application responsiveness, overall system
slowdown, or even application crashing
Network bottlenecks
– Hard to recognize and easy to confuse
I/O bottlenecks
– Manifested through long response times, application
slowdowns and tasks time-outs
Slow running queries
Performance Issues - Common Causes
CPU bottlenecks
– Insufficient hardware resources
– Badly designed processes -> Query tuning, improving execution plans, and
system reconfiguration
Memory bottlenecks
– Limitations in available memory and memory pressure
– Poor indexing (table scans)
Network bottlenecks
– Overload on a server or network -> data cannot flow as expected
I/O bottlenecks
– Caused by slow hardware used, bad storage solution design, configuration
– Unnecessary requests made by a database -> affects I/O traffic
– Frequent index scans, inefficient queries, and out of date statistics
Slow running queries
– Missing indexes, poor execution plans, bad application and schema design
Performance Issues – Tools to use: DMVs
Processor Pressure -> sys.dm_os_performance_counters
• counter type -> values shown are cumulative since the last SQL Server start => re-run in about 10
seconds
• Batch Requests/sec -> depends on hardware used -> should be under 1000
• SQL Compilations/sec -> less than 10% of Batch Requests/sec
• SQL Re-Compilations/sec -> less than 10% of SQL Compilations/sec
• Checkpoint pages/sec and Lazy writes/sec -> indicate whether dirty pages are flushed to disk too
often
• Lazy Writes/sec -> value should be below 20; value is constantly above => check Page Life
Expectancy -> Values < 300 seconds => memory pressure
Performance Issues – Tools to use: DMVs
CPU performance bottlenecks -> sys.dm_os_wait_stats
Performance Issues – Tools to use
Performance Monitor
Counters Description Recom
mende
d
value
Issue
Processor
Time
CPU Time <80% constantly higher than 80% =>
processor is under pressure
Memory
Available KB
Available Memory > 200
MB
< 100 MB for long time =>
insufficient memory on the server
Pages/sec shows the rate at which the pages are
written from disk to RAM and read from
RAM to disk
> 50 >50 => intensive memory activity
and possible overhead and memory
pressure
Buffer Cache
Hit Ratio 
shows the ratio of the data pages found
and read from the SQL Server buffer
cache and all data page requests
> 90 If a page doesn’t exist in the buffer
cache, it has to be read disk, which
downgrades performance
Average Disk
Queue Length
the average number of I/O operations that
are waiting to be written to or read from
disk and the number of currently
processed reads and writes
< 2 per
individu
al disk
higher values => I/O bottlenecks
Average Disk
Sec/Read
the average time in seconds needed to
read data from disk
< 8ms > 20ms => serious I/O issue
Average Disk
Sec/Write
the average time in seconds needed to
write data to disk
< 1ms > 4ms => bad performance
Performance Issues – Tools to use
SQL Server Profiler
– Which queries, functions and stored procedures were executed
– Track deadlocks
Administration Optimization – System Configurations
■ Install SQL Server on a 64bit system (never 32bit)
■ Max Server Memory – 80% -> 90%
■ Cost Threshold for Parallelism – between 20 and 50
■ Transactional Log -> VLFs, default value, default auto-
growth, maintenance, shrink
Administration Optimization – Capacity Planning
■ Random I/O separated from Sequential I/O
■ Separate large indexes and/or specific tables to
separate disks
■ Data partitioning
■ Database auto-growth
Monitoring & Maintenance – Indexes &
Statistics Maintenance
■ Maintenance Solution – Ola Hallengren (Free
Solution)
■ Indexes
■ Statistics - DBCC SHOW_STATISTICS
■ Backup & Recovery Strategies – RPO & RTO
– Always -> Create the recovery strategy and then work towards the
Backups
Logical Optimization – DB Architecture
■ Data access
– Proper indexing and defragmentation - Database Tuning Advisor's
– Move TSQL code from app into db – no ORMs
– Identify inefficient TSQL, re-factor
■ Scale-up vs scale-out:
– https://www.youtube.com/watch?
v=kZOREEkYJKs
Logical Optimization – DB Design
1NF (first Normal
Form)
Eliminate duplicative
columns from the same
table.
Create separate tables for
each group of related data
and identify each row with
a unique column or set of
columns (the primary key).
2NF (second Normal
Form)
Meet the requirements of
1NF.
Remove subsets of data
that apply to multiple rows
of a table and place them
in separate tables.
Create relationships
between these new tables
and their predecessors
through the use of foreign
keys.
3NF (third Normal
Form)
Meet the requirements of
2NF.
Remove columns that are
not dependent upon the
primary key.
Normalization
• 5 (+1) normal forms, noted 1NF to 5NF (+ 3.5NF or BCNF)
• 3NF – eliminate redundant data, ensure data integrity and
atomicity, eliminate data modification anomalies
Logical Optimization – DB Design
De-Normalize:
– Performance – in practice a fully normalized database may incur
costly queries for assembling the required data.
– Complexity – fully normalizing a database may lead to a big number
of tables, making the database difficult to understand and
maintain.
– Project requirements – for some specific project types the effort of
elaborating a good design is not justified.
Caution: when de-normalizing a database, extra care must be
taken about data integrity.
Logical Optimization – Coding
■ Query Plan:
– Actual Query Plan vs. Estimated Query Plan
– DBCC FREEPROCCACHE
– Live example
Logical Optimization – Coding
■ Query Plan:
– Statistics & Indexes
Logical Optimization – Coding
Logical Optimization – Coding Best Practices
Triggers
– Avoid using them
– Never use the same trigger for different triggering events (Insert, Update,
Delete)
Views
– Use SCHEMABINNDING option -> users will not modify the tables schema
– Use views for writing queries that access columns from multiple tables
Transactions
– Handle errors (Try-Catch Block)
– Try to avoid nested transactions
– Reduce the time period of resource locking (begin -> commit/rollback fast)
Stored procedures
– Do not use "SP_XXX" as a naming convention
– Use "Set Nocount On" to eliminate extra network trip
– Use WITH RECOMPILE clause (EXECUTE statement-first time) when the
index structure changes
Thank you…
Q & A Time!
Q&A…
1. Big data SQL server
2. How can get the best performing in .Net MVC
3. The Cluster deployment model for SQL? Optimal model with a hardware resources
sufficient for the problems need large data storage, much access read-write – cluster
failover
4. According to my experience there is a pretty common problem during removal must
anticipate that retrieve data for a list such as a list of products. Here the problem is
that we often have to run through a loop to get the data for each product and
information relating to the product eg price, variant, size, images .... This will create
numerous query. The usual way to do it will not always try to put away once all the
data of all such products take the price of all products one by one, taking all the
variant of a turn and when I need to show to get this data from memory without recall
db This will limit the number of queries to the database. But to do so beautiful, are
not a simple problem? Speakers said there are ways to do this are not you?

More Related Content

What's hot

Hudi: Large-Scale, Near Real-Time Pipelines at Uber with Nishith Agarwal and ...
Hudi: Large-Scale, Near Real-Time Pipelines at Uber with Nishith Agarwal and ...Hudi: Large-Scale, Near Real-Time Pipelines at Uber with Nishith Agarwal and ...
Hudi: Large-Scale, Near Real-Time Pipelines at Uber with Nishith Agarwal and ...Databricks
 
A Thorough Comparison of Delta Lake, Iceberg and Hudi
A Thorough Comparison of Delta Lake, Iceberg and HudiA Thorough Comparison of Delta Lake, Iceberg and Hudi
A Thorough Comparison of Delta Lake, Iceberg and HudiDatabricks
 
Sql Server Performance Tuning
Sql Server Performance TuningSql Server Performance Tuning
Sql Server Performance TuningBala Subra
 
Oracle db performance tuning
Oracle db performance tuningOracle db performance tuning
Oracle db performance tuningSimon Huang
 
Redis + Apache Spark = Swiss Army Knife Meets Kitchen Sink
Redis + Apache Spark = Swiss Army Knife Meets Kitchen SinkRedis + Apache Spark = Swiss Army Knife Meets Kitchen Sink
Redis + Apache Spark = Swiss Army Knife Meets Kitchen SinkDatabricks
 
ClickHouse Query Performance Tips and Tricks, by Robert Hodges, Altinity CEO
ClickHouse Query Performance Tips and Tricks, by Robert Hodges, Altinity CEOClickHouse Query Performance Tips and Tricks, by Robert Hodges, Altinity CEO
ClickHouse Query Performance Tips and Tricks, by Robert Hodges, Altinity CEOAltinity Ltd
 
Iceberg: A modern table format for big data (Strata NY 2018)
Iceberg: A modern table format for big data (Strata NY 2018)Iceberg: A modern table format for big data (Strata NY 2018)
Iceberg: A modern table format for big data (Strata NY 2018)Ryan Blue
 
Real-time Data Streaming from Oracle to Apache Kafka
Real-time Data Streaming from Oracle to Apache Kafka Real-time Data Streaming from Oracle to Apache Kafka
Real-time Data Streaming from Oracle to Apache Kafka confluent
 
Considerations for Data Access in the Lakehouse
Considerations for Data Access in the LakehouseConsiderations for Data Access in the Lakehouse
Considerations for Data Access in the LakehouseDatabricks
 
PostgreSQL and Benchmarks
PostgreSQL and BenchmarksPostgreSQL and Benchmarks
PostgreSQL and BenchmarksJignesh Shah
 
A Day in the Life of a ClickHouse Query Webinar Slides
A Day in the Life of a ClickHouse Query Webinar Slides A Day in the Life of a ClickHouse Query Webinar Slides
A Day in the Life of a ClickHouse Query Webinar Slides Altinity Ltd
 
Apache Iceberg - A Table Format for Hige Analytic Datasets
Apache Iceberg - A Table Format for Hige Analytic DatasetsApache Iceberg - A Table Format for Hige Analytic Datasets
Apache Iceberg - A Table Format for Hige Analytic DatasetsAlluxio, Inc.
 
Less01 architecture
Less01 architectureLess01 architecture
Less01 architectureAmit Bhalla
 
Oracle database performance tuning
Oracle database performance tuningOracle database performance tuning
Oracle database performance tuningYogiji Creations
 
Delta Lake OSS: Create reliable and performant Data Lake by Quentin Ambard
Delta Lake OSS: Create reliable and performant Data Lake by Quentin AmbardDelta Lake OSS: Create reliable and performant Data Lake by Quentin Ambard
Delta Lake OSS: Create reliable and performant Data Lake by Quentin AmbardParis Data Engineers !
 
ClickHouse in Real Life. Case Studies and Best Practices, by Alexander Zaitsev
ClickHouse in Real Life. Case Studies and Best Practices, by Alexander ZaitsevClickHouse in Real Life. Case Studies and Best Practices, by Alexander Zaitsev
ClickHouse in Real Life. Case Studies and Best Practices, by Alexander ZaitsevAltinity Ltd
 
What to Expect From Oracle database 19c
What to Expect From Oracle database 19cWhat to Expect From Oracle database 19c
What to Expect From Oracle database 19cMaria Colgan
 
Using ClickHouse for Experimentation
Using ClickHouse for ExperimentationUsing ClickHouse for Experimentation
Using ClickHouse for ExperimentationGleb Kanterov
 
Actionable Insights with AI - Snowflake for Data Science
Actionable Insights with AI - Snowflake for Data ScienceActionable Insights with AI - Snowflake for Data Science
Actionable Insights with AI - Snowflake for Data ScienceHarald Erb
 
Oracle database performance tuning
Oracle database performance tuningOracle database performance tuning
Oracle database performance tuningAbishek V S
 

What's hot (20)

Hudi: Large-Scale, Near Real-Time Pipelines at Uber with Nishith Agarwal and ...
Hudi: Large-Scale, Near Real-Time Pipelines at Uber with Nishith Agarwal and ...Hudi: Large-Scale, Near Real-Time Pipelines at Uber with Nishith Agarwal and ...
Hudi: Large-Scale, Near Real-Time Pipelines at Uber with Nishith Agarwal and ...
 
A Thorough Comparison of Delta Lake, Iceberg and Hudi
A Thorough Comparison of Delta Lake, Iceberg and HudiA Thorough Comparison of Delta Lake, Iceberg and Hudi
A Thorough Comparison of Delta Lake, Iceberg and Hudi
 
Sql Server Performance Tuning
Sql Server Performance TuningSql Server Performance Tuning
Sql Server Performance Tuning
 
Oracle db performance tuning
Oracle db performance tuningOracle db performance tuning
Oracle db performance tuning
 
Redis + Apache Spark = Swiss Army Knife Meets Kitchen Sink
Redis + Apache Spark = Swiss Army Knife Meets Kitchen SinkRedis + Apache Spark = Swiss Army Knife Meets Kitchen Sink
Redis + Apache Spark = Swiss Army Knife Meets Kitchen Sink
 
ClickHouse Query Performance Tips and Tricks, by Robert Hodges, Altinity CEO
ClickHouse Query Performance Tips and Tricks, by Robert Hodges, Altinity CEOClickHouse Query Performance Tips and Tricks, by Robert Hodges, Altinity CEO
ClickHouse Query Performance Tips and Tricks, by Robert Hodges, Altinity CEO
 
Iceberg: A modern table format for big data (Strata NY 2018)
Iceberg: A modern table format for big data (Strata NY 2018)Iceberg: A modern table format for big data (Strata NY 2018)
Iceberg: A modern table format for big data (Strata NY 2018)
 
Real-time Data Streaming from Oracle to Apache Kafka
Real-time Data Streaming from Oracle to Apache Kafka Real-time Data Streaming from Oracle to Apache Kafka
Real-time Data Streaming from Oracle to Apache Kafka
 
Considerations for Data Access in the Lakehouse
Considerations for Data Access in the LakehouseConsiderations for Data Access in the Lakehouse
Considerations for Data Access in the Lakehouse
 
PostgreSQL and Benchmarks
PostgreSQL and BenchmarksPostgreSQL and Benchmarks
PostgreSQL and Benchmarks
 
A Day in the Life of a ClickHouse Query Webinar Slides
A Day in the Life of a ClickHouse Query Webinar Slides A Day in the Life of a ClickHouse Query Webinar Slides
A Day in the Life of a ClickHouse Query Webinar Slides
 
Apache Iceberg - A Table Format for Hige Analytic Datasets
Apache Iceberg - A Table Format for Hige Analytic DatasetsApache Iceberg - A Table Format for Hige Analytic Datasets
Apache Iceberg - A Table Format for Hige Analytic Datasets
 
Less01 architecture
Less01 architectureLess01 architecture
Less01 architecture
 
Oracle database performance tuning
Oracle database performance tuningOracle database performance tuning
Oracle database performance tuning
 
Delta Lake OSS: Create reliable and performant Data Lake by Quentin Ambard
Delta Lake OSS: Create reliable and performant Data Lake by Quentin AmbardDelta Lake OSS: Create reliable and performant Data Lake by Quentin Ambard
Delta Lake OSS: Create reliable and performant Data Lake by Quentin Ambard
 
ClickHouse in Real Life. Case Studies and Best Practices, by Alexander Zaitsev
ClickHouse in Real Life. Case Studies and Best Practices, by Alexander ZaitsevClickHouse in Real Life. Case Studies and Best Practices, by Alexander Zaitsev
ClickHouse in Real Life. Case Studies and Best Practices, by Alexander Zaitsev
 
What to Expect From Oracle database 19c
What to Expect From Oracle database 19cWhat to Expect From Oracle database 19c
What to Expect From Oracle database 19c
 
Using ClickHouse for Experimentation
Using ClickHouse for ExperimentationUsing ClickHouse for Experimentation
Using ClickHouse for Experimentation
 
Actionable Insights with AI - Snowflake for Data Science
Actionable Insights with AI - Snowflake for Data ScienceActionable Insights with AI - Snowflake for Data Science
Actionable Insights with AI - Snowflake for Data Science
 
Oracle database performance tuning
Oracle database performance tuningOracle database performance tuning
Oracle database performance tuning
 

Viewers also liked

Software architecture for high traffic website
Software architecture for high traffic websiteSoftware architecture for high traffic website
Software architecture for high traffic websiteTung Nguyen Thanh
 
New in Visual Studio and TFS 2013
New in Visual Studio and TFS 2013New in Visual Studio and TFS 2013
New in Visual Studio and TFS 2013Tung Nguyen Thanh
 
SQL Cursor - kiểu dữ liệu Cursor (Kiểu dữ liệu con trỏ)
SQL Cursor - kiểu dữ liệu Cursor (Kiểu dữ liệu con trỏ)SQL Cursor - kiểu dữ liệu Cursor (Kiểu dữ liệu con trỏ)
SQL Cursor - kiểu dữ liệu Cursor (Kiểu dữ liệu con trỏ)Pix Nhox
 
Tối ưu-cau-lệnh-oracle-sql
Tối ưu-cau-lệnh-oracle-sqlTối ưu-cau-lệnh-oracle-sql
Tối ưu-cau-lệnh-oracle-sqlViet Tran
 
SQL Server Optimization Checklist
SQL Server Optimization ChecklistSQL Server Optimization Checklist
SQL Server Optimization ChecklistGrant Fritchey
 
TSQL Advanced Query Techniques
TSQL Advanced Query TechniquesTSQL Advanced Query Techniques
TSQL Advanced Query TechniquesGianluca Sartori
 
Monitoring Oracle Database Instances with Zabbix
Monitoring Oracle Database Instances with ZabbixMonitoring Oracle Database Instances with Zabbix
Monitoring Oracle Database Instances with ZabbixGerger
 
Intro To TSQL - Unit 1
Intro To TSQL - Unit 1Intro To TSQL - Unit 1
Intro To TSQL - Unit 1iccma
 
Continuous Delivery with VS2015 and TFS2015
Continuous Delivery with VS2015 and TFS2015Continuous Delivery with VS2015 and TFS2015
Continuous Delivery with VS2015 and TFS2015Tung Nguyen Thanh
 
7a advanced tsql
7a   advanced tsql7a   advanced tsql
7a advanced tsqlNauman R
 
Visual studio 2015 ide new features
Visual studio 2015 ide new featuresVisual studio 2015 ide new features
Visual studio 2015 ide new featuresTung Nguyen Thanh
 
Chuong 4 - CSDL phân tán
Chuong 4 - CSDL phân tánChuong 4 - CSDL phân tán
Chuong 4 - CSDL phân tánduysu
 
Dữ liệu không gian trên SQL Server - (Spatial Data in SQL Server)
Dữ liệu không gian trên SQL Server - (Spatial Data in SQL Server)Dữ liệu không gian trên SQL Server - (Spatial Data in SQL Server)
Dữ liệu không gian trên SQL Server - (Spatial Data in SQL Server)Truong Ho
 
التحدى 6 الإستعلام بطريقة المعالج
التحدى 6 الإستعلام بطريقة المعالجالتحدى 6 الإستعلام بطريقة المعالج
التحدى 6 الإستعلام بطريقة المعالجbosy sadek
 
Lesson4 Protect and maintain databases
Lesson4 Protect and maintain databases Lesson4 Protect and maintain databases
Lesson4 Protect and maintain databases Abdullatif Tarakji
 

Viewers also liked (20)

Software architecture for high traffic website
Software architecture for high traffic websiteSoftware architecture for high traffic website
Software architecture for high traffic website
 
SignalR with ASP.NET MVC 6
SignalR with ASP.NET MVC 6SignalR with ASP.NET MVC 6
SignalR with ASP.NET MVC 6
 
New in Visual Studio and TFS 2013
New in Visual Studio and TFS 2013New in Visual Studio and TFS 2013
New in Visual Studio and TFS 2013
 
SQL Cursor - kiểu dữ liệu Cursor (Kiểu dữ liệu con trỏ)
SQL Cursor - kiểu dữ liệu Cursor (Kiểu dữ liệu con trỏ)SQL Cursor - kiểu dữ liệu Cursor (Kiểu dữ liệu con trỏ)
SQL Cursor - kiểu dữ liệu Cursor (Kiểu dữ liệu con trỏ)
 
Tối ưu-cau-lệnh-oracle-sql
Tối ưu-cau-lệnh-oracle-sqlTối ưu-cau-lệnh-oracle-sql
Tối ưu-cau-lệnh-oracle-sql
 
Refactoring code in .net
Refactoring code in .netRefactoring code in .net
Refactoring code in .net
 
SQL Server Optimization Checklist
SQL Server Optimization ChecklistSQL Server Optimization Checklist
SQL Server Optimization Checklist
 
TSQL Advanced Query Techniques
TSQL Advanced Query TechniquesTSQL Advanced Query Techniques
TSQL Advanced Query Techniques
 
Monitoring Oracle Database Instances with Zabbix
Monitoring Oracle Database Instances with ZabbixMonitoring Oracle Database Instances with Zabbix
Monitoring Oracle Database Instances with Zabbix
 
Intro To TSQL - Unit 1
Intro To TSQL - Unit 1Intro To TSQL - Unit 1
Intro To TSQL - Unit 1
 
Continuous Delivery with VS2015 and TFS2015
Continuous Delivery with VS2015 and TFS2015Continuous Delivery with VS2015 and TFS2015
Continuous Delivery with VS2015 and TFS2015
 
7a advanced tsql
7a   advanced tsql7a   advanced tsql
7a advanced tsql
 
Visual studio 2015 ide new features
Visual studio 2015 ide new featuresVisual studio 2015 ide new features
Visual studio 2015 ide new features
 
Chuong 4 - CSDL phân tán
Chuong 4 - CSDL phân tánChuong 4 - CSDL phân tán
Chuong 4 - CSDL phân tán
 
Dữ liệu không gian trên SQL Server - (Spatial Data in SQL Server)
Dữ liệu không gian trên SQL Server - (Spatial Data in SQL Server)Dữ liệu không gian trên SQL Server - (Spatial Data in SQL Server)
Dữ liệu không gian trên SQL Server - (Spatial Data in SQL Server)
 
التحدى 6 الإستعلام بطريقة المعالج
التحدى 6 الإستعلام بطريقة المعالجالتحدى 6 الإستعلام بطريقة المعالج
التحدى 6 الإستعلام بطريقة المعالج
 
Trabalho fitos digitais
Trabalho fitos digitaisTrabalho fitos digitais
Trabalho fitos digitais
 
Lesson4 Protect and maintain databases
Lesson4 Protect and maintain databases Lesson4 Protect and maintain databases
Lesson4 Protect and maintain databases
 
Lesson8 Manage Records
Lesson8 Manage RecordsLesson8 Manage Records
Lesson8 Manage Records
 
Lesson11 Create Query
Lesson11 Create QueryLesson11 Create Query
Lesson11 Create Query
 

Similar to Performance Tuning And Optimization Microsoft SQL Database

Database Systems Design, Implementation, and Management
Database Systems Design, Implementation, and ManagementDatabase Systems Design, Implementation, and Management
Database Systems Design, Implementation, and ManagementOllieShoresna
 
Dynamics ax performance tuning
Dynamics ax performance tuningDynamics ax performance tuning
Dynamics ax performance tuningOutsourceAX
 
Database performance tuning and query optimization
Database performance tuning and query optimizationDatabase performance tuning and query optimization
Database performance tuning and query optimizationDhani Ahmad
 
collab2011-tuning-ebusiness-421966.pdf
collab2011-tuning-ebusiness-421966.pdfcollab2011-tuning-ebusiness-421966.pdf
collab2011-tuning-ebusiness-421966.pdfElboulmaniMohamed
 
Java Developers, make the database work for you (NLJUG JFall 2010)
Java Developers, make the database work for you (NLJUG JFall 2010)Java Developers, make the database work for you (NLJUG JFall 2010)
Java Developers, make the database work for you (NLJUG JFall 2010)Lucas Jellema
 
SQL Server 2008 Development for Programmers
SQL Server 2008 Development for ProgrammersSQL Server 2008 Development for Programmers
SQL Server 2008 Development for ProgrammersAdam Hutson
 
Presentation cloud control enterprise manager 12c
Presentation   cloud control enterprise manager 12cPresentation   cloud control enterprise manager 12c
Presentation cloud control enterprise manager 12cxKinAnx
 
Best storage engine for MySQL
Best storage engine for MySQLBest storage engine for MySQL
Best storage engine for MySQLtomflemingh2
 
Troubleshooting SQL Server
Troubleshooting SQL ServerTroubleshooting SQL Server
Troubleshooting SQL ServerStephen Rose
 
Collaborate 2011-tuning-ebusiness-416502
Collaborate 2011-tuning-ebusiness-416502Collaborate 2011-tuning-ebusiness-416502
Collaborate 2011-tuning-ebusiness-416502kaziul Islam Bulbul
 
Real World Performance - OLTP
Real World Performance - OLTPReal World Performance - OLTP
Real World Performance - OLTPConnor McDonald
 
Sql server troubleshooting
Sql server troubleshootingSql server troubleshooting
Sql server troubleshootingNathan Winters
 
MySQL & Expression Engine EEUK2013
MySQL & Expression Engine EEUK2013MySQL & Expression Engine EEUK2013
MySQL & Expression Engine EEUK2013EEvolutionUK
 
Geek Sync | Performance Tune Like an MVP
Geek Sync | Performance Tune Like an MVPGeek Sync | Performance Tune Like an MVP
Geek Sync | Performance Tune Like an MVPIDERA Software
 
MemSQL 201: Advanced Tips and Tricks Webcast
MemSQL 201: Advanced Tips and Tricks WebcastMemSQL 201: Advanced Tips and Tricks Webcast
MemSQL 201: Advanced Tips and Tricks WebcastSingleStore
 
Maximizing performance via tuning and optimization
Maximizing performance via tuning and optimizationMaximizing performance via tuning and optimization
Maximizing performance via tuning and optimizationMariaDB plc
 
Maximizing performance via tuning and optimization
Maximizing performance via tuning and optimizationMaximizing performance via tuning and optimization
Maximizing performance via tuning and optimizationMariaDB plc
 
Modernizing your database with SQL Server 2019
Modernizing your database with SQL Server 2019Modernizing your database with SQL Server 2019
Modernizing your database with SQL Server 2019Antonios Chatzipavlis
 

Similar to Performance Tuning And Optimization Microsoft SQL Database (20)

Breaking data
Breaking dataBreaking data
Breaking data
 
Database Systems Design, Implementation, and Management
Database Systems Design, Implementation, and ManagementDatabase Systems Design, Implementation, and Management
Database Systems Design, Implementation, and Management
 
Dynamics ax performance tuning
Dynamics ax performance tuningDynamics ax performance tuning
Dynamics ax performance tuning
 
Database performance tuning and query optimization
Database performance tuning and query optimizationDatabase performance tuning and query optimization
Database performance tuning and query optimization
 
collab2011-tuning-ebusiness-421966.pdf
collab2011-tuning-ebusiness-421966.pdfcollab2011-tuning-ebusiness-421966.pdf
collab2011-tuning-ebusiness-421966.pdf
 
Sql Server
Sql ServerSql Server
Sql Server
 
Java Developers, make the database work for you (NLJUG JFall 2010)
Java Developers, make the database work for you (NLJUG JFall 2010)Java Developers, make the database work for you (NLJUG JFall 2010)
Java Developers, make the database work for you (NLJUG JFall 2010)
 
SQL Server 2008 Development for Programmers
SQL Server 2008 Development for ProgrammersSQL Server 2008 Development for Programmers
SQL Server 2008 Development for Programmers
 
Presentation cloud control enterprise manager 12c
Presentation   cloud control enterprise manager 12cPresentation   cloud control enterprise manager 12c
Presentation cloud control enterprise manager 12c
 
Best storage engine for MySQL
Best storage engine for MySQLBest storage engine for MySQL
Best storage engine for MySQL
 
Troubleshooting SQL Server
Troubleshooting SQL ServerTroubleshooting SQL Server
Troubleshooting SQL Server
 
Collaborate 2011-tuning-ebusiness-416502
Collaborate 2011-tuning-ebusiness-416502Collaborate 2011-tuning-ebusiness-416502
Collaborate 2011-tuning-ebusiness-416502
 
Real World Performance - OLTP
Real World Performance - OLTPReal World Performance - OLTP
Real World Performance - OLTP
 
Sql server troubleshooting
Sql server troubleshootingSql server troubleshooting
Sql server troubleshooting
 
MySQL & Expression Engine EEUK2013
MySQL & Expression Engine EEUK2013MySQL & Expression Engine EEUK2013
MySQL & Expression Engine EEUK2013
 
Geek Sync | Performance Tune Like an MVP
Geek Sync | Performance Tune Like an MVPGeek Sync | Performance Tune Like an MVP
Geek Sync | Performance Tune Like an MVP
 
MemSQL 201: Advanced Tips and Tricks Webcast
MemSQL 201: Advanced Tips and Tricks WebcastMemSQL 201: Advanced Tips and Tricks Webcast
MemSQL 201: Advanced Tips and Tricks Webcast
 
Maximizing performance via tuning and optimization
Maximizing performance via tuning and optimizationMaximizing performance via tuning and optimization
Maximizing performance via tuning and optimization
 
Maximizing performance via tuning and optimization
Maximizing performance via tuning and optimizationMaximizing performance via tuning and optimization
Maximizing performance via tuning and optimization
 
Modernizing your database with SQL Server 2019
Modernizing your database with SQL Server 2019Modernizing your database with SQL Server 2019
Modernizing your database with SQL Server 2019
 

More from Tung Nguyen Thanh

How to become senior .net developer
How to become senior .net developerHow to become senior .net developer
How to become senior .net developerTung Nguyen Thanh
 
Domain Driven Design Introduction
Domain Driven Design IntroductionDomain Driven Design Introduction
Domain Driven Design IntroductionTung Nguyen Thanh
 
Agile .NET Development with BDD and Continuous Integration
Agile .NET Development with BDD and Continuous IntegrationAgile .NET Development with BDD and Continuous Integration
Agile .NET Development with BDD and Continuous IntegrationTung Nguyen Thanh
 
HaNoi Net Group Introduction
HaNoi Net Group IntroductionHaNoi Net Group Introduction
HaNoi Net Group IntroductionTung Nguyen Thanh
 
TDD - Test Driven Development
TDD - Test Driven DevelopmentTDD - Test Driven Development
TDD - Test Driven DevelopmentTung Nguyen Thanh
 
How to release every week case study of continuous integration
How to release every week case study of continuous integrationHow to release every week case study of continuous integration
How to release every week case study of continuous integrationTung Nguyen Thanh
 
Workshop fight legacy code write unit test
Workshop fight legacy code write unit testWorkshop fight legacy code write unit test
Workshop fight legacy code write unit testTung Nguyen Thanh
 
Developing windows phone 7 application with silverlight
Developing windows phone 7 application with silverlightDeveloping windows phone 7 application with silverlight
Developing windows phone 7 application with silverlightTung Nguyen Thanh
 
Top 100 .NET Interview Questions and Answers
Top 100 .NET Interview Questions and AnswersTop 100 .NET Interview Questions and Answers
Top 100 .NET Interview Questions and AnswersTung Nguyen Thanh
 
Visual studio2012 tipsandtricks
Visual studio2012 tipsandtricksVisual studio2012 tipsandtricks
Visual studio2012 tipsandtricksTung Nguyen Thanh
 
UI prototyping with ms expression blend sketch flow
UI prototyping with ms expression blend sketch flowUI prototyping with ms expression blend sketch flow
UI prototyping with ms expression blend sketch flowTung Nguyen Thanh
 

More from Tung Nguyen Thanh (16)

How to become senior .net developer
How to become senior .net developerHow to become senior .net developer
How to become senior .net developer
 
Docker for .net developer
Docker for .net developerDocker for .net developer
Docker for .net developer
 
Domain Driven Design Introduction
Domain Driven Design IntroductionDomain Driven Design Introduction
Domain Driven Design Introduction
 
Agile .NET Development with BDD and Continuous Integration
Agile .NET Development with BDD and Continuous IntegrationAgile .NET Development with BDD and Continuous Integration
Agile .NET Development with BDD and Continuous Integration
 
HaNoi Net Group Introduction
HaNoi Net Group IntroductionHaNoi Net Group Introduction
HaNoi Net Group Introduction
 
TDD - Test Driven Development
TDD - Test Driven DevelopmentTDD - Test Driven Development
TDD - Test Driven Development
 
Whatmakesoftwareflexible
WhatmakesoftwareflexibleWhatmakesoftwareflexible
Whatmakesoftwareflexible
 
How to release every week case study of continuous integration
How to release every week case study of continuous integrationHow to release every week case study of continuous integration
How to release every week case study of continuous integration
 
Xp not windows xp
Xp not windows xpXp not windows xp
Xp not windows xp
 
Is xp still extreme
Is xp still extremeIs xp still extreme
Is xp still extreme
 
Workshop fight legacy code write unit test
Workshop fight legacy code write unit testWorkshop fight legacy code write unit test
Workshop fight legacy code write unit test
 
Windows Phone Introduction
Windows Phone IntroductionWindows Phone Introduction
Windows Phone Introduction
 
Developing windows phone 7 application with silverlight
Developing windows phone 7 application with silverlightDeveloping windows phone 7 application with silverlight
Developing windows phone 7 application with silverlight
 
Top 100 .NET Interview Questions and Answers
Top 100 .NET Interview Questions and AnswersTop 100 .NET Interview Questions and Answers
Top 100 .NET Interview Questions and Answers
 
Visual studio2012 tipsandtricks
Visual studio2012 tipsandtricksVisual studio2012 tipsandtricks
Visual studio2012 tipsandtricks
 
UI prototyping with ms expression blend sketch flow
UI prototyping with ms expression blend sketch flowUI prototyping with ms expression blend sketch flow
UI prototyping with ms expression blend sketch flow
 

Recently uploaded

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 

Recently uploaded (20)

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 

Performance Tuning And Optimization Microsoft SQL Database

  • 1. By Raluca Marcu Performance Tuning And Optimization Microsoft SQL Database
  • 2. About me… Education & Certifications Experience - MSSQL DBA & Dev - 6+ years Contact
  • 3. Performance Issues Logical Optimization Administrative Optimization  System Configurations  Capacity Planning  Monitoring & Maintenance – Indexes & Statistics Maintenance  DB Architecture  DB Design  Coding – Refactoring TSQL  Common Symptoms  Common Causes  Tools to use
  • 4. Performance Issues - Common Symptoms CPU bottlenecks – Identify occasional peaks in processor vs. processor is constantly under pressure Memory bottlenecks – Can result in slow application responsiveness, overall system slowdown, or even application crashing Network bottlenecks – Hard to recognize and easy to confuse I/O bottlenecks – Manifested through long response times, application slowdowns and tasks time-outs Slow running queries
  • 5. Performance Issues - Common Causes CPU bottlenecks – Insufficient hardware resources – Badly designed processes -> Query tuning, improving execution plans, and system reconfiguration Memory bottlenecks – Limitations in available memory and memory pressure – Poor indexing (table scans) Network bottlenecks – Overload on a server or network -> data cannot flow as expected I/O bottlenecks – Caused by slow hardware used, bad storage solution design, configuration – Unnecessary requests made by a database -> affects I/O traffic – Frequent index scans, inefficient queries, and out of date statistics Slow running queries – Missing indexes, poor execution plans, bad application and schema design
  • 6. Performance Issues – Tools to use: DMVs Processor Pressure -> sys.dm_os_performance_counters • counter type -> values shown are cumulative since the last SQL Server start => re-run in about 10 seconds • Batch Requests/sec -> depends on hardware used -> should be under 1000 • SQL Compilations/sec -> less than 10% of Batch Requests/sec • SQL Re-Compilations/sec -> less than 10% of SQL Compilations/sec • Checkpoint pages/sec and Lazy writes/sec -> indicate whether dirty pages are flushed to disk too often • Lazy Writes/sec -> value should be below 20; value is constantly above => check Page Life Expectancy -> Values < 300 seconds => memory pressure
  • 7. Performance Issues – Tools to use: DMVs CPU performance bottlenecks -> sys.dm_os_wait_stats
  • 8. Performance Issues – Tools to use Performance Monitor Counters Description Recom mende d value Issue Processor Time CPU Time <80% constantly higher than 80% => processor is under pressure Memory Available KB Available Memory > 200 MB < 100 MB for long time => insufficient memory on the server Pages/sec shows the rate at which the pages are written from disk to RAM and read from RAM to disk > 50 >50 => intensive memory activity and possible overhead and memory pressure Buffer Cache Hit Ratio  shows the ratio of the data pages found and read from the SQL Server buffer cache and all data page requests > 90 If a page doesn’t exist in the buffer cache, it has to be read disk, which downgrades performance Average Disk Queue Length the average number of I/O operations that are waiting to be written to or read from disk and the number of currently processed reads and writes < 2 per individu al disk higher values => I/O bottlenecks Average Disk Sec/Read the average time in seconds needed to read data from disk < 8ms > 20ms => serious I/O issue Average Disk Sec/Write the average time in seconds needed to write data to disk < 1ms > 4ms => bad performance
  • 9. Performance Issues – Tools to use SQL Server Profiler – Which queries, functions and stored procedures were executed – Track deadlocks
  • 10. Administration Optimization – System Configurations ■ Install SQL Server on a 64bit system (never 32bit) ■ Max Server Memory – 80% -> 90% ■ Cost Threshold for Parallelism – between 20 and 50 ■ Transactional Log -> VLFs, default value, default auto- growth, maintenance, shrink
  • 11. Administration Optimization – Capacity Planning ■ Random I/O separated from Sequential I/O ■ Separate large indexes and/or specific tables to separate disks ■ Data partitioning ■ Database auto-growth
  • 12. Monitoring & Maintenance – Indexes & Statistics Maintenance ■ Maintenance Solution – Ola Hallengren (Free Solution) ■ Indexes ■ Statistics - DBCC SHOW_STATISTICS ■ Backup & Recovery Strategies – RPO & RTO – Always -> Create the recovery strategy and then work towards the Backups
  • 13. Logical Optimization – DB Architecture ■ Data access – Proper indexing and defragmentation - Database Tuning Advisor's – Move TSQL code from app into db – no ORMs – Identify inefficient TSQL, re-factor ■ Scale-up vs scale-out: – https://www.youtube.com/watch? v=kZOREEkYJKs
  • 14. Logical Optimization – DB Design 1NF (first Normal Form) Eliminate duplicative columns from the same table. Create separate tables for each group of related data and identify each row with a unique column or set of columns (the primary key). 2NF (second Normal Form) Meet the requirements of 1NF. Remove subsets of data that apply to multiple rows of a table and place them in separate tables. Create relationships between these new tables and their predecessors through the use of foreign keys. 3NF (third Normal Form) Meet the requirements of 2NF. Remove columns that are not dependent upon the primary key. Normalization • 5 (+1) normal forms, noted 1NF to 5NF (+ 3.5NF or BCNF) • 3NF – eliminate redundant data, ensure data integrity and atomicity, eliminate data modification anomalies
  • 15. Logical Optimization – DB Design De-Normalize: – Performance – in practice a fully normalized database may incur costly queries for assembling the required data. – Complexity – fully normalizing a database may lead to a big number of tables, making the database difficult to understand and maintain. – Project requirements – for some specific project types the effort of elaborating a good design is not justified. Caution: when de-normalizing a database, extra care must be taken about data integrity.
  • 16. Logical Optimization – Coding ■ Query Plan: – Actual Query Plan vs. Estimated Query Plan – DBCC FREEPROCCACHE – Live example
  • 17. Logical Optimization – Coding ■ Query Plan: – Statistics & Indexes
  • 19. Logical Optimization – Coding Best Practices Triggers – Avoid using them – Never use the same trigger for different triggering events (Insert, Update, Delete) Views – Use SCHEMABINNDING option -> users will not modify the tables schema – Use views for writing queries that access columns from multiple tables Transactions – Handle errors (Try-Catch Block) – Try to avoid nested transactions – Reduce the time period of resource locking (begin -> commit/rollback fast) Stored procedures – Do not use "SP_XXX" as a naming convention – Use "Set Nocount On" to eliminate extra network trip – Use WITH RECOMPILE clause (EXECUTE statement-first time) when the index structure changes
  • 20. Thank you… Q & A Time!
  • 21. Q&A… 1. Big data SQL server 2. How can get the best performing in .Net MVC 3. The Cluster deployment model for SQL? Optimal model with a hardware resources sufficient for the problems need large data storage, much access read-write – cluster failover 4. According to my experience there is a pretty common problem during removal must anticipate that retrieve data for a list such as a list of products. Here the problem is that we often have to run through a loop to get the data for each product and information relating to the product eg price, variant, size, images .... This will create numerous query. The usual way to do it will not always try to put away once all the data of all such products take the price of all products one by one, taking all the variant of a turn and when I need to show to get this data from memory without recall db This will limit the number of queries to the database. But to do so beautiful, are not a simple problem? Speakers said there are ways to do this are not you?