8 Copyright © 2005, Oracle. All rights reserved. Parallel Operations in Data Warehouses.

Slides:



Advertisements
Similar presentations
Using the SQL Access Advisor
Advertisements

Chapter 13: Query Processing
Maria Colgan & Thierry Cruanes
Advanced SQL Topics Edward Wu.
1 Vorlesung Informatik 2 Algorithmen und Datenstrukturen (Parallel Algorithms) Robin Pomplun.
© 2008 Pearson Addison Wesley. All rights reserved Chapter Seven Costs.
Copyright © 2003 Pearson Education, Inc. Slide 1 Computer Systems Organization & Architecture Chapters 8-12 John D. Carpinelli.
Chapter 1 The Study of Body Function Image PowerPoint
Copyright © 2011, Elsevier Inc. All rights reserved. Chapter 6 Author: Julia Richards and R. Scott Hawley.
Author: Julia Richards and R. Scott Hawley
1 Copyright © 2013 Elsevier Inc. All rights reserved. Appendix 01.
Properties Use, share, or modify this drill on mathematic properties. There is too much material for a single class, so you’ll have to select for your.
UNITED NATIONS Shipment Details Report – January 2006.
RXQ Customer Enrollment Using a Registration Agent (RA) Process Flow Diagram (Move-In) Customer Supplier Customer authorizes Enrollment ( )
© 2010 Pearson Addison-Wesley. All rights reserved. Addison Wesley is an imprint of Chapter 5: Repetition and Loop Statements Problem Solving & Program.
14 Copyright © 2005, Oracle. All rights reserved. System Management Tasks and Techniques.
Refreshing Materialized Views
10 Copyright © 2005, Oracle. All rights reserved. Dimensions.
12 Copyright © 2005, Oracle. All rights reserved. Query Rewrite.
15 Copyright © 2005, Oracle. All rights reserved. Container-Managed Relationships (CMRs)
1 RA I Sub-Regional Training Seminar on CLIMAT&CLIMAT TEMP Reporting Casablanca, Morocco, 20 – 22 December 2005 Status of observing programmes in RA I.
Dr. Alexandra I. Cristea CS 252: Fundamentals of Relational Databases: SQL5.
SQL: The Query Language Part 2
Database Systems: Design, Implementation, and Management
Solve Multi-step Equations
REVIEW: Arthropod ID. 1. Name the subphylum. 2. Name the subphylum. 3. Name the order.
Impressive Star Softwares (P) Ltd. Presents Sent Item Box-Detail of Mails from Tally ( 1.0 )
1.
Introduction to SQL Tuning Brown Bag Three essential concepts.
9 Copyright © 2006, Oracle. All rights reserved. Automatic Performance Management.
Database Performance Tuning and Query Optimization
13 Copyright © 2005, Oracle. All rights reserved. Monitoring and Improving Performance.
Overview of performance tuning strategies Oracle Performance Tuning Allan Young June 2008.
© Bharati Vidyapeeths Institute of Computer Applications and Management, New Delhi © Bharati Vidyapeeths Institute of Computer Applications and.
Database Performance Tuning and Query Optimization
PP Test Review Sections 6-1 to 6-6
11 Copyright © Oracle Corporation, All rights reserved. Managing Tables.
9 Copyright © 2004, Oracle. All rights reserved. Using DDL Statements to Create and Manage Tables.
Yong Choi School of Business CSU, Bakersfield
Displaying Data from Multiple Tables
Go-Faster Consultancy Ltd.1 Experiences of Global Temporary Tables in Oracle 8.1 David Kurtz Go-Faster Consultancy Ltd.
1 tRelational/DPS Overview. 2 ADABAS Data Transfer: business needs and issues tRelational & DPS Overview Summary Questions? Demo Agenda.
R12 Assets A Look Inside SM. Copyright © 2008 Chi-Star Technology SM -2- High-Level Overview R12 Setups –Subledger Accounting –ADI Templates –XML Reports.
8 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Using Explicit Cursors.
Copyright © 2012, Elsevier Inc. All rights Reserved. 1 Chapter 7 Modeling Structure with Blocks.
Note: A bolded number or letter refers to an entire lesson or appendix. A Adding Data Through a View ADD_MONTHS Function 03-22, 03-23, 03-46,
1 RA III - Regional Training Seminar on CLIMAT&CLIMAT TEMP Reporting Buenos Aires, Argentina, 25 – 27 October 2006 Status of observing programmes in RA.
Factor P 16 8(8-5ab) 4(d² + 4) 3rs(2r – s) 15cd(1 + 2cd) 8(4a² + 3b²)
Basel-ICU-Journal Challenge18/20/ Basel-ICU-Journal Challenge8/20/2014.
4 Oracle Data Integrator First Project – Simple Transformations: One source, one target 3-1.
1..
CONTROL VISION Set-up. Step 1 Step 2 Step 3 Step 5 Step 4.
© 2012 National Heart Foundation of Australia. Slide 2.
1 10 pt 15 pt 20 pt 25 pt 5 pt 10 pt 15 pt 20 pt 25 pt 5 pt 10 pt 15 pt 20 pt 25 pt 5 pt 10 pt 15 pt 20 pt 25 pt 5 pt 10 pt 15 pt 20 pt 25 pt 5 pt Synthetic.
Materialized Views.
Model and Relationships 6 M 1 M M M M M M M M M M M M M M M M
Analyzing Genes and Genomes
©Brooks/Cole, 2001 Chapter 12 Derived Types-- Enumerated, Structure and Union.
Essential Cell Biology
Intracellular Compartments and Transport
PSSA Preparation.
Essential Cell Biology
Immunobiology: The Immune System in Health & Disease Sixth Edition
Energy Generation in Mitochondria and Chlorplasts
TCP/IP Protocol Suite 1 Chapter 18 Upon completion you will be able to: Remote Login: Telnet Understand how TELNET works Understand the role of NVT in.
What Happens when a SQL statement is issued?
Oracle Database Administration Lecture 6 Indexes, Optimizer, Hints.
1 Chapter 13 Parallel SQL. 2 Understanding Parallel SQL Enables a SQL statement to be: – Split into multiple threads – Each thread processed simultaneously.
8 Copyright © 2005, Oracle. All rights reserved. Gathering Statistics.
Presentation transcript:

8 Copyright © 2005, Oracle. All rights reserved. Parallel Operations in Data Warehouses

8-2 Copyright © 2005, Oracle. All rights reserved. Objectives After completing this lesson, you should be able to do the following: Determine when partitionwise joins are used Use the ALTER SESSION command to force parallel operations Create indexes in parallel Set initialization parameters relating to parallel operations tuning Query dynamic performance views related to parallel operations tuning Tune PDML operations

8-3 Copyright © 2005, Oracle. All rights reserved. Parallel Query The various query types that can be parallelized are: Access methods: –Table scans, fast full index scans –Partitioned index range scans –Various SQL operations: Sorts, aggregations, and set operations Join methods: –Nested loop, sort merge –Hash, star transformation, partitionwise join

8-4 Copyright © 2005, Oracle. All rights reserved. Parallel Partitioned Table Scan Scan by ROWID for partitioned tables. SELECT /*+ PARALLEL(SALES,9)*/ * FROM SALES; SALES PQ1 PQ2 PQ3 PQ4PQ5 PQ6 PQ7 PQ8 PQ9

8-5 Copyright © 2005, Oracle. All rights reserved. Parallel Partitioned Index Scan Scans can be performed by partition for partitioned indexes and tables. The hint must contain the table name, index name, and degree of parallelism. SELECT /*+ PARALLEL_INDEX(c,ic,3)*/ * FROM customers c WHERE cust_city = 'MARSEILLE'; Nonprefixed index IC Indexed column cust_city PQ1 PQ2 PQ3

8-6 Copyright © 2005, Oracle. All rights reserved. Partitionwise Joins Query slavePartition Partitioned table Partial partitionwise join QS Full partitionwise join QS

8-7 Copyright © 2005, Oracle. All rights reserved. Parallel DDL The parallel DDL statements for nonpartitioned tables and indexes are: – CREATE INDEX – CREATE TABLE... AS SELECT – ALTER INDEX... REBUILD The parallel DDL statements for partitioned tables and indexes are: – CREATE INDEX – CREATE TABLE... AS SELECT – ALTER TABLE... MOVE PARTITION – ALTER TABLE... SPLIT PARTITION – ALTER TABLE... COALESCE PARTITION – ALTER INDEX... REBUILD PARTITION – ALTER INDEX... SPLIT PARTITION

8-8 Copyright © 2005, Oracle. All rights reserved. Creating Indexes in Parallel Object Parallel execution server Nonpartitioned index Index piece Data

8-9 Copyright © 2005, Oracle. All rights reserved. Creating Indexes in Parallel Global partitioned index Object Parallel execution server Index piece Data

8-10 Copyright © 2005, Oracle. All rights reserved. Creating Indexes in Parallel Local partitioned index Object Parallel execution server Index piece Data

8-11 Copyright © 2005, Oracle. All rights reserved. Parallel DDL: Example DDL statements are parallelized by specifying a PARALLEL clause: CREATE BITMAP INDEX fk_sales_prod ON sales(prod_id) PARALLEL 16 LOCAL NOLOGGING;

