SQL Server Indexing for the Client Developer

Slides:



Advertisements
Similar presentations
Learningcomputer.com. Using this Tab, you can import data from external sources including but not limited to: Text files Microsoft Access databases Web.
Advertisements

Yukon – What is New Rajesh Gala. Yukon – What is new.NET Framework Programming Data Types Exception Handling Batches Databases Database Engine Administration.
Tuning: overview Rewrite SQL (Leccotech)Leccotech Create Index Redefine Main memory structures (SGA in Oracle) Change the Block Size Materialized Views,
Presented By Akin S Walter-Johnson Ms Principal PeerLabs, Inc
Module 3: Creating and Tuning Indexes. Planning Indexes Creating Indexes Optimizing Indexes.
Denny Cherry Manager of Information Systems MVP, MCSA, MCDBA, MCTS, MCITP.
Working with SQL Server Database Objects
Module 6 Implementing Table Structures in SQL Server ®2008 R2.
SQL Server Storage and Index Structures Physical Data Organization Indexes B-Trees SQL Server Data Access Clustered and Non-Clustered Creating, Altering,
A Guide to MySQL 3. 2 Objectives Start MySQL and learn how to use the MySQL Reference Manual Create a database Change (activate) a database Create tables.
Working with SQL and PL/SQL/ Session 1 / 1 of 27 SQL Server Architecture.
Denny Cherry twitter.com/mrdenny.
DAY 21: MICROSOFT ACCESS – CHAPTER 5 MICROSOFT ACCESS – CHAPTER 6 MICROSOFT ACCESS – CHAPTER 7 Akhila Kondai October 30, 2013.
1 Working with MS SQL Server II. 2 The sqlcmd Utility Command line utility for MS SQL Server databases. Previous version called osql Available on classroom.
Overview SQL Server 2008 Overview Presented by Tarek Ghazali IT Technical Specialist Microsoft SQL Server MVP, MCTS Microsoft Web Development MCP ITIL.
Denny Cherry Senior Database Administrator / Architect MVP, MCSA, MCDBA, MCTS, MCITP.
Performing Indexing and Full-Text Searching Lesson 21.
Physical Database Design & Performance. Optimizing for Query Performance For DBs with high retrieval traffic as compared to maintenance traffic, optimizing.
TEMPDB Capacity Planning. Indexing Advantages – Increases performance – SQL server do not have to search all the rows. – Performance, Concurrency, Required.
Denny Cherry Manager of Information Systems MVP, MCSA, MCDBA, MCTS, MCITP.
Denny Cherry Manager of Information Systems twitter.com/mrdenny MVP, MCSA, MCDBA, MCTS, MCITP.
Module 5 Planning for SQL Server® 2008 R2 Indexing.
CPS120: Introduction to Computer Science Lecture 19 Introduction to SQL.
Structure Query Language SQL. Database Terminology Employee ID 3 3 Last name Small First name Tony 5 5 Smith James
Table Indexing for the.NET Developer Denny Cherry twitter.com/mrdenny.
Database Design and Management CPTG /23/2015Chapter 12 of 38 Functions of a Database Store data Store data School: student records, class schedules,
Denny Cherry twitter.com/mrdenny.
Denny Cherry twitter.com/mrdenny.
Indexes / Session 2/ 1 of 36 Session 2 Module 3: Types of Indexes Module 4: Maintaining Indexes.
Denny Cherry Manager of Information Systems twitter.com/mrdenny MVP, MCSA, MCDBA, MCTS, MCITP.
Database Fundamental & Design by A.Surasit Samaisut Copyrights : All Rights Reserved.
SQL/Lesson 7/Slide 1 of 32 Implementing Indexes Objectives In this lesson, you will learn to: * Create a clustered index * Create a nonclustered index.
SQL SERVER DAYS 2011 Table Indexing for the.NET Developer Denny Cherry twitter.com/mrdenny.
Chapter 4 Indexes. Index Architecture  By default data is inserted on a first-come, first-serve basis  Indexes bring order to this chaos  Once you.
Constraints Lesson 8. Skills Matrix Constraints Domain Integrity: A domain refers to a column in a table. Domain integrity includes data types, rules,
Session 1 Module 1: Introduction to Data Integrity
Creating Indexes on Tables An index provides quick access to data in a table, based on the values in specified columns. A table can have more than one.
SQL Query Analyzer. Graphical tool that allows you to:  Create queries and other SQL scripts and execute them against SQL Server databases. (Query window)
Table Structures and Indexing. The concept of indexing If you were asked to search for the name “Adam Wilbert” in a phonebook, you would go directly to.
SQL SERVER DAYS 2011 Indexing Internals Denny Cherry twitter.com/mrdenny.
MICROSOFT ACCESS – CHAPTER 5 MICROSOFT ACCESS – CHAPTER 6 MICROSOFT ACCESS – CHAPTER 7 Sravanthi Lakkimsety Mar 14,2016.
Indexes Part 2 What type of Indexes are there? Make sure you have the pages 2 & 3 of the Lab for Indexes in front of you before playing this presentation.
SQL Basics Review Reviewing what we’ve learned so far…….
Database Administration for the Non-DBA Denny Cherry twitter.com/mrdenny.
Data Integrity & Indexes / Session 1/ 1 of 37 Session 1 Module 1: Introduction to Data Integrity Module 2: Introduction to Indexes.
3 A Guide to MySQL.
Chris Index Feng Shui Chris
Web Systems & Technologies
Indexes By Adrienne Watt.
Indices.
Indexing ? Why ? Need to locate the actual records on disk without having to read the entire table into memory.
T-SQL: Simple Changes That Go a Long Way
A Technical Overview of Microsoft® SQL Server™ 2005 High Availability Beta 2 Matthew Stephen IT Pro Evangelist (SQL Server)
Module 4: Creating and Tuning Indexes
Designing Database Solutions for SQL Server
The Nitty-Gritty of Database Backups
Introduction to SQL Server Management for the Non-DBA
Database Administration for the Non-DBA
DATABASE MANAGEMENT SYSTEM
Table Indexing for the .NET Developer
Session #, Speaker Name Indexing Chapter 8 11/19/2018.
Lecture 12 Lecture 12: Indexing.
Microsoft SQL Server 2014 for Oracle DBAs Module 7
Database systems Lecture 6 – Indexes
Denny Cherry twitter.com/mrdenny
Query Processing CSD305 Advanced Databases.
Introduction To Structured Query Language (SQL)
All about Indexes Gail Shaw.
XML? What’s this doing in my database? Adam Koehler
Presentation transcript:

