Tipos de Segmentos. B-Tree Index Index entry header Key column length Key column value ROWID Root Branch Leaf Index entry.

Slides:



Advertisements
Similar presentations
SQL (I) Tema 3.
Advertisements

Tuning: overview Rewrite SQL (Leccotech)Leccotech Create Index Redefine Main memory structures (SGA in Oracle) Change the Block Size Materialized Views,
11 Copyright © Oracle Corporation, All rights reserved. Managing Tables.
Introduction to Database Systems1 Records and Files Storage Technology: Topic 3.
13 Copyright © 2004, Oracle. All rights reserved. Monitoring and Managing Storage.
Hashing and Indexing John Ortiz.
Physical Database Design Chapter 5 G. Green 1. Agenda Purpose Activities Fields Records Files 2.
All About Indexes: What to Index, When, and Why Mark J. Bobak OOUG, 17-Jan-2013.
12 Copyright © Oracle Corporation, All rights reserved. Managing Indexes.
Semantec Ltd. Oracle Performance Tuning Boyan Pavlov Indexes Indexes.
Module 4: Creating Data Types and Tables. Overview Creating Data Types Creating Tables Generating Column Values Generating Scripts.
Managing Schema Objects
Efficient Storage and Retrieval of Data
1 juliandyke.com © 2005 Julian Dyke Data Segment Compression Julian Dyke Independent Consultant Web Version.
1  MyOnlineITCourses.com 1 MyOnlineITCourses.com Oracle Partitioning -- A Primer.
Indexing. Goals: Store large files Support multiple search keys Support efficient insert, delete, and range queries.
9/11/2015ISYS366 - Week051 ISYS366 – Week 5-6 Database Tuning - User and Rollback Data Spaces, Recovery, Backup.
Lecture 8 Index Organized Tables Clusters Index compression
Oracle Data Block Oracle Concepts Manual. Oracle Rows Oracle Concepts Manual.
Chapter 6 Additional Database Objects
Oracle9i Database Administrator: Implementation and Administration 1 Chapter 9 Index Management.
1 CG171 - Database Implementation and Development (Physical Database Design) – Lecture 7 Storage Allocation & Data Access Methods By Dr. Akhtar Ali.
School of Computing and Management Sciences © Sheffield Hallam University Finding Data –In a list of 700 composers, how do we find Berlioz? –The row with.
Materialized Views. 2 Materialized Views – Agenda What is a Materialized View? – Advantages and Disadvantages How Materialized Views Work – Parameter.
Chapter 6 Additional Database Objects Oracle 10g: SQL.
9 Storage Structure and Relationships. 9-2 Objectives Listing the different segment types and their uses Controlling the use of extents by segments Stating.
Oracle9i Database Administrator: Implementation and Administration 1 Chapter 7 Basic Table Management.
1 Copyright © 2006, Oracle. All rights reserved. Using DDL Statements to Create and Manage Tables.
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.
3 Copyright © 2005, Oracle. All rights reserved. Partitioning Basics.
Data Warehouse Design Xintao Wu University of North Carolina at Charlotte Nov 10, 2008.
Oracle tuning: a tutorial Saikat Chakraborty. Introduction In this session we will try to learn how to write optimized SQL statements in Oracle 8i We.
Oracle 10g Database Administrator: Implementation and Administration Chapter 7 Basic Table Management.
Dale Roberts Department of Computer and Information Science, School of Science, IUPUI Dale Roberts, Lecturer Computer Science, IUPUI
6 Copyright © 2005, Oracle. All rights reserved. Managing Schema Objects.
8 Copyright © 2007, Oracle. All rights reserved. Managing Schema Objects.
Week 4 Lecture 2 Advanced Table Management. Learning Objectives  Create tables with large object (LOB) columns and tables that are index-organized 
Database Indexing 1 After this lecture, you should be able to:  Understand why we need database indexing.  Define indexes for your tables in MySQL. 
Partition Architecture Yeon JongHeum
Managing Schema Objects
Chapter 5 Index and Clustering
Indexes … WHERE key = Table Index 22 Row pointer Key Indexes
Data Warehousing Seminar Chapter 13 Indexing the Warehouse
6 Copyright © 2007, Oracle. All rights reserved. Retrieving Data Using Subqueries.
Last Updated : 27 th April 2004 Center of Excellence Data Warehousing Group Teradata Performance Optimization.
Indexes- What?  Optional structures associated with tables  Provides a quick access path to table data  You can create indexes on one or more columns.
1 Chapter 9 Tuning Table Access. 2 Overview Improve performance of access to single table Explain access methods – Full Table Scan – Index – Partition-level.
Chap 5. Disk IO Distribution Chap 6. Index Architecture Written by Yong-soon Kwon Summerized By Sungchan IDS Lab
1 Chapter 12: Indexing and Hashing Indexing Indexing Basic Concepts Basic Concepts Ordered Indices Ordered Indices B+-Tree Index Files B+-Tree Index Files.
Unit 6 Seminar. Indexed Organized Tables Definition: Index Organized Tables are tables that, unlike heap tables, are organized like B*Tree indexes.
Dale Roberts 1 Department of Computer and Information Science, School of Science, IUPUI Dale Roberts, Lecturer Computer Science, IUPUI
1 Indexes ► Sort data logically to improve the speed of searching and sorting operations. ► Provide rapid retrieval of specified rows from the table without.
Indexes 22 Index Table Key Row pointer … WHERE key = 22.
IT 5433 LM4 Physical Design. Learning Objectives: Describe the physical database design process Explain how attributes transpose from the logical to physical.
6 Copyright © 2006, Oracle. All rights reserved. Retrieving Data Using Subqueries.
CS SQL.
Module 11: File Structure
Index An index is a performance-tuning method of allowing faster retrieval of records. An index creates an entry for each value that appears in the indexed.
Indexes and Basic Access Methods
COMP 430 Intro. to Database Systems
Database Tuning - User and Rollback Data Spaces, Recovery, Backup
Indexes … WHERE key = Table Index 22 Row pointer Key Indexes
Lecture 12 Lecture 12: Indexing.
Understanding Indexes
Managing Indexes.
Indexek … WHERE key = Table Index 22 Row pointer Key Indexes
Using Clusters and Index-Organized Tables
Managing Tables.
Table Suitable for Bitmap Index
Presentation transcript:

Tipos de Segmentos

B-Tree Index Index entry header Key column length Key column value ROWID Root Branch Leaf Index entry

Almacenamiento en los índices PCTFREE DB_BLOCK_SIZE-OVERHEAD-entries* ENTRY_ OVERHEAD-ENTRIES(directorio valores)-ROWID

Reescritura de Consultas

Function-Based Indexes SQL> CREATE INDEX FBI_UPPER_LASTNAME 2 ON CUSTOMERS(upper(cust_last_name)); SQL> SELECT * 2 FROM customers 3 WHERE UPPER(cust_last_name) = 'SMITH'; SQL> ALTER SESSION 2 SET QUERY_REWRITE_ENABLED = TRUE; SQL> ALTER SESSION 2 SET QUERY_REWRITE_ENABLED = enforced | trusted | stale_tolerated ;

Function-Based Indexes: Usage Function-based indexes:  Materialize computational-intensive expressions  Facilitate case-insensitive searches  Provide a simple form of data compression  Can be used for an NLS sort index

Índices y nulos Oracle ignora los registro donde todas las entradas son nulos. CREATE INDEX IDX1 ON EMPLOYEE(NVL(ename,’null’)

Ejemplo Bitmap- Tabla base

Ejemplo Bitmap (Bitmap Generado)

Ejemplo Consulta sobre Bitmap SELECT COUNT(*) FROM CUSTOMER WHERE MARITAL_STATUS = 'married' AND REGION IN ('central','west');

Bitmap Indexes key start ROWID end ROWID bitmap Table Index Block 10 Block 11 Block 12 File 3

Creating Bitmap Indexes CREATE BITMAP INDEX orders_region_id_idx ON orders(region_id) PCTFREE 30 STORAGE(INITIAL 200K NEXT 200K PCTINCREASE 0 MAXEXTENTS 50) TABLESPACE indx;

Comparing B-Tree and Bitmap Indexes B-tree Suitable for high-cardinality columns Updates on keys relatively inexpensive Inefficient for queries using OR predicates Useful for OLTP Bitmap Suitable for low-cardinality columns Updates to key columns very expensive Efficient for queries using OR predicates Useful for data warehousing

COMPUTE STATISTICS CREATE INDEX ord_customer_ix_demo ON orders(customer_id, sales_rep_id) COMPUTE STATISTICS;

Índices particionados localmente sobre tablas Particionadas CREATE TABLE employees (employee_id NUMBER(4) NOT NULL, last_name VARCHAR2(10), department_id NUMBER(2)) PARTITION BY RANGE (department_id) (PARTITION employees_part1 VALUES LESS THAN (11) TABLESPACE part1, PARTITION employees_part2 VALUES LESS THAN (21) TABLESPACE part2, PARTITION employees_part3 VALUES LESS THAN (31) TABLESPACE part3);

Índices Particionados Globalmente sobre Tablas Particionadas CREATE INDEX employees_global_part_idx ON employees(employee_id) GLOBAL PARTITION BY RANGE(employee_id) (PARTITION p1 VALUES LESS THAN(5000), PARTITION p2 VALUES LESS THAN(MAXVALUE));

Índices globales no particionados sobre tablas particionadas CREATE INDEX employees_global_idx ON employees(employee_id);

Hash-Partitioned Global Indexes: Overview 10g 1000,1001, … 900,901, … < 1000 < MAXVALUE 901,1001, … 900,1000, … Range-partitioned global index Hash-partitioned global index

Creating Hash-Partitioned Global Indexes SQL> CREATE INDEX ghoi_ix 2 ON order_items (order_id) GLOBAL 3 PARTITION BY HASH (order_id) ( 4 PARTITION p1 TABLESPACE tbs_1, 5 PARTITION p2 TABLESPACE tbs_2, 6 PARTITION p3 TABLESPACE tbs_3, 7 PARTITION p4 TABLESPACE tbs_4); SQL> CREATE INDEX ghoi_ix 2 ON order_items (order_id) GLOBAL 3 PARTITION BY HASH (order_id) 4 PARTITIONS 4 5 STORE IN (tbs_1, tbs_2, tbs_3, tbs_4);

Índices Bipmap para IOT Tabla de Correspondencia 9i  Hash, rango 10g  Lista ROWID FísicoROWID Lógico

Creación de una Tabla Particionada Organizada por Índice CREATE TABLE sales_range( salesman_id NUMBER(5), salesman_name VARCHAR2(30), sales_amount NUMBER(10), sales_date DATE, PRIMARY KEY(sales_date, salesman_id)) ORGANIZATION INDEX INCLUDING salesman_id OVERFLOW TABLESPACE tabsp_overflow PARTITION BY RANGE(sales_date) (PARTITION sales_jan2000 VALUES LESS THAN(TO_DATE('02/01/2000','DD/MM/YYYY')) OVERFLOW TABLESPACE p1_overflow, PARTITION sales_feb2000 VALUES LESS THAN(TO_DATE('03/01/2000','DD/MM/YYYY')) OVERFLOW TABLESPACE p2_overflow, PARTITION sales_mar2000 VALUES LESS THAN(TO_DATE('04/01/2000','DD/MM/YYYY')) OVERFLOW TABLESPACE p3_overflow, PARTITION sales_apr2000 VALUES LESS THAN(TO_DATE('05/01/2000','DD/MM/YYYY')) OVERFLOW TABLESPACE p4_overflow);