Cardinality How many rows? Distribution How many distinct values? density How many rows for each distinct value? Used by optimizer A histogram 200 steps.

Slides:



Advertisements
Similar presentations
Youre Smarter than a Database Overcoming the optimizers bad cardinality estimates.
Advertisements

Yukon – What is New Rajesh Gala. Yukon – What is new.NET Framework Programming Data Types Exception Handling Batches Databases Database Engine Administration.
SQL Server X7 Maintenance Considerations Drew Flint Plex Systems, Inc.
Module 3: Creating and Tuning Indexes. Planning Indexes Creating Indexes Optimizing Indexes.
SQL Server performance tuning basics
Hive Index Yongqiang He Software Engineer Facebook Data Infrastructure Team.
SQL Server Storage Engine.  Software architect at Red Gate Software  Responsible for SQL tools: ◦ SQL Compare, SQL Data Compare, SQL Packager ◦ SQL.
Filegroup “Stage A” Filegroup “Stage A” Filegroup “A” Partition 1,2 Filegroup “B” Partition 3,4 Filegroup “C” Partition 5,6 Filegroup “D” Partition.
CSE544 Database Statistics Tuesday, February 15 th, 2011 Dan Suciu , Winter
1 © 2006 Julian Dyke Supplemental Logging Julian Dyke Independent Consultant juliandyke.com Web Version.
SQL Server Compression Estimation Presented by Warwick Rudd –
Statistics That Need Special Attention Joe Chang yahoo
Fan Qi Database Lab 1, com1 #01-08 CS3223 Tutorial 8.
SQL Server 2005 features for VLDBs. SQL Server 2005 features for VLDBs aka (it’s fixed in the next release)
Dave Ballantyne Clear Sky SQL. ›Freelance Database Developer/Designer –Specializing in SQL Server for 15+ years ›SQLLunch –Lunchtime usergroup –London.
Shu J Scott Program Manager for Query Processing SQL Server Relational Engine, Microsoft DAT318.
California State University Common Management Systems TUG Session: April 21, Overview Statistics in CMS PRD / Non-PRD Environments.
Microsoft SQL Server Administration for SAP Performance Monitoring and Tuning.
CS27510 Commercial Database Applications. Maintenance Maintenance Disaster Recovery Disaster Recovery.
Oracle9i Database Administrator: Implementation and Administration 1 Chapter 9 Index Management.
1 Overview of Databases. 2 Content Databases Example: Access Structure Query language (SQL)
Module 7 Reading SQL Server® 2008 R2 Execution Plans.
Other database objects (Sequence). What Is a Sequence? A sequence: Automatically generates sequential numbers Is a sharable object Is typically used to.
Module 5 Planning for SQL Server® 2008 R2 Indexing.
Copyright © Curt Hill The Relational Model of Database Basic organization and terms.
Indexes / Session 2/ 1 of 36 Session 2 Module 3: Types of Indexes Module 4: Maintaining Indexes.
Indexes and Views Unit 7.
Free Sql Server Tools Every Dev Should Have Dave Gorman MCSD,MCDBA.
Maciej Pilecki | Project Botticelli Ltd.. SELECT Bio FROM Speakers WHERE FullName=‘Maciej Pilecki’;  Microsoft Certified Trainer since 2001  SQL Server.
MISSION CRITICAL COMPUTING Siebel Database Considerations.
Maintenance Practices. Goal  Automate the necessary DBA chores to put organizations on the path of having healthier, consistent and more trustworthy.
Pinal Dave Mentor | Solid Quality India |
Virtual techdays INDIA │ august 2010 Filtered Indexes – The unexplored index … Vinod Kumar M │ Microsoft India Technology Evangelist – DB and BI.
8 Copyright © 2005, Oracle. All rights reserved. Gathering Statistics.
SQL SERVER MAINTENANCE PLANS Kat
How to kill SQL Server Performance Håkan Winther.
SQL Server Statistics DEMO SQL Server Statistics SREENI JULAKANTI,MCTS.MCITP,MCP. SQL SERVER Database Administration.
October 15-18, 2013 Charlotte, NC SQL Server Index Internals Tim Chapman Premier Field Engineer.
Scott Fallen Sales Engineer, SQL Sentry Blog: scottfallen.blogspot.com.
Module 6: Creating and Maintaining Indexes. Overview Creating Indexes Understanding Index Creation Options Maintaining Indexes Introducing Statistics.
SQL Server Statistics DEMO SQL Server Statistics SREENI JULAKANTI,MCTS.MCITP SQL SERVER Database Administration.
Indexes 22 Index Table Key Row pointer … WHERE key = 22.
You Inherited a Database Now What? What you should immediately check and start monitoring for. Tim Radney, Senior DBA for a top 40 US Bank President of.
SQL Server Magic Buttons! What are Trace Flags and why should I care? Steinar Andersen, SQL Service Nordic AB Thanks to Thomas Kejser for peer-reviewing.
SQL Server DBA Online TrainingSQL Server DBA Online Training.
SQL Server Statistics and its relationship with Query Optimizer
ASE Optdiag Features including dynamic_histogram
You Inherited a Database Now What?
SQL Server Statistics 101 Travis Whitley Senior Consultant, Oakwood Systems whitleysql.wordpress.com.
Query Tuning without Production Data
Finding more space for your tight environment
Query Tuning without Production Data
Query Tuning without Production Data
Designing Database Solutions for SQL Server
Statistics for beginners
Statistics And New Cardinality Estimator (CE)
Dynamics AX Performance
Statistics for beginners
Hitting the SQL Server “Go Faster” Button
Now where does THAT estimate come from?
Cardinality Estimator 2014/2016
Query Optimization Statistics: The Driving Force Behind Good Performance G. Vern Rabe -
Statistics What are the chances
Statistics: What are they and How do I use them
Hugo Kornelis Now where does THAT estimate come from? The nuts and bolts of cardinality estimation.
Database systems Lecture 6 – Indexes
Ascending Key Problem in SQL Server Large Tables
Statistics for beginners – In-Memory OLTP
You Inherited a Database Now What?
“Magic numbers”, local variable and performance
Presentation transcript:

Cardinality How many rows? Distribution How many distinct values? density How many rows for each distinct value? Used by optimizer A histogram 200 steps max DBCC SHOWSTATISTICS

Index statistics User defined statistics Optimizer created statistics AKA column statistics Filtered FULLSCAN vs SAMPLE Default sampling rate

DBCC SHOW_STATISTICS sys.stats view DMF sys.dm_db_stats_properties (object_id, stats_id) modification_counter sys.sysrscols (DAC) sys.system_internals_partition_columns Which stats were actually used by optimizer?

UPDATE STATISTICS A single one or all stats on a table WITH FULLSCAN | SAMPLE | STATS_STREAM, ROWCOUNT, PAGECOUNT ALL | COLUMN | INDEX NORECOMPUTE Index rebuild (but not reorganize!) Doesn’t update column statistics FULLSCAN is what you get sp_updatestats Updates all stats in the database where rowmodctr > 0 SAMPLE by default

ALTER DATABASE SET AUTO_CREATE_STATISTICS ON SET AUTO_UPDATE_STATISTICS ON SET AUTO_UPDATE_STATISTICS_ASYNC ON Stale statistics during optimization

DBCC SHOW_STATISTICS WITH STATS_STREAM SSMS: Database -> Tasks -> Generate Scripts

Fullscan vs sample Maintenance plans Ascending keys Stale statistics How many row updates trigger update? Do we really need AUTO_UPDATE and AUTO_CREATE?