SQL Server Indexing for the Client Developer Denny Cherry mrdenny@mrdenny.com MVP, MCSA, MCDBA, MCTS, MCITP

Today’s Goals Introduce the different kinds of indexes Common Misconceptions about indexes Downsides to indexes Introduce advanced index tuning techniques Q & A

Today’s Goals Introduce the different kinds of indexes Common Misconceptions about indexes Downsides to indexes Introduce advanced index tuning techniques Q & A

Different Kinds of Indexes Three Kinds of Indexes Clustered Non-clustered Full Text XML

Clustered Indexes 1 Clustered Index per table Contain Full Copy of row data within in the index Up to 16 indexed columns can be part of the index (15 if the table contains any XML indexes) Primary Key will by default be the Clustered Index Must be created on the same filegroup as the table

Non-clustered Index Up to 999 per table Up to 16 indexed columns in the index Non-indexed columns can be included via INCLUDE statement Can be created on any filegroup within the database Can be filtered indexes to include fewer rows in the index.

Full Text Indexes Not accessed via normal SELECT statements Require use of a predicate: CONTAINS CONTAINSTABLE FREETEXT FREETEXTTABLE Can be used to search binary values (doc, docx, xls, pdf) stored within the database. Natural Language Search

Full Text Indexes (SQL 2005 and below) Created and managed outside of the database via Microsoft Search Service Backed up with the database (starting in SQL 2005) Searches entire index and returns all matches, which you then filter against your normal table to return correct set of rows.

Full Text Indexes (SQL 2008 and up) Now stored within the database Command is still parsed via MS Search service, but looking is done natively Full text search now only searches the required subset of rows

XML Indexes Allows you to index specific nodes of the XML document 249 XML Indexes pre table Requires a Clustered Index on the table Each xml column can have a single primary XML index and multiple secondary XML indexes XML Indexes can only be created on a single XML Column

Today’s Goals Introduce the different kinds of indexes Common Misconceptions about indexes Downsides to indexes Introduce advanced index tuning techniques Q & A

Common Misconceptions about indexes Indexes don’t require maintenaince If I create one index for each column in my where clause I’ll be fine The table is sorted based on the order of the Clustered Index Clustered Indexes are required

Today’s Goals Introduce the different kinds of indexes Common Misconceptions about indexes Downsides to indexes Introduce advanced index tuning techniques Q & A

Downsides to indexes Indexes take up space On large complex databases the indexes can take up more space than the table Data is duplicated in each index which contains the column Indexes slow down insert, update, delete (especially full text indexes) statements Using the wrong index can be slower than using no index Encrypted data can’t be effectively indexed

Today’s Goals Introduce the different kinds of indexes Common Misconceptions about indexes Downsides to indexes Introduce advanced index tuning techniques Q & A

Advanced Index Tuning Techniques Fillfactor Tells the SQL Server how much free space to leave in the leaf level pages. Padding Tells the SQL Server to use the Fillfactor setting to leave free space in the intermediate-level pages. Online Rebuilds Data Compression

Using the Advanced Index Tuning Techniques CREATE INDEX MyIndex ON dbo.MyTable ON (Col1, Col5, Col3) INCLUDE (Col4, Col2) WHERE Col6 = ‘Value3’ WITH (FILLFACTOR=70, PAD_INDEX=ON, ONLINE=ON, DATA_COMPRESSION = ROW | PAGE);

Physical Index Page Layout Clustered (BOL 2005 / 2008) Non-Clustered (BOL 2005 / 2008)

Q & A

Please rate my presentation at http://speakerrate.com/mrdenny Denny Cherry mrdenny@mrdenny.com http://itke.techtarget.com/sql-server/ http://www.twitter.com/mrdenny Please rate my presentation at http://speakerrate.com/mrdenny