8-12 Copyright © 2005, Oracle. All rights reserved. Parallel DML: Overview Complement parallel query architecture by providing parallelization for: – INSERT – UPDATE – DELETE – MERGE Useful when changing big tables

8-13 Copyright © 2005, Oracle. All rights reserved. Performance Benefits of Parallel DML Can dramatically speed up DML transactions that can be parallelized Serial update: Parallel update: … … … … UPDATE sales SET amount_sold=amount_sold* ; alter session enable parallel DML; UPDATE /*+PARALLEL(sales,12)*/ sales SET amount_sold=amount_sold* ;

8-14 Copyright © 2005, Oracle. All rights reserved. Enabling Parallel DML You must enable PDML. The ALTER SESSION statement enables parallel DML mode: Parallel queries are still parallelized, even if parallel DML is disabled. The default mode of a session is DISABLE PARALLEL DML. ALTER SESSION DISABLE PARALLEL DML ENABLE ALTER SESSION PARALLEL DML FORCE PARALLEL n

8-15 Copyright © 2005, Oracle. All rights reserved. Parallel DML: Example MERGE /*+ PARALLEL(c,3) PARALLEL(d,3) */ INTO customers c USING diff_customers d ON (d.cust_id = c.cust_id) WHEN MATCHED THEN UPDATE SET c.cust_last_name = d.cust_last_name, c.cust_city = d.cust_city WHEN NOT MATCHED THEN INSERT (c.cust_id,c.cust_last_name) VALUES (d.cust_id,d.cust_last_name);

8-16 Copyright © 2005, Oracle. All rights reserved. When to Use Parallel DML Scenarios where parallel DML is used include: Refreshing large tables in a data warehouse Creating intermediate summary tables Using scoring tables Updating historical tables Running batch jobs

8-17 Copyright © 2005, Oracle. All rights reserved.

8-18 Copyright © 2005, Oracle. All rights reserved. Restrictions on Parallel DML After a PDML statement modifies an object, it is no longer possible to query or modify this object in the same transaction ( ORA ). Limited integrity constraint support is provided. Clustered tables are not supported. PDML is not allowed: –On tables with enabled triggers –On remote objects –When the operation is part of a distributed transaction

8-19 Copyright © 2005, Oracle. All rights reserved. Tuning Parameters for Parallel Execution The initial computed values of parallel execution parameters should be acceptable in most cases. They are based on the values of CPU_COUNT and PARALLEL_THREADS_PER_CPU at database startup. Oracle Corporation recommends that you use the default settings. Manual tuning of parallel execution is more complex than using default settings. –Manual parallel execution tuning requires more attentive administration than automated tuning. –Manual tuning is prone to user-load and system resource miscalculations.

8-20 Copyright © 2005, Oracle. All rights reserved. Using Default Parameter Settings Increasing 4K to 8K improves parallel performance if SGA is large enough 2 KB (port specific) PARALLEL_EXECUTION_ MESSAGE_SIZE Maximizes the number of processes used by parallel execution CPU_COUNT x PARALLEL_THREADS_ PER_CPU x (1; 2 if PGA_AGGREGATE_TARGET > 0) x 5 PARALLEL_MAX_SERVERS Throttles DOP requests to prevent system overload TRUEPARALLEL_ADAPTIVE_ MULTI_USER CommentsDefaultsParameter

8-21 Copyright © 2005, Oracle. All rights reserved. Balancing the Workload To optimize performance, all parallel execution servers should have equal workloads. For parallelization by block range or parallel execution servers, the workload is dynamically divided among the parallel execution servers. By choosing an appropriate DOP, you can: –Minimize workload skew –Optimize performance

8-22 Copyright © 2005, Oracle. All rights reserved.

8-23 Copyright © 2005, Oracle. All rights reserved. Adaptive Multiuser and DOP The adaptive multiuser feature adjusts the DOP on the basis of user load. PARALLEL_ADAPTIVE_MULTI_USER set to: – TRUE improves performance in a multiuser environment (default) – FALSE is used for batch processing PARALLEL_AUTOMATIC_TUNING has been deprecated in Oracle Database 10g. –Kept for backward compatibility only

8-24 Copyright © 2005, Oracle. All rights reserved. Resource Manager and the DOP Resource plan: NIGHT_PLAN Resource consumer group OLTP DSS Allocation method parameters CPU = 25% Max Degree of parallelism = 2 CPU = 75% Max Degree of parallelism = 20

8-25 Copyright © 2005, Oracle. All rights reserved.

8-26 Copyright © 2005, Oracle. All rights reserved. Are There Execution Problems? Use V$PQ_TQSTAT to find out whether there is data distribution skew or bad object statistics: –Contains traffic statistics between slaves at table queue level –Valid only when queried from the parallel session Check I/O and CPU bound at the operating system level and decide on the parallelism. Check for contention.

