Index Tuning Additional knowledge.

Slides:



Advertisements
Similar presentations
Adam Jorgensen Pragmatic Works Performance Optimization in SQL Server Analysis Services 2008.
Advertisements

Index Dennis Shasha and Philippe Bonnet, 2013.
Lock Tuning. overview © Dennis Shasha, Philippe Bonnet 2001 Sacrificing Isolation for Performance A transaction that holds locks during a screen interaction.
CS5226 Hardware Tuning. 2 Application Programmer (e.g., business analyst, Data architect) Sophisticated Application Programmer (e.g., SAP admin) DBA,
SQL Server 2005 features for VLDBs. SQL Server 2005 features for VLDBs aka (it’s fixed in the next release)
1 Overview of Storage and Indexing Chapter 8 (part 1)
H.Lu/HKUST L07: Lock Tuning. L07-Lock Tuning - 2 H.Lu/HKUST Lock Tuning  The key is to combine the theory of concurrency control with practical DBMS.
1 Overview of Storage and Indexing Chapter 8 1. Basics about file management 2. Introduction to indexing 3. First glimpse at indices and workloads.
AOBD07/08H. Galhardas Index Tuning. AOBD2007/08 H. Galhardas Index An index is a data structure that supports efficient access to data Set of Records.
1 Storage Refinement. Outline Disk failures To attack Intermittent failures To attack Media Decay and Write failure –Checksum To attack Disk crash –RAID.
Schema Dennis Shasha and Philippe Bonnet, 2013.
Index tuning Performance Tuning.
Practical Database Design and Tuning. Outline  Practical Database Design and Tuning Physical Database Design in Relational Databases An Overview of Database.
1 Physical Data Organization and Indexing Lecture 14.
Index tuning-- B+tree. overview © Dennis Shasha, Philippe Bonnet 2001 B+-Tree Locking Tree Traversal –Update, Read –Insert, Delete phantom problem: need.
Database Tuning Prerequisite Cluster Index B+Tree Indexing Hash Indexing ISAM (indexed Sequential access)
Index tuning Performance Tuning. Overview Index An index is a data structure that supports efficient access to data Set of Records index Condition on.
1 CPS216: Advanced Database Systems Notes 04: Operators for Data Access Shivnath Babu.
1 Recovery Tuning Main techniques Put the log on a dedicated disk Delay writing updates to the database disks as long as possible Setting proper intervals.
SQL Server Indexes Indexes. Overview Indexes are used to help speed search results in a database. A careful use of indexes can greatly improve search.
Top 10 SQL-on-Hadoop Pitfalls Monte Zweben CEO, Splice Machine.
Physical Database Design I, Ch. Eick 1 Physical Database Design I About 25% of Chapter 20 Simple queries:= no joins, no complex aggregate functions Focus.
1 Performance Tuning Next, we focus on lock-based concurrency control, and look at optimising lock contention. The key is to combine the theory of concurrency.
CS Hardware Tuning Xiaofang Zhou School of Computing, NUS Office: S URL:
1 Overview of Storage and Indexing Chapter 8 (part 1)
Storage and Indexing1 Overview of Storage and Indexing.
CS Operating System & Database Performance Tuning Xiaofang Zhou School of Computing, NUS Office: S URL:
Lecture 5 Cost Estimation and Data Access Methods.
6.830 Lecture 6 9/28/2015 Cost Estimation and Indexing.
Indexes and Views Unit 7.
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.
Physical Database Design I, Ch. Eick 1 Physical Database Design I Chapter 16 Simple queries:= no joins, no complex aggregate functions Focus of this Lecture:
CS 440 Database Management Systems Lecture 6: Data storage & access methods 1.
SQL Query Analyzer. Graphical tool that allows you to:  Create queries and other SQL scripts and execute them against SQL Server databases. (Query window)
Lock Tuning. Overview Data definition language (DDL) statements are considered harmful DDL is the language used to access and manipulate catalog or metadata.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Overview of Storage and Indexing Chapter 8.
© Dennis Shasha, Philippe Bonnet 2001 Lock Tuning.
1 Overview of Storage and Indexing Chapter 8. 2 Review: Architecture of a DBMS  A typical DBMS has a layered architecture.  The figure does not show.
Database System Architecture and Implementation Execution Costs 1 Slides Credit: Michael Grossniklaus – Uni-Konstanz.
CS522 Advanced database Systems Huiping Guo Department of Computer Science California State University, Los Angeles 3. Overview of data storage and indexing.
CPS216: Data-intensive Computing Systems
Indexes By Adrienne Watt.
CS522 Advanced database Systems
Record Storage, File Organization, and Indexes
CS 540 Database Management Systems
CS522 Advanced database Systems
Tree-Structured Indexes
Database Management Systems (CS 564)
Module 4: Creating and Tuning Indexes
Hash-Based Indexes Chapter 11
Latihan Create a separate table with the same structure as the Booking table to hold archive records. Using the INSERT statement, copy the records from.
Database Performance Tuning and Query Optimization
Hustle and Bustle of SQL Pages
Introduction to Query Optimization
File Organizations Chapter 8 “How index-learning turns no student pale
Lecture 12 Lecture 12: Indexing.
Overview of Storage and Indexing
File Organizations and Indexing
File Organizations and Indexing
Tree-Structured Indexes
Hash-Based Indexes Chapter 10
Selected Topics: External Sorting, Join Algorithms, …
Chapter 8 – Part II. A glimpse at indices and workloads
Overview of Storage and Indexing
Realtime Analytics OLAP & OLTP in the mix
Chapter 11 Database Performance Tuning and Query Optimization
Physical Storage Structures
Chapter 11 Instructor: Xin Zhang
File Organizations and Indexing
Overview of Storage and Indexing
Presentation transcript:

Index Tuning Additional knowledge

Overview

Covering Index - defined Select name from employee where department = “marketing” Good covering index would be on (department, name) Index on (name, department) less useful. Index on department alone moderately useful.

Covering Index - impact Covering index performs better than clustering index when first attributes of index are in the where clause and last attributes in the select. Select B,C from R where A=5, there exists a non-clustered index on (A,B,C) When attributes are not in order then performance is much worse.

Index on Small Tables Tuning manuals suggest to avoid indexes on small tables If all data from a relation fits in one page then an index page adds an I/O However, in following cases, index is preferred If each record fits in a page then an index helps performance, since retrieving each page needs a page I/O Allowing row locking

Index on Small Tables Small table: 100 records Two concurrent processes perform updates (each process works for 10ms before it commits) No index: the table is scanned for each update. The whole table is locked. No concurrent updates. A clustered index allow to take advantage of row locking.

Multipoint query: B-Tree, Hash Tree, Bitmap There is an overflow chain in a hash index In a clustered B-Tree index records are on contiguous pages. Bitmap is proportional to size of table and non-clustered for record access.

B-Tree, Hash Tree, Bitmap Hash indexes don’t help when evaluating range queries Hash index outperforms B-tree on point queries

Key Compression Use key compression If you are using a B-tree Compressing the key will reduce the number of levels in the tree The system is not CPU-bound Updates are relatively rare

Index Tuning Wizard The index wizard MS SQL Server 7 and above A database (schema + data + existing indexes) Trace representative of the workload Out: Evaluation of existing indexes Recommendations on index creation and deletion The index wizard Enumerates possible indexes on one attribute, then several attributes Traverses this search space using the query optimizer to associate a cost to each index

Index Tuning -- data Settings: employees(ssnum, name, lat, long, hundreds1, hundreds2); clustered index c on employees(hundreds1) with fillfactor = 100; nonclustered index nc on employees (hundreds2); index nc3 on employees (ssnum, name, lat); index nc4 on employees (lat, ssnum, name); 1000000 rows ; Cold buffer Dual Xeon (550MHz,512Kb), 1Gb RAM, Internal RAID controller from Adaptec (80Mb), 4x18Gb drives (10000RPM), Windows 2000.

Index Tuning -- operations Update: update employees set name = ‘XXX’ where ssnum = ?; Insert: insert into employees values (1003505,'polo94064',97.48,84.03,4700.55,3987.2); Multipoint query: select * from employees where hundreds1= ?; select * from employees where hundreds2= ?; Covered query: select ssnum, name, lat from employees; Range Query: select * from employees where long between ? and ?; Point Query: select * from employees where ssnum = ? © Dennis Shasha, Philippe Bonnet 2001

Bitmap vs. Hash vs. B+-Tree Settings: employees(ssnum, name, lat, long, hundreds1, hundreds2); create cluster c_hundreds (hundreds2 number(8)) PCTFREE 0; create cluster c_ssnum(ssnum integer) PCTFREE 0 size 60; create cluster c_hundreds(hundreds2 number(8)) PCTFREE 0 HASHKEYS 1000 size 600; create cluster c_ssnum(ssnum integer) PCTFREE 0 HASHKEYS 1000000 SIZE 60; create bitmap index b on employees (hundreds2); create bitmap index b2 on employees (ssnum); 1000000 rows ; Cold buffer Dual Xeon (550MHz,512Kb), 1Gb RAM, Internal RAID controller from Adaptec (80Mb), 4x18Gb drives (10000RPM), Windows 2000. 13

summary