DB Tuning Ch 14. Parallel Processing Ch 15. Performance of DML Ch 16. Analytic Function Jaeseok Myung Intelligent Database Systems Lab School of Computer Science & Engineering Seoul National University, Seoul, Korea Center for E-Business Technology Seoul National University Seoul, Korea
Parallel Processing Goal Architecture Utilization of System Resource Reduction of Response Time Multi-Processes Response Time = CPU Time + Wait Time Architecture Query Coordinator Syntactic Analyzing Assign small jobs to slaves Generate final result Slave Process Do works Send results
How to PP Parameters in Oracle Two ways of using PP functionality Parallel_min_server Determine initial minimum, Default : 0 Parallel_max_server Determine initial maximum, Default : 5, Max : 255 Two ways of using PP functionality Insert a hint into a query SELECT /*+ PARALLEL(A, 2) */ user, sum(amount) FROM sales_history GROUP BY user; Alter the degree of table ALTER TABLE sales_history PARALLEL 2;
Execution Plans of PP
Execution Plans of PP Parallel_from_serial, Parallel_to_serial, Parallel_to_parallel Parallel_combined_with_parent, Parallel_combined_with_child
DB Tuning Ch 14. Parallel Processing Ch 15. Performance of DML Ch 16. Analytic Function Jaeseok Myung Intelligent Database Systems Lab School of Computer Science & Engineering Seoul National University, Seoul, Korea Center for E-Business Technology Seoul National University Seoul, Korea
Issues on DML Processing Excessive Requests for Resources Rollback Segment Redo Log Disk IO Excessive Indices Overhead for index management A Misguided Execution Plan We can put ‘where clause’ into the DML
Insert (1) Conventional Insert INSERT INTO TAB1 VALUES (COL1, COL2); Index, Disk IO Tunings can be applied A special ‘insert’ including ‘select’ has more options INSERT INTO TAB1 SELECT COL1, COL2 FROM TAB2 WHERE COL3 > 100; Direct Loading Parallel Direct Loading Nologging
Direct Loading INSERT INTO TAB1 ~; INSERT INTO /*+ APPEND */ TAB1 ~;
Insert (2) Parallel Direct Loading Nologging Direct Loading + Parallel Functionality ALTER SESSION ENABLE PARALLEL DML; INSERT /*+ PARALLEL (A, 4) */ INTO TAB1 Nologging Only be allowed with Direct Loading or Parallel Direct Loading ALTER TABLE TAB1 NOLOGGING; We may need backup
Delete & Update (1) Resources Need more rollback segment than insert operation More RedoLog, More Disk IO
Delete & Update (2) Checkpoint Parallel Hint Alternatives Index Counts Execution Plan – Where Clause Parallel Hint DELETE /*+ PARALLEL (A, 4) */ ~; UPDATE /*+ PARALLEL (A, 4) */ ~; Alternatives Use ‘Insert’ instead of ‘Delete’ if we have too much data Less RedoLog, Less Rollback Segment
DB Tuning Ch 14. Parallel Processing Ch 15. Performance of DML Ch 16. Analytic Function Jaeseok Myung Intelligent Database Systems Lab School of Computer Science & Engineering Seoul National University, Seoul, Korea Center for E-Business Technology Seoul National University Seoul, Korea
Analytic Function Keep SQL queries to be simple Use less GROUP BY SELECT deptno, name, sal, COUNT(sal) OVER (PARTITION BY deptno ORDER BY sal) FROM employee; AVG, COUNT, MIN, MAX, … Tune indices carefully
Conclusion How much helpful? – It’s not a critical section Ch 14. Parallel Processing Ch 15. Performance of DML Ch 16. Analytic Function But, Interesting Thank you