Alles over groeperen Rollups, Cubes, Grouping Sets en hun interne werking Rob van Wijk 22 september 2014.

Slides:



Advertisements
Similar presentations
Analytic Functions : An Oracle Developer’s Best Friend
Advertisements

TWO STEP EQUATIONS 1. SOLVE FOR X 2. DO THE ADDITION STEP FIRST
Two Special Right Triangles
Chapter 1 The Study of Body Function Image PowerPoint
1 Copyright © 2010, Elsevier Inc. All rights Reserved Fig 2.1 Chapter 2.
By D. Fisher Geometric Transformations. Reflection, Rotation, or Translation 1.
Business Transaction Management Software for Application Coordination 1 Business Processes and Coordination.
Jeopardy Q 1 Q 6 Q 11 Q 16 Q 21 Q 2 Q 7 Q 12 Q 17 Q 22 Q 3 Q 8 Q 13
Jeopardy Q 1 Q 6 Q 11 Q 16 Q 21 Q 2 Q 7 Q 12 Q 17 Q 22 Q 3 Q 8 Q 13
Multiplying binomials You will have 20 seconds to answer each of the following multiplication problems. If you get hung up, go to the next problem when.
0 - 0.
1 1  1 =.
2 pt 3 pt 4 pt 5 pt 1 pt 2 pt 3 pt 4 pt 5 pt 1 pt 2 pt 3 pt 4 pt 5 pt 1 pt 2 pt 3 pt 4 pt 5 pt 1 pt 2 pt 3 pt 4 pt 5 pt 1 pt Time Money AdditionSubtraction.
DIVIDING INTEGERS 1. IF THE SIGNS ARE THE SAME THE ANSWER IS POSITIVE 2. IF THE SIGNS ARE DIFFERENT THE ANSWER IS NEGATIVE.
MULT. INTEGERS 1. IF THE SIGNS ARE THE SAME THE ANSWER IS POSITIVE 2. IF THE SIGNS ARE DIFFERENT THE ANSWER IS NEGATIVE.
FACTORING ax2 + bx + c Think “unfoil” Work down, Show all steps.
Addition Facts
Year 6 mental test 5 second questions
ZMQS ZMQS
Objective - To simplify expressions using the order of operations. Simplify each expression below. 1) 6 + 5(8 - 2) 2) 3) 4)
REVIEW: Arthropod ID. 1. Name the subphylum. 2. Name the subphylum. 3. Name the order.
© Richard A. Medeiros 2004 x y Function Machine Function Machine next.
Displaying Data from Multiple Tables. Objectives After completing this lesson, you should Be able to do the following: Write SELECT statements to accessWrite.
Displaying Data from Multiple Tables
Real Application Testing Spreker: Datum: Patrick Munne, Senior Oracle DBA 17 april 2009.
Exarte Bezoek aan de Mediacampus Bachelor in de grafische en digitale media April 2014.
© Charles van Marrewijk, An Introduction to Geographical Economics Brakman, Garretsen, and Van Marrewijk.
© Charles van Marrewijk, An Introduction to Geographical Economics Brakman, Garretsen, and Van Marrewijk.
VOORBLAD.
8 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Using Explicit Cursors.
Web Programming with PL/SQL Erdogan Dogdu Georgia State University Computer Science Department
Copyright  Oracle Corporation, All rights reserved. 1 Writing Basic SQL Statements.
Squares and Square Root WALK. Solve each problem REVIEW:
Basel-ICU-Journal Challenge18/20/ Basel-ICU-Journal Challenge8/20/2014.
UNIT 2: SOLVING EQUATIONS AND INEQUALITIES SOLVE EACH OF THE FOLLOWING EQUATIONS FOR y. # x + 5 y = x 5 y = 2 x y = 2 x y.
Addition 1’s to 20.
25 seconds left…...
Optimizing and Simplifying Complex SQL with Advanced Grouping Presented by: Jared Still.
Presenteren wij ………………….
Januar MDMDFSSMDMDFSSS
Week 1.
2 x0 0 12/13/2014 Know Your Facts!. 2 x1 2 12/13/2014 Know Your Facts!
Vervolg C Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology 1 Onderwerpen voor vandaag functie definitions;.h files;
We will resume in: 25 Minutes.
©Brooks/Cole, 2001 Chapter 12 Derived Types-- Enumerated, Structure and Union.
Intracellular Compartments and Transport
Bottoms Up Factoring. Start with the X-box 3-9 Product Sum
1 Unit 1 Kinematics Chapter 1 Day
PSSA Preparation.
Essential Cell Biology
Number Factors and Multiples Saturday, 09 September 2006 ©RSH.
Weekly Attendance by Class w/e 6 th September 2013.
Copyright  Oracle Corporation, All rights reserved. 3 Displaying Data from Multiple Tables.
Displaying Data from Multiple Tables. Objectives After completing this lesson, you should be able to do the following:  Write SELECT statements to access.
Displaying Data from Multiple Tables. Objectives After completing this lesson, you should be able to do the following: Write SELECT statements to access.
After completing this lesson, you should be able to do the following: Write SELECT statements to access data from more than one table using equality and.
Chapter 4 JOINING TABLES & FUNCTION Lecture by Ty Rasmey
1 Challenge the future Load Flow Problem Parallel Programming on the GPU with MATLAB Erik Berkhof.
Jonathan Lewis EOUG Jun 2000 Execution Plans Agenda What are execution plans Where do you find execution plans Key mechanisms of execution Understanding.
Oracle University Live Virtual Seminar SQL Masterclass Rob van Wijk2011.
Zet GeoICT aan het werk! Ruimte voor bodem Andreas Hoogeveen 12 november 2015.
Rollups, Cubes, Grouping Sets and their inner working
Rollups, Cubes, Grouping Sets and their inner working
Presentation transcript:

Alles over groeperen Rollups, Cubes, Grouping Sets en hun interne werking Rob van Wijk 22 september 2014

Wie ben ik Rob van Wijk 22 september 2014 Oracle ontwikkelaar Utrecht

Alles Over Groeperen Inleiding GROUPING SETS ROLLUP CUBE Combineren / rekenen Ondersteunende functies Interne werking Onderwerpen 22 september 2014

Alles Over Groeperen Inleiding 22 september 2014 aog1.sql

Alles Over Groeperen GROUP BY col 1, …, col n ≡ GROUP BY GROUPING SETS ( (col 1, …, col n ) ) GROUPING SETS (1) 22 september 2014 aog2.sql

Alles Over Groeperen GROUP BY GROUPING SETS ( (col 11, …, col 1n ), …, (col x1, …, col xm ) ) ≡ GROUP BY col 11, … col 1n UNION ALL … UNION ALL GROUP BY col x1, …, col xm GROUPING SETS (2) 22 september 2014 aog3.sql

Alles Over Groeperen GROUP BY ROLLUP ( set 1, …, set n ) ≡ GROUP BY GROUPING SETS ( (set 1, …, set n ), (set 1, …, set n-1 ), …, set 1, () ) ROLLUP (1) 22 september 2014

Alles Over Groeperen ROLLUP (set 1, …, set N ) met N ≥ 1 leidt tot N+1 GROUPING SETS ROLLUP (2) 22 september 2014

Alles Over Groeperen Voorbeeld: GROUP BY ROLLUP ( (deptno), (job,mgr), (empno) ) ≡ GROUP BY GROUPING SETS ( (deptno,job,mgr,empno), (deptno,job,mgr), (deptno), () ) ROLLUP (3) 22 september 2014 aog4.sql

Alles Over Groeperen GROUP BY CUBE ( set 1, …, set n ) ≡ GROUP BY GROUPING SETS (alle mogelijke combinaties tussen () en (set 1, …, set n ) ) CUBE (1) 22 september 2014

Alles Over Groeperen CUBE (set 1, …, set N ) met N ≥ 1 leidt tot 2 N GROUPING SETS CUBE (2) 22 september 2014

Alles Over Groeperen CUBE (3) 22 september sets X 1 set 2 sets 3 sets 4 sets Volgens de driehoek van Pascal

Alles Over Groeperen Voorbeeld: GROUP BY CUBE ( (deptno), (job,mgr), (empno) ) ≡ GROUP BY GROUPING SETS ( (deptno,job,mgr,empno), (deptno,job,mgr), (deptno,empno), (job,mgr,empno), (deptno), (job,mgr), (empno), () ) CUBE (4) 22 september 2014 aog5.sql

Alles Over Groeperen GROUP BY deptno, ROLLUP(empno) ? Combineren / rekenen (1) 22 september 2014

Alles Over Groeperen GROUP BY deptno, ROLLUP(empno) ≡ GROUP BY GROUPING SETS (deptno), GROUPING SETS ( empno, () ) Combineren / rekenen (2) 22 september 2014

Alles Over Groeperen Cartesisch product ! GROUP BY deptno, ROLLUP(empno) ≡ GROUP BY GROUPING SETS (deptno), GROUPING SETS ( (empno), () ) ≡ GROUP BY GROUPING SETS ( (deptno,empno), (deptno) ) Combineren / rekenen (3) 22 september 2014 aog6.sql

Alles Over Groeperen Vraag: Hoeveel grouping sets levert dit op? GROUP BY ROLLUP(deptno,job), CUBE(mgr,hiredate) Antwoord: 3 * 4 = 12 Combineren / rekenen (4) 22 september 2014 aog7.sql

Alles Over Groeperen GROUPING GROUPING_ID GROUP_ID Ondersteunende functies 22 september 2014 aog8.sql

Alles Over Groeperen SORT GROUP BY versus HASH GROUP BY Interne werking 22 september 2014

Alles Over Groeperen Interne werking: ROLLUP (deptno,empno) 22 september NULL NULL NULL NULL inkomende verzameling grouping set ( (deptno,empno) ) grouping set ( () ) grouping set ( (deptno) ) SORT GROUP BY aog9.sql

Alles Over Groeperen Interne werking: CUBE(deptno,job) 22 september 2014 SORT GROUP BY GENERATE CUBE SORT GROUP BY inkomende verzameling grouping set (deptno,job) 14 rijen 9 rijen 36 rijen 18 rijen aog10.sql

Alles Over Groeperen Interne werking: GROUPING SETS (1) 22 september 2014 LOAD AS SELECT (into input table) TABLE ACCESS FULL (EMP) TEMP TABLE TRANSFORMATION VIEW TABLE ACCESS FULL (output table) tijdelijke inputtabel SYS_TEMP_... tijdelijke outputtabel SYS_TEMP_... LOAD AS SELECT (into outputtabel) HASH GROUP BY TABLE ACCESS FULL (input tabel) itereer zo vaak als dat er grouping sets zijn aog11.sql

Alles Over Groeperen Optimalisatie naar ROLLUP of CUBE executie indien mogelijk ? Interne werking: GROUPING SETS (2) 22 september 2014 aog12.sql

Alles Over Groeperen Vragen? 22 september 2014