8-27 Copyright © 2005, Oracle. All rights reserved. Data Distribution and V$PQ_TQSTAT SELECT /*+PARALLEL*/ cust_city, sum(amount_sold) FROM sales s, customers c WHERE s.cust_id=c.cust_id GROUP BY cust_city;... PX SEND QC (RANDOM) :TQ10002 P->S QC (RAND) HASH GROUP BY PCWP PX RECEIVE PCWP PX SEND HASH :TQ10001 P->P HASH HASH GROUP BY PCWP HASH JOIN PCWP PX RECEIVE PCWP PX SEND BROADCAST :TQ10000 P->P BROADCAST PX BLOCK ITERATOR PCWC TABLE ACCESS FULL CUSTOMERS PCWP PX BLOCK ITERATOR PCWC TABLE ACCESS FULL SALES PCWP

8-28 Copyright © 2005, Oracle. All rights reserved. Data Distribution and V$PQ_TQSTAT DFO_NUMBER TQ_ID SERVER_TYP PROCESS NUM_ROWS Consumer P Consumer P Producer P Producer P Consumer P Consumer P Producer P Producer P Consumer QC Consumer P Producer P

8-29 Copyright © 2005, Oracle. All rights reserved. Using Other Dynamic Performance Views General information: – V$FILESTAT – V$SESSTAT, V$SYSSTAT Information about parallel execution: – V$PX_SESSION – V$PX_PROCESS – V$PX_PROCESS_SYSSTAT – V$PX_SESSTAT – V$PQ_SESSTAT – V$PX_BUFFER_ADVICE TIMED_STATISTICS should be set to TRUE.

8-30 Copyright © 2005, Oracle. All rights reserved.

8-31 Copyright © 2005, Oracle. All rights reserved. Using V$PX_SESSION QCSID SID Group Set Degree ReqDegree SELECT qcsid, sid, server_group "Group", server_set "Set", degree "Degree", req_degree "ReqDegree" FROM V$PX_SESSION ORDER BY 1,3,4;

8-32 Copyright © 2005, Oracle. All rights reserved. Using V$PX_SESSTAT QCSID SID Group Set StatName VALUE physical reads physical reads physical reads physical reads physical reads 2 SELECT qcsid, sid, server_group "Group", server_set "Set", name "StatName", VALUE FROM V$PX_SESSTAT A, V$STATNAME B WHERE A.statistic# = B.statistic# AND name = 'physical reads' AND value > 0 ORDER BY 1,3,4;

8-33 Copyright © 2005, Oracle. All rights reserved. Using V$PX_PROCESS SERV STATUS PID SPID SID SERIAL P002 IN USE P003 IN USE P004 AVAILABLE P005 AVAILABLE P000 IN USE P001 IN USE SELECT * FROM V$PX_PROCESS;

8-34 Copyright © 2005, Oracle. All rights reserved. Using V$SYSSTAT SELECT name, value FROM V$SYSSTAT WHERE UPPER(name) LIKE '%PARALLEL OPERATIONS%' OR UPPER(name) LIKE '%PARALLELIZED%' OR UPPER(name) LIKE '%PX%';

8-35 Copyright © 2005, Oracle. All rights reserved. Using V$SYSSTAT NAME VALUE queries parallelized 347 DML statements parallelized 0 DDL statements parallelized 0 DFO trees parallelized 463 Parallel operations not downgraded 28 Parallel operations downgraded to serial 31 Parallel operations downgraded 75 to 99 pct 252 Parallel operations downgraded 50 to 75 pct 128 Parallel operations downgraded 25 to 50 pct 43 Parallel operations downgraded 1 to 25 pct 12 PX local messages sent PX local messages recv'd PX remote messages sent 0 PX remote messages recv'd 0

8-36 Copyright © 2005, Oracle. All rights reserved. Tuning PDML Using local striping for local indexes Using global striping for global indexes Increasing INITRANS for global indexes Using NOLOGGING Using multiple archivers Using multiple DBWRs or I/O slaves

8-37 Copyright © 2005, Oracle. All rights reserved. Summary In this lesson, you should have learned how to: Determine when partitionwise joins are used Use the ALTER SESSION command to force parallel operations Create indexes in parallel Set initialization parameters relating to parallel operations tuning Query dynamic performance views related to parallel operations tuning Tune PDML operations

8-38 Copyright © 2005, Oracle. All rights reserved. Practice 8: Overview This practice covers the following topics: Forcing parallelization of queries Interpreting a partial parallel partitionwise join execution plan Forcing parallelization of DMLs Verifying the requested DOP for a parallel DDL operation