Tim Hall Oracle ACE Director

Slides:



Advertisements
Similar presentations
PL/SQL : Stop making the same performance mistakes
Advertisements

BY LECTURER/ AISHA DAWOOD DW Lab # 3 Overview of Extraction, Transformation, and Loading.
Manish Bhide, Manoj K Agarwal IBM India Research Lab India {abmanish, Amir Bar-Or, Sriram Padmanabhan IBM Software Group, USA
A Guide to Oracle9i1 Advanced SQL And PL/SQL Topics Chapter 9.
A Guide to SQL, Seventh Edition. Objectives Embed SQL commands in PL/SQL programs Retrieve single rows using embedded SQL Update a table using embedded.
1 Chapter Overview Transferring and Transforming Data Introducing Microsoft Data Transformation Services (DTS) Transferring and Transforming Data with.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 7-1 David M. Kroenke’s Chapter Seven: SQL for Database Construction and.
Cursor and Exception Handling By Nidhi Bhatnagar.
PL/SQL: It’s all in the presentation! Tim Hall Oracle ACE Director Oracle ACE of the Year 2006 OCP DBA (7, 8, 8i, 9i, 10g, 11g)
SAGE Computing Services Customised Oracle Training Workshops and Consulting Are you making the most of PL/SQL? Hints and tricks and things you may have.
PL/SQLPL/SQL Oracle10g Developer: PL/SQL Programming Chapter 11 Introduction to Dynamic SQL and Object Technology.
ETL There’s a New Sheriff in Town: Oracle OR… Not Just another Pretty Face Presented by: Bonnie O’Neil.
Module 11: Programming Across Multiple Servers. Overview Introducing Distributed Queries Setting Up a Linked Server Environment Working with Linked Servers.
From Zero to Hero : Using an assortment of caching techniques to improve performance of SQL containing PL/SQL calls. Tim Hall.
Triggers A Quick Reference and Summary BIT 275. Triggers SQL code permits you to access only one table for an INSERT, UPDATE, or DELETE statement. The.
The Oracle9i Multi-Terabyte Data Warehouse Jeff Parker Manager Data Warehouse Development Amazon.com Session id:
In Oracle.  A PL/SQL block stored in the database and fired in response to a specified event ◦ DML statements : insert, update, delete ◦ DDL statements.
Using Procedures & Functions Oracle Database PL/SQL 10g Programming Chapter 9.
Lecture2: Database Environment Prepared by L. Nouf Almujally 1 Ref. Chapter2 Lecture2.
6 Extraction, Transformation, and Loading (ETL) Transformation.
Views Lesson 7.
8 1 Chapter 8 Advanced SQL Database Systems: Design, Implementation, and Management, Seventh Edition, Rob and Coronel.
Database Systems Design, Implementation, and Management Coronel | Morris 11e ©2015 Cengage Learning. All Rights Reserved. May not be scanned, copied or.
SQL Fundamentals  SQL: Structured Query Language is a simple and powerful language used to create, access, and manipulate data and structure in the database.
SQL Basic. What is SQL? SQL (pronounced "ess-que-el") stands for Structured Query Language. SQL is used to communicate with a database.
Dynamic SQL Oracle Database PL/SQL 10g Programming Chapter 13.
What is a Package? A package is an Oracle object, which holds other objects within it. Objects commonly held within a package are procedures, functions,
Objectives Database triggers and syntax
PL/SQLPL/SQL Oracle10g Developer: PL/SQL Programming Chapter 9 Database Triggers.
COSC 3480 Projects, Christoph F. Eick 1 Lab COSC 3480 Fall 2000.
D Copyright © Oracle Corporation, All rights reserved. Loading Data into a Database.
Dynamic SQL. 2 home back first prev next last What Will I Learn? Recall the stages through which all SQL statements pass Describe the reasons for using.
A Guide to SQL, Eighth Edition Chapter Eight SQL Functions and Procedures.
PL/SQLPL/SQL Oracle11g: PL/SQL Programming Chapter 9 Database Triggers.
PL/SQLPL/SQL Oracle10g Developer: PL/SQL Programming Chapter 9 Database Triggers.
Oracle11g: PL/SQL Programming Chapter 3 Handling Data in PL/SQL Blocks.
02 | Data Flow – Extract Data Richard Currey | Senior Technical Trainer–New Horizons United George Squillace | Senior Technical Trainer–New Horizons Great.
implicit and an explicit cursor
Using SQL in PL/SQL Oracle Database PL/SQL 10g Programming Chapter 4.
Session 1 Module 1: Introduction to Data Integrity
Transactions, Roles & Privileges Oracle and ANSI Standard SQL Lecture 11.
Learningcomputer.com SQL Server 2008 –Views, Functions and Stored Procedures.
A Guide to SQL, Eighth Edition Chapter Six Updating Data.
1 Do You Need an ETL Tool? Ben Bor NZ Ministry of Health Ben Bor NZ Ministry of Health.
Text TCS INTERNAL Oracle PL/SQL – Introduction. TCS INTERNAL PL SQL Introduction PLSQL means Procedural Language extension of SQL. PLSQL is a database.
Oracle 10g Database Administrator: Implementation and Administration Chapter 10 Basic Data Management.
SQL Introduction to database and SQL. Chapter 1: Databases and Database Users 6 Introduction to Databases Databases touch all aspects of our lives. Examples:
Chapter 8 Advanced SQL Pearson Education © Chapter 8 - Objectives How to use the SQL programming language How to use SQL cursors How to create stored.
SQL SERVER AUDITING. Jean Joseph DBA/Consultant Contact Info: Blog:
1 11g NEW FEATURES ByVIJAY. 2 AGENDA  RESULT CACHE  INVISIBLE INDEXES  READ ONLY TABLES  DDL WAIT OPTION  ADDING COLUMN TO A TABLE WITH DEFAULT VALUE.
SQL Triggers, Functions & Stored Procedures Programming Operations.
Preface IIntroduction Course Objectives I-2 Oracle Complete Solution I-3 Course Agenda I-4 Tables Used in This Course I-5 The Order Entry Schema I-6 The.
1 Copyright © 2004, Oracle. All rights reserved. PL/SQL Programming Concepts: Review.
11 Copyright © 2009, Oracle. All rights reserved. Enhancing ETL Performance.
SQL IMPLEMENTATION & ADMINISTRATION Indexing & Views.
A Guide to SQL, Seventh Edition
Prepared by : Moshira M. Ali CS490 Coordinator Arab Open University
Antonio Abalos Castillo
UNIT - V STORED PROCEDURE.
The powerhouse PL/SQL upgrade option: Edition-Based Redefinition (EBR)
Presented by: Warren Sifre
PL/SQL Scripting in Oracle:
DATABASE MANAGEMENT SYSTEM
Database Processing: David M. Kroenke’s Chapter Seven:
SQL .. An overview lecture3.
Oracle9i Developer: PL/SQL Programming Chapter 8 Database Triggers.
Chapter 8 Advanced SQL.
Prof. Arfaoui. COM390 Chapter 9
Handling Data in PL/SQL Blocks
Implementing ETL solution for Incremental Data Load in Microsoft SQL Server Ganesh Lohani SR. Data Analyst Lockheed Martin
Presentation transcript:

Pipelined Table Functions and Transformation Pipelines to Replace Traditional Load Operations Tim Hall Oracle ACE Director Oracle ACE of the Year 2006 OCP DBA (7, 8, 8i, 9i, 10g, 11g) OCA PL/SQL Developer http://www.oracle-base.com Oracle PL/SQL Tuning (Rampant) Oracle Job Scheduling (Rampant) http://www.oracle-base.com

Table functions and pipelining What are table functions? Pipelining table functions. Parallel enabled table functions. Creating transformation pipelines. Miscellaneous facts. http://www.oracle-base.com

What are table functions? Functions that return collections are known as table functions. tf_setup.sql In combination with the TABLE function, they can be used in the FROM clause of a query like a regular table. tf_test.sql For regular table functions, the collection must be defined using database OBJECT types. http://www.oracle-base.com

Pipelining table functions A table function builds the entire collection before returning any data, while a pipelined table function “pipes” each row out as soon as it is created. ptf_schema.sql ptf_package.sql ptf_query.sql Since the collection is never fully resident in memory, pipelining can produce a considerable memory saving. memory_usage.sql Since 9i R2, the types used to define the pipelined table function can be defined in a package, but this method can produce management problems, so I prefer the explicit method. implicit_types.sql http://www.oracle-base.com

Parallel enabled table functions Single Process Parallel Process 1,000,000 Master 1,000,000 Slave 1 250,000 Slave 2 250,000 Slave 3 250,000 Salve 4 250,000 Parallel enabled table functions can improve performance by dividing the workload between slave processes. http://www.oracle-base.com

Parallel enabled table functions To parallel enable a table function, you must: Include the PARALLEL_ENABLE clause. Have a single REF CURSOR as a input parameter. Use the PARTITION BY clause to define a partitioning method for the workload. Weakly typed REF CURSORS can only use the PARTITION BY ANY clause, which randomly partitions the workload. ptf_syntax.sql Let’s see it in action. parallel_setup.sql parallel_tf.sql Running multiple slave and coordinating the parallel operation takes extra resources. It may not be beneficial in every type of operation. http://www.oracle-base.com

Ordering and clustering PTFs Process Workload: ENG, ENG, ENG, IRE, SCO, SCO Entry Type Slave 1 Slave 2 Slave 3 Random ENG, SCO ENG, IRE Order ENG, ENG SCO, SCO Cluster ENG, ENG, ENG IRE The ORDER BY and CLUSTER BY clauses can be used to alter the order of the data entering each instance of the parallel enabled table function, such that: When neither the ORDER BY or CLUSTER BY clause is specified, the data entry is random. The ORDER BY clause orders the data by the specified column. The CLUSTER BY clause groups data with the same values together, but does not order the data between values. This is difficult to demo due to the volume of data needed, but the following test does work provided you are willing search through the data. parallel_order.sql http://www.oracle-base.com

Creating transformation pipelines Data loads and Extraction Transformation Load (ETL) processes have traditionally relied on loading data from flat files into staging tables, where it is processed before being loaded into the main schema tables. Pipelined table functions are often discussed as a replacement for the traditional ETL processes. Pipelined table functions can be strung together to perform complex transformations in a single load operation. tp_file.sql tp schema.sql http://www.oracle-base.com

Creating transformation pipelines External Table (tp_test_ext) Source File (tp_test.txt) t_step_1_in_rc Step 1 (tp_api.step_1) t_step_1_out_tab Destination Table (tp_test) Step 2 (tp_api.step_2) t_step_2_out_tab t_step_2_in_rc http://www.oracle-base.com

Creating transformation pipelines Two pipelined table functions are defined to perform the transformation steps, along with a procedure to initiate the load process. tp_api.sql tp_api_test.sql Each step is conceptually quite simple, but stringing them together can look complex. The main advantage is complex loads can be done in a single DML statement, rather than requiring many table inserts and updates for data staging. http://www.oracle-base.com

Miscellaneous facts Table functions can only contain DML statements if they are defined with the AUTONOMOUS_TRANSACTION pragma, or the DML is itself wrapped in a procedure call that is an autonomous transaction. DML statements cannot be executed against table functions, but if the table function is incorporated into a view, the view can have INSTEAD OF triggers defined against it. Exception handling is the same for table functions as it is for other PL/SQL functions, such that any unhandled exceptions are propagated back to the calling PL/SQL or SQL. http://www.oracle-base.com

Summary The definition of table functions and pipelined table functions. The performance benefits of pipelined table functions in comparison to regular table functions. The use of parallel enabled pipelined table functions, which share the total workload between multiple slave processes. Creating transformation pipelines to replace traditional Extraction Transformation Load (ETL) processes. http://www.oracle-base.com